diff --git a/modelWeb/.classpath b/modelWeb/.classpath new file mode 100644 index 000000000..772e70ca1 --- /dev/null +++ b/modelWeb/.classpath @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modelWeb/.project b/modelWeb/.project new file mode 100644 index 000000000..9f6ca69a2 --- /dev/null +++ b/modelWeb/.project @@ -0,0 +1,48 @@ + + + modelWeb + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipselabs.tapiji.tools.core.I18NBuilder + + + + + org.zeroturnaround.eclipse.rebelXmlBuilder + + + + + org.eclipse.babel.editor.rbeBuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.project.facet.core.nature + org.eclipselabs.tapiji.tools.core.nature + org.zeroturnaround.eclipse.jrebelNature + com.jaspersoft.studio.babel.editor.rbeNature + + diff --git a/modelWeb/.settings/org.eclipse.jdt.core.prefs b/modelWeb/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..d85923da1 --- /dev/null +++ b/modelWeb/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,287 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=480 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=9999 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/modelWeb/.settings/org.eclipse.jdt.ui.prefs b/modelWeb/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..780d9f3f2 --- /dev/null +++ b/modelWeb/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +formatter_profile=_rjconsultores +formatter_settings_version=12 diff --git a/modelWeb/.settings/org.eclipse.wst.common.component b/modelWeb/.settings/org.eclipse.wst.common.component new file mode 100644 index 000000000..b1279627b --- /dev/null +++ b/modelWeb/.settings/org.eclipse.wst.common.component @@ -0,0 +1,6 @@ + + + + + + diff --git a/modelWeb/.settings/org.eclipse.wst.common.project.facet.core.xml b/modelWeb/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 000000000..b069b576d --- /dev/null +++ b/modelWeb/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/modelWeb/.settings/org.hibernate.eclipse.console.prefs b/modelWeb/.settings/org.hibernate.eclipse.console.prefs new file mode 100644 index 000000000..1f629b5cf --- /dev/null +++ b/modelWeb/.settings/org.hibernate.eclipse.console.prefs @@ -0,0 +1,4 @@ +#Fri Nov 04 10:48:34 BRST 2011 +default.configuration= +eclipse.preferences.version=1 +hibernate3.enabled=false diff --git a/modelWeb/.settings/org.jboss.ide.eclipse.as.core.prefs b/modelWeb/.settings/org.jboss.ide.eclipse.as.core.prefs new file mode 100644 index 000000000..6c0f5e101 --- /dev/null +++ b/modelWeb/.settings/org.jboss.ide.eclipse.as.core.prefs @@ -0,0 +1,3 @@ +#Tue Oct 18 15:19:18 BRST 2011 +eclipse.preferences.version=1 +org.jboss.ide.eclipse.as.core.singledeployable.deployableList= diff --git a/modelWeb/src/META-INF/MANIFEST.MF b/modelWeb/src/META-INF/MANIFEST.MF new file mode 100644 index 000000000..ee8f8df13 --- /dev/null +++ b/modelWeb/src/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.8.2 +Created-By: 1.7.0-b147 (Oracle Corporation) \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/constantes/Constantes.java b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/Constantes.java new file mode 100644 index 000000000..934f2b1cc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/Constantes.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.constantes; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + + +public class Constantes { + + public static final Long FORMA_PAGO_DINHEIRO = new Long(1); + public static final Long FORMA_PAGO_RESERVA = new Long(94); + public static final Long FORMA_PAGO_NOTA_CREDITO = new Long(93); + public static final Long FORMA_PAGO_CREDITO = new Long(2); + public static final Long FORMA_PAGO_DEBITO = new Long(3); + + public static final Long MVO_CANCEL_CANCELACION = new Long(31); + public static final Long MVO_CANCEL_DEVOLUCAO = new Long(32); + public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_50 = new Long(36); + public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_100 = new Long(37); + public static final Long MVO_CANCEL_TROCA = new Long(10); + public static final Long MVO_CANCEL_CHECKIN = new Long(27); + public static final Long MVO_CANCEL_TRANSFERENCIA = new Long(23); + public static final Long MVO_CANCEL_BOLETO_ENTREGADO = new Long(16); + public static final Long MVO_CANCEL_BOLETO_AGRUPAMENTO = new Long(17); + public static final Long MVO_CANCEL_VENDA_PACOTE = new Long(33); + + public static Long TPV_DIRECTO_NORMAL = new Long(1); + public static Long TPV_MANUAL = new Long(3); + public static Long TPV_CALL_CENTER = new Long(5); + public static Long TPV_BOLETO_REMOTO = new Long(18); + public static Long TPV_TRANSFERENCIAS = new Long(8); // é a troca de passagens + public static Long TPV_CAMBIO_VIAJE = new Long(81); // é a transferência de passagens + public static Long TPV_CHECKIN_VIAGEM = new Long(41); // chekin boletos + public static Long TPV_BOLETO_ABIERTO = new Long(9); + public static Long TPV_CONFIRMA_ABIERTO = new Long(82); + + public static Long TPV_RESERVACION_POR_INTERNET = new Long(16); + public static Long TPV_POR_INTERNET = new Long(12); + public static Long TPV_AGENCIA_WEB = new Long(19); + + public static final Integer TIPO_OPERACION_CC_LQ = new Integer(1); + public static final Integer TIPO_OPERACION_CC_PAGO = new Integer(2); + + public static Short TURNO_AUTOMATICO = new Short("99"); + + public static List ORGAOS_CONCEDENTES_CALCULO_ARTESP = new ArrayList(Arrays.asList(new Integer[]{21})) ; + public static List ORGAOS_CONCEDENTES_CALCULO_ANTT = new ArrayList(Arrays.asList(new Integer[]{3,9,15})); + + public static String CLAVE_EDITAR_COMISSAO = "COM.RJCONSULTORES.ADMINISTRACION.PUNTOVENTA.EDITARCOMISSAO"; + public static String CLAVE_REABRIR_MOVIMENTODIARIO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.COMISSAO.MENU.CONFERENCIACOMISSAO.REABRIRMOVIMENTODIARIO"; + public static String CLAVE_ENCERRAR_MOVIMENTODIARIO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.COMISSAO.MENU.CONFERENCIACOMISSAO.ENCERRARMOVIMENTODIARIO"; + + public static final String UTF_8 = "UTF-8"; + + public static final int INTERVALO_FECHAMENTO_DIARIO = 1; + public static final int INTERVALO_FECHAMENTO_SEMANAL = 7; + public static final int INTERVALO_FECHAMENTO_DECENDIAL = 10; + public static final int INTERVALO_FECHAMENTO_QUINZENAL = 15; + public static final int INTERVALO_FECHAMENTO_MENSAL = 30; + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java new file mode 100644 index 000000000..a5c6043bf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.constantes; + +public interface ConstantesTipoDesconto { + int DESCONTO_POR_NUMERO_DOCUMENTO = 1, + DESCONTO_POR_QUANTIDADE = 2, + TIPO_DESCONTO_NAO_INFORMADO = 0; +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoValidaVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoValidaVenta.java new file mode 100644 index 000000000..171757094 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoValidaVenta.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.constantes; + +public interface ConstantesTipoValidaVenta { + String COD_AGENCIA = "A"; + String COD_MOTORISTA = "M"; + String AGENCIA = "AGENCIA"; + String MOTORISTA = "MOTORISTA"; +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesVendaEmbarcada.java b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesVendaEmbarcada.java new file mode 100644 index 000000000..12de64bc3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/ConstantesVendaEmbarcada.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.constantes; + +public class ConstantesVendaEmbarcada { + + public static final int VENDA_GERADA = 0; + public static final int VENDA_BOLETO_ERROR = 1; + public static final int VENDA_BOLETO_FORMAPAGO_ERROR = 2; + public static final int VENDA_CAJA_ERROR = 3; + public static final int VENDA_CAJA_FORMAPAGO_ERROR = 4; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/constantes/DescricaoTipoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/DescricaoTipoVenta.java new file mode 100644 index 000000000..af6cf6620 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/constantes/DescricaoTipoVenta.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.constantes; + +public class DescricaoTipoVenta { + + public static String getDescricaoTipoVenta(Integer tipoVentaId) { + if(Constantes.TPV_DIRECTO_NORMAL.intValue() == tipoVentaId) { + return "NORMAL"; + } else if(Constantes.TPV_MANUAL.intValue() == tipoVentaId) { + return "MANUAL"; + } else if(Constantes.TPV_BOLETO_REMOTO.intValue() == tipoVentaId) { + return "GAP"; + } else if(Constantes.TPV_TRANSFERENCIAS.intValue() == tipoVentaId) { + return "TRANSFERENCIA"; + } else if(Constantes.TPV_CAMBIO_VIAJE.intValue() == tipoVentaId) { + return "TROCA PASSAGEM"; + } else if(Constantes.TPV_CHECKIN_VIAGEM.intValue() == tipoVentaId) { + return "CHECKIN VIAGEM"; + } else if(Constantes.TPV_BOLETO_ABIERTO.intValue() == tipoVentaId) { + return "BOLETO ABERTO"; + } + return ""; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoBoletoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoBoletoDAO.java new file mode 100644 index 000000000..65cc0d810 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoBoletoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface AbastoBoletoDAO extends GenericDAO { + + public List buscaAbastoBoletoPorPuntoVenta(PuntoVenta puntoVenta); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java new file mode 100644 index 000000000..d5d7905b5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface AbastoCentralDAO extends GenericDAO { + + + public List obtenerBilhetes(Aidf aidf, PuntoVenta origem); + public List obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem); + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes); + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem); + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes); + public List obtenerBilhetesPorPuntoVenta(String numSerie, String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem); + + public void actualizaBilhetes(List bilhetes, PuntoVenta destino); + public void actualizaBilhetes(List bilhetes, Estacion destino); + public void suscribirBilhetes(List bilhetes); + public List buscaBilhetesPorAidf(Aidf aidf); + + public void gravaControleEstoqueMigracao(PuntoVenta puntoVenta, Date fecmodif, Integer usuarioId); + + public List buscarSeriesBilhetesPorEstacion(Estacion estacion); + + public void borrarLosQueTienenAIDF(Aidf aidf); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java new file mode 100644 index 000000000..028d90a0a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface AbastoHistoDAO extends GenericDAO { + + public void grabaHistoricoBilhetes(List bilhetes, TipoMovimentacion tipoMovimentacion); + + public void borrarLosQueTienenAIDF(Aidf aidf); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java new file mode 100644 index 000000000..fb76f96fa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +public interface AidfDAO extends GenericDAO { + + public List buscaAidfsPorEmpresas(List empresas); + + public List obtenerAidfFromSerieDocfiscal(String serie,String docfiscal, Connection conn); + + public Boolean existeAidfComCodFiscalEEstado(Long idAidf, String docFiscal, Estado estado); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java new file mode 100644 index 000000000..7341d7e4c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; + +public interface AidfEspecieDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java new file mode 100644 index 000000000..2bfd527ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +public interface AidfTipoDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AjusteEventoExtraDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AjusteEventoExtraDAO.java new file mode 100644 index 000000000..94040913f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AjusteEventoExtraDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; + +public interface AjusteEventoExtraDAO extends GenericDAO{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AlertaCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AlertaCtrlDAO.java new file mode 100644 index 000000000..d82d6a5e7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AlertaCtrlDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AlertaCtrlDAO extends GenericDAO { + + public List buscar(Parada origem, Parada destino, Ruta ruta, ClaseServicio claseServicio, Integer tiempoAlta, Integer tiempoBaja, BigDecimal percAlta, BigDecimal percBaja); + + public List buscarCorrida(Corrida corrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java new file mode 100644 index 000000000..a52251b88 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.ArrayList; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public interface AliasServicoDAO extends GenericDAO{ + + /** + * Realiza a buscar com os filtros informados e restringindo o corridaId para is null + * + * @param origenId + * @param destinoId + * @param rutaId + * @return + */ + public List buscarAliasSemCorrida(Integer origenId,Integer destinoId,Integer rutaId); + + /** + * Realiza a busca com os filtro informados. + * @param origenId + * @param destinoId + * @param rutaId + * @param corridaId + * @return + */ + public List buscar(Integer origenId,Integer destinoId,Integer rutaId,Integer corridaId); + + + /** + * Realiza a busca com os filtro informados. + * @param linas + * @param empresas + * @param tiposClasses + * @param orgaos + * @param prefixo + * @return + */ + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo); + + + /** + * Realiza a busca com os filtro informados. + * @param origem + * @param destino + * @param linha + * @param idCorrida + * @return + */ + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ArticuloDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ArticuloDAO.java new file mode 100644 index 000000000..c087197db --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ArticuloDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Articulo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ArticuloDAO extends GenericDAO { + + public List buscar(String descarticulo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java new file mode 100644 index 000000000..062d691cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; + +/** + * + * @author rodrigo + */ +public interface AsientoExclusivoDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutobusDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutobusDAO.java new file mode 100644 index 000000000..40f48aeb4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutobusDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutobusDAO extends GenericDAO { + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java new file mode 100644 index 000000000..b3e8073c0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +public interface AutobusDocDAO extends GenericDAO { + public List obtenerPorAutobus(Autobus autobus); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutorizacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutorizacionDAO.java new file mode 100644 index 000000000..1ef21c4b4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutorizacionDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionDAO extends GenericDAO { + + public List buscar(String nombautorizacion, String descautorizacion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutorizacionPerfilDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutorizacionPerfilDAO.java new file mode 100644 index 000000000..c3c48e8d9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/AutorizacionPerfilDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionPerfilDAO extends GenericDAO { + + public List buscar(Autorizacion autorizacion, Perfil perfil); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/BancoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/BancoDAO.java new file mode 100644 index 000000000..9fae21447 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/BancoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Banco; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface BancoDAO extends GenericDAO { + + public List buscar(Banco nombbanco); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/BusquedaDatosTicketDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/BusquedaDatosTicketDAO.java new file mode 100644 index 000000000..066d347cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/BusquedaDatosTicketDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; + +public interface BusquedaDatosTicketDAO { + + public List buscaDatosTickets(Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CajaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CajaDAO.java new file mode 100644 index 000000000..f21033526 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CajaDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaFormapagoException; +import com.rjconsultores.ventaboletos.vo.caja.CajaVO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; + +public interface CajaDAO { + public List buscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta); + public List buscarCajaCerrado(Date fecha, String cveusuario, String turnoid); + List buscarUsuarioCerrado(Date fecha); + public void gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException, VendaEmbarcadaBoletoFormapagoException, VendaEmbarcadaCajaException, VendaEmbarcadaCajaFormapagoException; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java new file mode 100644 index 000000000..8b6fe9d63 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public interface CalcularPeajeDAO { + public List buscarCasetasPeajeWithinTramo(Ruta ruta); + + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao); + + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CancelacionCargoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CancelacionCargoDAO.java new file mode 100644 index 000000000..8a25a04f7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CancelacionCargoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; + +/** + * + * @author Rafius + */ +public interface CancelacionCargoDAO extends GenericDAO{ +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CancelacionCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CancelacionCtrlDAO.java new file mode 100644 index 000000000..e2804acde --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CancelacionCtrlDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CancelacionCtrlDAO extends GenericDAO { + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, Parada paradaDestino, Marca marca); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeDAO.java new file mode 100644 index 000000000..ab4a4946a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; + +public interface CasetaPeajeDAO extends GenericDAO { + + List buscar(String casetaPeajeDesc); + List buscarTodosOrdenadoPorDescricao(); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaClaseDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaClaseDAO.java new file mode 100644 index 000000000..27378f2cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaClaseDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaClaseDAO extends GenericDAO { + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaCorridaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaCorridaDAO.java new file mode 100644 index 000000000..7bdac568f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaCorridaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCorridaDAO extends GenericDAO { + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java new file mode 100644 index 000000000..8f6a6ef8b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCtrlDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaDAO.java new file mode 100644 index 000000000..e641e515a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface CategoriaDAO extends GenericDAO { + + public List buscar(String desccategoria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaDescuentoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaDescuentoDAO.java new file mode 100644 index 000000000..af055e7b0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaDescuentoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; + +/** + * + * @author Administrador + */ +public interface CategoriaDescuentoDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaMarcaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaMarcaDAO.java new file mode 100644 index 000000000..c91e9f833 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaMarcaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; + +/** + * + * @author Administrador + */ +public interface CategoriaMarcaDAO extends GenericDAO { + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaMercadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaMercadoDAO.java new file mode 100644 index 000000000..984c55ea4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaMercadoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; + +/** + * + * @author Administrador + */ +public interface CategoriaMercadoDAO extends GenericDAO { + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaOrgaoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaOrgaoDAO.java new file mode 100644 index 000000000..0e93cf8fe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaOrgaoDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; + +public interface CategoriaOrgaoDAO extends GenericDAO { + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaPeriodoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaPeriodoDAO.java new file mode 100644 index 000000000..f0d04d6b8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaPeriodoDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface CategoriaPeriodoDAO extends GenericDAO { + + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo); + + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaTipoPtoVtaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaTipoPtoVtaDAO.java new file mode 100644 index 000000000..ab1ec784b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CategoriaTipoPtoVtaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface CategoriaTipoPtoVtaDAO extends GenericDAO { + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta); + + public void borrarFisico(CategoriaTipoPtoVta cd); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CiudadDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CiudadDAO.java new file mode 100644 index 000000000..5a430ce60 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CiudadDAO.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; + +/** + * + * @author MCosso + */ +public interface CiudadDAO extends GenericDAO { + + public List buscar(String nombciudad, Estado estado, Plaza plaza); + + public List buscaLike(String strCiudad); + + public List buscaCodMun(Integer codMun, Estado estado); + + public List buscarPorEstado(Estado estado); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClaseservicioEquivalenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClaseservicioEquivalenciaDAO.java new file mode 100644 index 000000000..7b981f37e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClaseservicioEquivalenciaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClaseservicioEquivalenciaDAO + extends GenericDAO { + + public List buscar(ClaseServicio ClaseServicio, ComisionistaExterno comisionistaExterno); + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClasseServicoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClasseServicoDAO.java new file mode 100644 index 000000000..11d6da15d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClasseServicoDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClasseServicoDAO extends GenericDAO { + + public List buscarPorNome(String nomeClaseServicio); + + public List buscarTodosExceto(Integer ... idClase); + + public List buscarPorEmpresasDoUsuario (String idEmpresasUsuario); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteCursoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteCursoDAO.java new file mode 100644 index 000000000..4dd3c2f45 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteCursoDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; + +public interface ClienteCursoDAO extends GenericDAO { + + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDAO.java new file mode 100644 index 000000000..015e3da5f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ClienteDAO extends GenericDAO { + + public List buscar(String nombCliente); + + public Cliente buscarPorNumeroFidelidade(Integer numeroFidelidade, Empresa empresa); + + public List buscarPorDocumento(String documento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDescuentoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDescuentoDAO.java new file mode 100644 index 000000000..220e4faff --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDescuentoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; + +public interface ClienteDescuentoDAO extends GenericDAO{ + + public List buscar(Cliente cliente); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDireccionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDireccionDAO.java new file mode 100644 index 000000000..28895dd98 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClienteDireccionDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; + + + + + +public interface ClienteDireccionDAO extends GenericDAO { + + public List buscar(Integer clienteId); + + public List buscar(Cliente cliente); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClientePacoteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClientePacoteDAO.java new file mode 100644 index 000000000..d479d039f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ClientePacoteDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClientePacote; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; + +public interface ClientePacoteDAO extends GenericDAO { + + public List busquedaDatosClientePacote(String cpfCnpj); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CoeficienteTarifaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CoeficienteTarifaDAO.java new file mode 100644 index 000000000..941c43316 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CoeficienteTarifaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; + +public interface CoeficienteTarifaDAO extends GenericDAO { + + public List buscar(String nomb); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java new file mode 100644 index 000000000..b6d858a1f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; + +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ColoniaDAO extends GenericDAO { + + public List buscar(String desccolonia); + public List buscarPorCiudad(Ciudad ciudad); + public List buscaLike(String desccolonia); + public List buscarPorCodMun(Ciudad ciudad, String desccolonia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ComisionistaExternoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ComisionistaExternoDAO.java new file mode 100644 index 000000000..481d7f0fc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ComisionistaExternoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ComisionistaExternoDAO extends GenericDAO { + + public List buscar(String desccomisionista); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ComissaoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ComissaoDAO.java new file mode 100644 index 000000000..7932dd6f9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ComissaoDAO.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +public interface ComissaoDAO extends GenericDAO { + + public List buscarReceitasComissoes(Integer puntoVentaId, Integer empresaId, Date periodo); + + public Comissao buscaComissaoVigencia(Integer puntoVentaId, Integer empresaId, String competencia); + + public List buscaHistoricoComissao(Integer puntoVentaId, Integer empresaId, Date periodoInicio, Date periodoFim); + + public List buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CompaniaBancariaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CompaniaBancariaDAO.java new file mode 100644 index 000000000..45f77be0d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CompaniaBancariaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CompaniaBancariaDAO extends GenericDAO { + + public List buscar(CompaniaBancaria companiaBancaria); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConductorDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConductorDAO.java new file mode 100644 index 000000000..356c29f7d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConductorDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Conductor; + +/** + * + * @author Administrador + */ +public interface ConductorDAO extends GenericDAO { + + public Conductor buscar(String claveConductor, String contraSenha); + public Conductor buscarPorEmpleado(int empleadoId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionConfDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionConfDAO.java new file mode 100644 index 000000000..0fe4fb799 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionConfDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionConfDAO extends GenericDAO { + + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo); + + public List buscarPorConexionCtrl(ConexionCtrl conexionCtrl); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java new file mode 100644 index 000000000..237cff54c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionCtrlDAO extends GenericDAO { + + public List buscarConexionesCtrl(Integer origenId, Integer destinoId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java new file mode 100644 index 000000000..16f97e36c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +public interface ConexionDAO extends GenericDAO { + + /** + * Apaga os dados temporários das tabelas de conexion_temp e conexion_ctrl_temp + * + * @param usuarioId + */ + public void generarConexiones(Integer usuarioId); + + public List buscarConexiones(Integer origenId, Integer destinoId); + + public List buscarPorConexionCtrl(Long conexcionCtrlId); + + public List buscarConexionesValidas(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionDAO.java new file mode 100644 index 000000000..5dfbfb4e3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; + +public interface ConexionExcepcionDAO extends GenericDAO { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionRutaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionRutaDAO.java new file mode 100644 index 000000000..be061a024 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionRutaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; + +public interface ConexionExcepcionRutaDAO extends GenericDAO { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java new file mode 100644 index 000000000..1d3e427a5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; + +public interface ConfRestricaoCanalVentaDAO{ + + public ConfRestricaoCanalVenta obtenerID(Integer id); + + public ConfRestricaoCanalVenta suscribir(ConfRestricaoCanalVenta entidad); + + public ConfRestricaoCanalVenta actualizacion(ConfRestricaoCanalVenta entidad); + + public void borrar(ConfRestricaoCanalVenta entidad); + + public Long count(String campo, Object o); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoExcecaoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoExcecaoDAO.java new file mode 100644 index 000000000..6311b242d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoExcecaoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; + +public interface ConfRestricaoExcecaoDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoPtovtaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoPtovtaDAO.java new file mode 100644 index 000000000..6c339b579 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoPtovtaDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; + +public interface ConfRestricaoPtovtaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java new file mode 100644 index 000000000..17c7f1d7a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; + +public interface ConferenciaComissaoDAO extends GenericDAO { + + public Conferencia suscribirOrActualizacion(Conferencia entidad); + + public List carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException; + + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public List carregarEventosFinanceiros(Conferencia conferencia) throws BusinessException; + + public List carregarLogConferencia(Conferencia conferencia) throws BusinessException; + + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId); + + public List carregarBilhetesComissao(Conferencia conferencia) throws BusinessException; + + public List carregarOcds(Conferencia conferencia) throws BusinessException; + + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException; + + public List carregarLogConferencia(Long conferenciaId) throws BusinessException; + + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + + public BigDecimal carregarValorDepositoContaCorrente(Integer empresaId, Integer puntoventaId, Date datamovimento); + + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfigRestriccionPagoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfigRestriccionPagoDAO.java new file mode 100644 index 000000000..4fcf2d176 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConfigRestriccionPagoDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import java.util.List; +import java.util.Map; + +/** + * + * @author Administrador + */ +public interface ConfigRestriccionPagoDAO extends GenericDAO { + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago); + + public Map buscar(FormaPago formaPago); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConstanteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConstanteDAO.java new file mode 100644 index 000000000..c1dfa1b5e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConstanteDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Constante; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConstanteDAO extends GenericDAO { + + public Constante buscarPorNomeConstante(String nomeConstante); + + public List buscar(String nombconstante); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ContaCorrenteAgenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ContaCorrenteAgenciaDAO.java new file mode 100644 index 000000000..05c274a4d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ContaCorrenteAgenciaDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface ContaCorrenteAgenciaDAO extends GenericDAO { + + public ContaCorrentePtoVta gravarContaCorrente(Integer itemPuntoVentaId, String descOperacion, Date fecCorte, Integer usuarioId, Integer tipoOperacionCCId, + Integer empresaId, short turnoId, BigDecimal importeTotalTarifa, BigDecimal importeTotalPedagio, BigDecimal importeTotalTasaAbordaje, + BigDecimal importeTotalSeguro, BigDecimal importeTotalIngreso, BigDecimal importeTotalEgreso, BigDecimal importeTotalDevolucion, + BigDecimal importeTotalTransferencia, BigDecimal importeFinal, boolean corteAutomatico, + BigDecimal totalVentaSegOpcional, BigDecimal totalCancSegOpcional, BigDecimal importeTotalEfectivo ) throws BusinessException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConvenioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConvenioDAO.java new file mode 100644 index 000000000..8558b37ed --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConvenioDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Convenio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConvenioDAO extends GenericDAO { + + public List buscar(String descconvenio, String cveconvenio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConvenioDetDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConvenioDetDAO.java new file mode 100644 index 000000000..d95a1649b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ConvenioDetDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; + +/** + * + * @author Administrador + */ +public interface ConvenioDetDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaCtrlDAO.java new file mode 100644 index 000000000..00236d4d2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaCtrlDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.util.Date; + +/** + * + * @author Administrador + */ +public interface CorridaCtrlDAO extends GenericDAO { + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, Date horario, boolean pisoExtra); + + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaDAO.java new file mode 100644 index 000000000..38752ad79 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaDAO.java @@ -0,0 +1,90 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Corrida.Id; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +/** + * + * @author rodrigo + */ +public interface CorridaDAO extends GenericDAO { + + /** + * Indica si existe una corrida de acuerdo el id + * + * No lleva en consideración el campo activo + * + * @param id + * @param dataGeracao + * @return + */ + public Boolean existe(Id id); + + public List buscarPorAutobusCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorRolOperativoCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorFecCorrida(Date value); + + public Long count(Ruta ruta); + + public List verificarCorridaId(Integer corridaId); + + public List buscarPorId(Integer idCorrida); + + public List buscarFiltro(Parada ori, Parada des, Date hora, ClaseServicio cs); + + /** + * Hace la b�squeda de corridas con distinct para: origen, destino, claseServicio,hora + * + * @param ori + * @param des + * @param horaSalidaInicio + * @param horaSalidaFin + * @param cs + * @param corridaId + * @return + */ + public List buscarDistinct(Parada ori, Parada des, Date horaSalidaInicio, + Date horaSalidaFin, ClaseServicio cs, Integer corridaId); + + public boolean existe(Ruta ruta, Date dataGeracao, Date horario, ClaseServicio claseServicio, + Marca marca, boolean pisoExtra); + + public boolean count(Parada origem, Parada destino, Date feccorrida, ClaseServicio claseServicio, + boolean pisoExtra); + + /** + * Regresa la cantidad de corridas que fue generada hoy. + * + * @return + */ + public Long cantCorridaGeneradasHoy(); + + public List buscarGroupCorrridaId(Integer corridaId, Date dateInicio, Date dateFin); + + public List buscarGroupCorrridaId(Integer corridaId, Integer origem, Integer destino, + Integer ruta, Integer numRuta, Date dateInicio, Date dateFin); + + public void actualizaFecHusoFecVerano(Corrida corrida); + + public void actualizaFecHusoFecVerano(List corridas); + + public List buscarPorEstado(Estado estado, Date dataInicial); + + List buscarPorEstado(Estado estado, Date dataInicial, Integer corridaId); + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaTramoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaTramoDAO.java new file mode 100644 index 000000000..6af40d53a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CorridaTramoDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; + +public interface CorridaTramoDAO extends GenericDAO { + + public List obtenerTramoTarjetaEmitida(); + + public List buscarTarjetaMesmaCorrida(CorridaTramo ct); + + public BigDecimal buscarSumTarjetaMesmaCorrida(CorridaTramo ct); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaBeneficiarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaBeneficiarioDAO.java new file mode 100644 index 000000000..70c9f6a23 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaBeneficiarioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; + +/** + * + * @author Shiro + */ +public interface CortesiaBeneficiarioDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaDAO.java new file mode 100644 index 000000000..05a2492da --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaDAO extends GenericDAO { + + public List pesquisar(Empleado empleado); + + + public Cortesia buscar(Cortesia cortesia); + + public List buscarDplicidad(Cortesia cortesia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaDireccionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaDireccionDAO.java new file mode 100644 index 000000000..45ceca2c3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CortesiaDireccionDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.util.Date; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaDireccionDAO extends GenericDAO { + + public List pesquisar(Marca marca, ClaseServicio claseServicio, Date fecInicio, Date fecFinal); + + public List buscar(CortesiaDireccion cortesiaDireccion); + + public List buscarFolio(CortesiaDireccion cortesiaDireccion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CuponConvenioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CuponConvenioDAO.java new file mode 100644 index 000000000..3dacfcb51 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CuponConvenioDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CuponConvenioDAO extends GenericDAO{ + + public List pesquisar(TipoConvenio tipoConvenio); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CuponSecretariaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CuponSecretariaDAO.java new file mode 100644 index 000000000..f6ab3ca39 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CuponSecretariaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; + +/** + * + * @author Administrador + */ +public interface CuponSecretariaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/CursoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CursoDAO.java new file mode 100644 index 000000000..f88563684 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/CursoDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Curso; + +public interface CursoDAO extends GenericDAO { + public List buscar(String nomcurso); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/DepositoBancarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DepositoBancarioDAO.java new file mode 100644 index 000000000..0edafef1b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DepositoBancarioDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; + +/** + * + * @author Rafius + */ +public interface DepositoBancarioDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/DescontoComissaoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DescontoComissaoDAO.java new file mode 100644 index 000000000..d805236d1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DescontoComissaoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; + +public interface DescontoComissaoDAO extends GenericDAO { + + public List buscaDescontoComissao(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/DetAbastoBoletoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DetAbastoBoletoDAO.java new file mode 100644 index 000000000..a0800b6d0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DetAbastoBoletoDAO.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; + +public interface DetAbastoBoletoDAO extends GenericDAO { + + public Long getSecuencia(); + + public List buscaDetAbastoBoletos(AbastoBoleto abastoBoleto); + + public List buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa); + + public void desativaDetAbastos(List detAbastoBoletos); + + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa); + + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(com.rjconsultores.ventaboletos.entidad.Aidf aidf); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/DetDiagramaAutobusDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DetDiagramaAutobusDAO.java new file mode 100644 index 000000000..e2a792690 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DetDiagramaAutobusDAO.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; + +/** + * + * @author Administrador + */ +public interface DetDiagramaAutobusDAO { + + public List obtenerTodos(); + + public DetDiagramaAutobus obtenerID(Short id); + + public DetDiagramaAutobus suscribir(DetDiagramaAutobus entidad); + + public DetDiagramaAutobus actualizacion(DetDiagramaAutobus entidad); + + public void borrar(DetDiagramaAutobus entidad); + + public Long count(String campo, Object o); + + public DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/DiagramaAutobusDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DiagramaAutobusDAO.java new file mode 100644 index 000000000..798a3e622 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DiagramaAutobusDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface DiagramaAutobusDAO extends GenericDAO { + + public List buscar(String descDiagrama, Short maxparados, + Short cantasientos); + + public List buscar(String descDiagrama); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/DivisionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DivisionDAO.java new file mode 100644 index 000000000..a97ac77be --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/DivisionDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Division; + +public interface DivisionDAO extends GenericDAO { + + public List obtenerTodos(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpleadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpleadoDAO.java new file mode 100644 index 000000000..53c8e9f05 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpleadoDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface EmpleadoDAO extends GenericDAO{ + + public List pesquisaClave(String empleadoClave); + + public List pesquisaEmpresa(Integer empresaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaContaBancariaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaContaBancariaDAO.java new file mode 100644 index 000000000..e1171a908 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaContaBancariaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; + +public interface EmpresaContaBancariaDAO { + + public EmpresaContaBancaria suscribir(EmpresaContaBancaria entidad); + + public EmpresaContaBancaria actualizacion(EmpresaContaBancaria entidad); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaDAO.java new file mode 100644 index 000000000..a65fb083f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaDAO.java @@ -0,0 +1,67 @@ +/* +// * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Administrador + */ +public interface EmpresaDAO { + + public List obtenerTodos(); + + public Empresa obtenerID(Integer id); + + public Empresa suscribir(Empresa entidad); + + public Empresa actualizacion(Empresa entidad); + + public Long count(String campo,Object o); + + public List buscarTodosExceto(List empresa,Integer... idEmpresa); + + public List obtenerIndExternoFalse(); + + public List buscar(String nombempresa, Boolean indExterna, Short indTipo); + + public List obtenerIndTipo2(); + + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta); + + public List buscaInscricoesEstaduais(Empresa empresa); + + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual); + + public List buscaLike(String nombempresa); + + public List obtenerTodosIncluindoEmpresaTodas(); + + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public ComEmpConferencia suscribir(ComEmpConferencia comEmpConferencia); + + public ComEmpConferencia actualizacion(ComEmpConferencia comEmpConferencia); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaEquivalenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaEquivalenciaDAO.java new file mode 100644 index 000000000..9723bbc93 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaEquivalenciaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface EmpresaEquivalenciaDAO extends GenericDAO { + + public List buscar(Empresa empresa, ComisionistaExterno comisionistaExterno); + + public List buscar(EmpresaEquivalencia empresaEquivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java new file mode 100644 index 000000000..075617ee9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java @@ -0,0 +1,22 @@ +/* +// * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +public interface EmpresaImpostoDAO extends GenericDAO { + + public List buscarByEmpresa(Empresa empresa); + + public List buscarEmpresaImposto(Integer empresaId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EnderecoApanheDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EnderecoApanheDAO.java new file mode 100644 index 000000000..91a9aea97 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EnderecoApanheDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; + +public interface EnderecoApanheDAO extends GenericDAO{ + + public List buscar(Date datapacote, String numoperacion); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EscolaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EscolaDAO.java new file mode 100644 index 000000000..329c7e528 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EscolaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; + +public interface EscolaDAO extends GenericDAO { + public List buscar(String nombescola, Ciudad ciudad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaAgrupacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaAgrupacionDAO.java new file mode 100644 index 000000000..bb06b2b1c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaAgrupacionDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; + +/** + * + * @author RJ Consultores + */ +public interface EsquemaAgrupacionDAO extends GenericDAO { + + public List buscar(EsquemaAgrupacion esquemaAgrupacion); + + public EsquemaAgrupacion obtenerByEsquemaAgrupacion(Integer numAgrupacion); + + public boolean buscarNumAgrupacion(Integer numAgrupacion); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaAsientoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaAsientoDAO.java new file mode 100644 index 000000000..a33bce20d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaAsientoDAO.java @@ -0,0 +1,21 @@ + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaAsientoDAO extends GenericDAO { + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida); + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaDAO.java new file mode 100644 index 000000000..fcbad22b7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaDAO.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; + +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaCorridaDAO extends GenericDAO { + + public List buscarPorEsquemaOperacional(EsquemaOperacional eo); + + public List buscarPorEmpresaCorrida(Empresa empresa); + + public List buscar(Marca marca, RolOperativo rolOperativo, Ruta ruta, ClaseServicio claseServicio); + + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra); + + /** + * Indica se el esquema corrida es hijo de un esquemCorrida. + * + * @param esquemaCorrida + * @return + */ + public boolean esHijoRebote(EsquemaCorrida esquemaCorrida); + + /** + * Busca los esquema corrida que tiene esquema operacional en la fecha indicada + * + * @param dataGeracao + * @return + */ + public List buscaDentroVigencia(Date dataGeracao); + + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo); + + /** + * Indica cuál son los Id's de EsquemaCorrida que tienen la paradaId en su secuencia + * + * @param ruta + * @param paradaId + * @return - El Id de EsquemaCorrida + */ + public List existe(Ruta ruta, Integer paradaId); + + public EsquemaCorrida obtenerByEsquemaCorrida(Integer numCorrida); + + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao); + + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataDe); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaOperacionalDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaOperacionalDAO.java new file mode 100644 index 000000000..5adb543a7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaOperacionalDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaOperacionalDAO extends GenericDAO { + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao); + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaTramoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaTramoDAO.java new file mode 100644 index 000000000..6919a955a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EsquemaTramoDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaTramoDAO extends GenericDAO { + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec); + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec); + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java new file mode 100644 index 000000000..0108ca7ba --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +public interface EstacionDAO extends GenericDAO { + + public List buscar(String descEstacion, String descMac, + Long nunCaja, PuntoVenta pv); + + public List buscar(String descMac); + + /** + * Hace la búsqueda de las estciones ativas por el numCaja y puntoVenta + * + * @param numCaja + * @param puntoVenta + * @return + */ + public List buscar(Long numCaja, PuntoVenta puntoVenta); + + public List buscarEstaciones(PuntoVenta puntoVenta); + + public List buscarPuntosVentaEstacionPorUsuario(Usuario usuario); + + public Boolean temEstoque(PuntoVenta puntoVenta, Estacion estacion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java new file mode 100644 index 000000000..ff4a6017e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; +import java.util.List; + +/** + * + * @author MCosso + */ +public interface EstadoDAO extends GenericDAO { + + public List buscar(String nombestado, Pais pais); + + public List buscarNotInEmpresaImposto(Empresa empresa); + + public List buscarCveEstado(String cveEstado); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/EventoExtraDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EventoExtraDAO.java new file mode 100644 index 000000000..103b44320 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/EventoExtraDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +public interface EventoExtraDAO extends GenericDAO{ + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java new file mode 100644 index 000000000..b03b97ed5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; + +public interface ExcepcionPeajeDAO extends GenericDAO { + public List buscar(String descconvenio, String cveconvenio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ExcepcionRedondoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ExcepcionRedondoDAO.java new file mode 100644 index 000000000..77826835c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ExcepcionRedondoDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ExcepcionRedondoDAO extends GenericDAO { + + public List buscar(String indTipo, Parada origem, Parada destino); + + /** + * Hace la búsqueda de las excepcion activas por origen y destino. + * @param origem + * @param destino + * @return + */ + public List buscar(Parada origem, Parada destino); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FechamentoParamgeralDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FechamentoParamgeralDAO.java new file mode 100644 index 000000000..e4fa0e2cc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FechamentoParamgeralDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; + +public interface FechamentoParamgeralDAO extends GenericDAO { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FechamentoParamptovtaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FechamentoParamptovtaDAO.java new file mode 100644 index 000000000..56de43823 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FechamentoParamptovtaDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface FechamentoParamptovtaDAO extends GenericDAO { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FeriadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FeriadoDAO.java new file mode 100644 index 000000000..2af35c7c8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FeriadoDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; + + +public interface FeriadoDAO extends GenericDAO { + + public List buscar(Date fecferiado); + + public boolean ehFeriado(Date fecFeriado, Empresa empresa, Estado estadoOrigem); + + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado); +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalAliquotaEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalAliquotaEmpresaDAO.java new file mode 100644 index 000000000..4b75189c1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalAliquotaEmpresaDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; + +public interface FiscalAliquotaEmpresaDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java new file mode 100644 index 000000000..ec1730cc6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; + +public interface FiscalDAO { + + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte); + + public List buscaDatosFiscaisECF(Date inicio, Date fim, Integer empresaId, boolean isNormal, boolean isCancelados, boolean isPendencias, Connection connection) throws SQLException; + + public List buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, boolean isPendencias, Connection connection) throws SQLException; + + public List buscaDatosFiscaisECFManual(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException; + + public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalFormapagoEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalFormapagoEmpresa.java new file mode 100644 index 000000000..434128351 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalFormapagoEmpresa.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.dao; + +public interface FiscalFormapagoEmpresa extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraDAO.java new file mode 100644 index 000000000..7570b0702 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraDAO.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; + +public interface FiscalImpressoraDAO { + + public List obtenerTodos(); + public FiscalImpressora obtenerID(Integer id); + public FiscalImpressora suscribir(FiscalImpressora entidad); + public FiscalImpressora actualizacion(FiscalImpressora entidad); + public void borrar(FiscalImpressora entidad); + public Long count(String campo,Object o); + + + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId); + public List obtenerTodosTotnaofiscalEmpresa(); + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id); + public FiscalTotnaofiscalEmpresa suscribirTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + public FiscalTotnaofiscalEmpresa actualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + + public List buscarFormaPagoEmpresa(Integer empresaEcfId); + public List obtenerTodosFormapagoEmpresa(); + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id); + public FiscalFormapagoEmpresa suscribirFormapagoEmpresa(FiscalFormapagoEmpresa entidad); + public FiscalFormapagoEmpresa actualizacionFormapagoEmpresa(FiscalFormapagoEmpresa entidad); + + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId); + public List obtenerTodosRelgerencialEmpresa(); + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id); + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa, String tipoTotalizador); + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa, String tipoTotalizador,String descEcf); + public FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa, String tipoformapago); + FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa, String tipoformapago, String descEcf); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalRelgerencialEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalRelgerencialEmpresa.java new file mode 100644 index 000000000..ef5578804 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalRelgerencialEmpresa.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.dao; + +public interface FiscalRelgerencialEmpresa extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalTotnaofiscalEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalTotnaofiscalEmpresaDAO.java new file mode 100644 index 000000000..c797895d4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FiscalTotnaofiscalEmpresaDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; + +public interface FiscalTotnaofiscalEmpresaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FolioPreimpresoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FolioPreimpresoDAO.java new file mode 100644 index 000000000..737aa4013 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FolioPreimpresoDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; + +public interface FolioPreimpresoDAO extends GenericDAO { + + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FormaPagoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FormaPagoDAO.java new file mode 100644 index 000000000..5958f90c0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FormaPagoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface FormaPagoDAO extends GenericDAO { + + public List buscarPorDescricao(String descpago); + + public List buscarTodosExceto(Integer... idFormaPago); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FormaPagoDetDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FormaPagoDetDAO.java new file mode 100644 index 000000000..4c10fbf5b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FormaPagoDetDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; + +/** + * + * @author Administrador + */ +public interface FormaPagoDetDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/FuncionSistemaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FuncionSistemaDAO.java new file mode 100644 index 000000000..5583a0b74 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/FuncionSistemaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; + +/** + * + * @author rodrigo + */ +public interface FuncionSistemaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/GenericDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GenericDAO.java new file mode 100644 index 000000000..5058938dc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GenericDAO.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface GenericDAO { + + public List obtenerTodos(); + + public T obtenerID(ID id); + + public T suscribir(T entidad); + + public T actualizacion(T entidad); + + public void borrar(T entidad); + + public Long count(String campo,Object o); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/GenericDAOInforme.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GenericDAOInforme.java new file mode 100644 index 000000000..a62c51b95 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GenericDAOInforme.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.util.Map; + +/** + * + * @author Administrador + */ +public interface GenericDAOInforme { + + @SuppressWarnings("rawtypes") + public ResultSet executarSQL(Connection conn, Map parameters); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoCategoriaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoCategoriaDAO.java new file mode 100644 index 000000000..85849ab01 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoCategoriaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; + +public interface GrupoCategoriaDAO extends GenericDAO { + + public List buscar(String descricao); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoCortesiasDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoCortesiasDAO.java new file mode 100644 index 000000000..68ce34a84 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoCortesiasDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import java.util.List; + + +/** + * + * @author Shiro + */ +public interface GrupoCortesiasDAO extends GenericDAO{ + + public List buscar(String descgrupo); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoRutaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoRutaDAO.java new file mode 100644 index 000000000..6449cc76e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/GrupoRutaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +public interface GrupoRutaDAO extends GenericDAO { + + public List buscarPorNome(String descgrupo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java new file mode 100644 index 000000000..749daeb3d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Hotel; + +public interface HotelDAO extends GenericDAO { + + public List buscar(String deschotel); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeCategoriaVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeCategoriaVentaDAO.java new file mode 100644 index 000000000..75d15cf53 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeCategoriaVentaDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformeCategoriaVentaDAO extends GenericDAOInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformePasajeroServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformePasajeroServicioDAO.java new file mode 100644 index 000000000..ae412d27e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformePasajeroServicioDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformePasajeroServicioDAO extends GenericDAOInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeServicioDiarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeServicioDiarioDAO.java new file mode 100644 index 000000000..a8f1e6812 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeServicioDiarioDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformeServicioDiarioDAO extends GenericDAOInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeVentasPuntoVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeVentasPuntoVentaDAO.java new file mode 100644 index 000000000..65c3365ed --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InformeVentasPuntoVentaDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformeVentasPuntoVentaDAO extends GenericDAOInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/InstiFinanceiraDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InstiFinanceiraDAO.java new file mode 100644 index 000000000..fcbaae3c2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/InstiFinanceiraDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + + + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +public interface InstiFinanceiraDAO extends GenericDAO { + + public List buscar(String nome); + public List buscarContasBancariasPorIdEmpresa(Integer empresaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ItemAdicionalDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ItemAdicionalDAO.java new file mode 100644 index 000000000..4c207290f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ItemAdicionalDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +public interface ItemAdicionalDAO extends GenericDAO { + + public List buscaItemAdicionalPacote(Pacote pacote); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ItemDescontoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ItemDescontoDAO.java new file mode 100644 index 000000000..cfcd30721 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ItemDescontoDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; + +public interface ItemDescontoDAO extends GenericDAO { + + public List buscarPorNome(String nomitemdesconto); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java new file mode 100644 index 000000000..f1dff5dba --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + + +public interface MarcaAutobusDAO extends GenericDAO { + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaClaseServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaClaseServicioDAO.java new file mode 100644 index 000000000..efb45eb0c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaClaseServicioDAO.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MarcaClaseServicioDAO + extends GenericDAO { + + /** + * Regresa las Marcas activas vinculadas a la clase de servicio informada + * @param clase + * @return + */ + public List buscar(ClaseServicio clase); + + public List buscarPorEmpresasPermitidas(ClaseServicio clase, List idsEmpresa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaDAO.java new file mode 100644 index 000000000..1a1cfe2b4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MarcaDAO.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +public interface MarcaDAO extends GenericDAO { + + public List buscarPorNome(String nomeMarca); + + public List buscarTodosExceto(Usuario usuario,Integer... idMarca); + + public List buscarDescricaoIdMarca(); + + public List buscarMarcaPorEmpresa(List empresa); + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MercadoCompetidoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MercadoCompetidoDAO.java new file mode 100644 index 000000000..6a1f58af4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MercadoCompetidoDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface MercadoCompetidoDAO extends GenericDAO { + + public boolean existe(ClaseServicio claseServicio, Parada origem, + Parada destino); + + public List buscar(Parada origem, Parada destino); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MerchantBancarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MerchantBancarioDAO.java new file mode 100644 index 000000000..06e212c56 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MerchantBancarioDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; + +/** + * + * @author Rafius + */ +public interface MerchantBancarioDAO extends GenericDAO { + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MonedaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MonedaDAO.java new file mode 100644 index 000000000..c6215e10f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MonedaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MonedaDAO extends GenericDAO { + + public List buscar(String descmoneda); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoCancelacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoCancelacionDAO.java new file mode 100644 index 000000000..ffa4b81f5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoCancelacionDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoCancelacionDAO extends GenericDAO { + + public List buscar(String descmotivo, String tipomotivo); + + public List obtenerTodosTipoMotivoB(); + + public List obtenerTodosEspecificos(Integer[] motivos); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoReimpresionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoReimpresionDAO.java new file mode 100644 index 000000000..3d1fb3302 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoReimpresionDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoReimpresionDAO extends GenericDAO { + + public List buscar(String descmotivo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoViajeDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoViajeDAO.java new file mode 100644 index 000000000..6fd76ba4e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivoViajeDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; + +/** + * + * @author Shiro + */ +public interface MotivoViajeDAO extends GenericDAO{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivocancelacionEquivalenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivocancelacionEquivalenciaDAO.java new file mode 100644 index 000000000..1ccee5ea0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/MotivocancelacionEquivalenciaDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MotivocancelacionEquivalenciaDAO + extends GenericDAO { + + public List buscar(ComisionistaExterno comisionistaExterno, + MotivoCancelacion motivoCancelacion); + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/NodoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/NodoDAO.java new file mode 100644 index 000000000..129d7f3f8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/NodoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Nodo; + +/** + * + * @author Administrador + */ +public interface NodoDAO extends GenericDAO { + + public List obtenerTodos(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/OCDParamDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OCDParamDAO.java new file mode 100644 index 000000000..207f272c9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OCDParamDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; + +public interface OCDParamDAO extends GenericDAO { + + public OCDParam suscribirActualizar(OCDParam entidad); + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa); + public List buscaOCDParams(Empresa empresa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoCancelacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoCancelacionDAO.java new file mode 100644 index 000000000..ed5d98f6a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoCancelacionDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoCancelacionDAO extends GenericDAO { + + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente); + + public List obtenerTodos(); + + public List obtenerTodosIds() ; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoConcedenteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoConcedenteDAO.java new file mode 100644 index 000000000..87afa7532 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoConcedenteDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoConcedenteDAO extends GenericDAO { + + public List buscar(String desc); + + public List obtenerTodos(); + + public List obtenerTodosIds() ; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoTramoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoTramoDAO.java new file mode 100644 index 000000000..a50b72b68 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/OrgaoTramoDAO.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; + +public interface OrgaoTramoDAO { + + /** + * Hace la busqueda de la configuracion del coeficiente por tramo
+ * + * @param origenId + * @param destinoId + * @param viaId + * @param orgaoConcedenteId + * @param claseServicioId + * @return + */ + public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Integer claseServicioId); + + /** + * Graba el registro en la base de datos + * @param orgaoTramo + * @return + */ + public OrgaoTramo suscribir(OrgaoTramo orgaoTramo); + + public Long count(String campo, Object o); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteConvenioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteConvenioDAO.java new file mode 100644 index 000000000..746702cb1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteConvenioDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; + +public interface PacoteConvenioDAO extends GenericDAO { + + public List buscar(String nomconvenio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteDAO.java new file mode 100644 index 000000000..d4f93d07f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pacote; + +public interface PacoteDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteDescontoBilheteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteDescontoBilheteDAO.java new file mode 100644 index 000000000..4e5975427 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteDescontoBilheteDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; + +public interface PacoteDescontoBilheteDAO extends GenericDAO { + + public List obtenerTodos(Integer pacoteId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteItemDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteItemDAO.java new file mode 100644 index 000000000..935581093 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteItemDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; + +public interface PacoteItemDAO extends GenericDAO { + + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item); + + public List buscaItensPacote(Pacote pacote); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteTarifaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteTarifaDAO.java new file mode 100644 index 000000000..dc571f460 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PacoteTarifaDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface PacoteTarifaDAO extends GenericDAO { + + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote); + + public List buscaTarifasPacote(Pacote pacote); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PaisDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PaisDAO.java new file mode 100644 index 000000000..a058a920c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PaisDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pais; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PaisDAO extends GenericDAO { + + public List buscar(String nombpais); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java new file mode 100644 index 000000000..1221b5676 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ParadaDAO { + + public Parada obtenerID(Integer id); + + public Parada suscribir(Parada entidad); + + public Parada actualizacion(Parada entidad); + + public Long count(String campo, Object o); + + public List buscar(String descparada, String cveparada, Ciudad ciudad,TipoParada tipoParada, Nodo nodo); + + /** + * Busca as paradas que tenham o codAntt informado + * + * @param codAntt + * @return + */ + public List buscar(Integer codAntt); + + public List buscar(String descparada); + + public List buscarCVE(String cveparada); + + public List buscaLike(String descparada); + + public Long count(TipoParada tipoParada); + + public List obtenerOrigenPorRuta(Ruta ruta); + + public List obtenerTodos(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParadaEquivalenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParadaEquivalenciaDAO.java new file mode 100644 index 000000000..c8c680d8a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParadaEquivalenciaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ParadaEquivalenciaDAO extends GenericDAO { + + public List buscar(Parada parada, ComisionistaExterno comisionistaExterno, String equivalencia); + + public List buscarEquivalencia(String equivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaMasivoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaMasivoDAO.java new file mode 100644 index 000000000..acec450b2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaMasivoDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaMasivoDAO extends GenericDAO { + + + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo); + + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaPuntoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaPuntoDAO.java new file mode 100644 index 000000000..830523460 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaPuntoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaPuntoDAO extends GenericDAO { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamArticuloDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamArticuloDAO.java new file mode 100644 index 000000000..9e3c7faa9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamArticuloDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; + +public interface ParamArticuloDAO extends GenericDAO{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCanjePuntoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCanjePuntoDAO.java new file mode 100644 index 000000000..99391fe5b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCanjePuntoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCanjePuntoDAO extends GenericDAO { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCompraPuntoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCompraPuntoDAO.java new file mode 100644 index 000000000..bad3c9212 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCompraPuntoDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCompraPuntoDAO extends GenericDAO { + + public List buscar(Date ini, Date fim); + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamConexionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamConexionDAO.java new file mode 100644 index 000000000..93a1f1484 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamConexionDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamConexion; + +public interface ParamConexionDAO { + + public ParamConexion actualizacion(ParamConexion paramConexion) ; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCostoTarjetaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCostoTarjetaDAO.java new file mode 100644 index 000000000..1b007a02b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamCostoTarjetaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; + +/** + * + * @author Rafius + */ +public interface ParamCostoTarjetaDAO extends GenericDAO { + + public List buscar(ParamCostoTarjeta paramCostoTarjeta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamRecoleccionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamRecoleccionDAO.java new file mode 100644 index 000000000..43f4cbac8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ParamRecoleccionDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; + +/** + * + * @author Desenvolvimento + */ +public interface ParamRecoleccionDAO extends GenericDAO{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PerfilDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PerfilDAO.java new file mode 100644 index 000000000..1800edd47 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PerfilDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface PerfilDAO extends GenericDAO { + + public List buscar(String dscPerfil); + + public List buscaPerfilJerarquia(Perfil perfilUsuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PerfilFuncionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PerfilFuncionDAO.java new file mode 100644 index 000000000..85736e728 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PerfilFuncionDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; + +/** + * + * @author rodrigo + */ +public interface PerfilFuncionDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PeriodoVacacionalDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PeriodoVacacionalDAO.java new file mode 100644 index 000000000..281e9247b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PeriodoVacacionalDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PeriodoVacacionalDAO extends GenericDAO { + + public List buscar(Date dataInicio, Date dataFim); + + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PlazaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PlazaDAO.java new file mode 100644 index 000000000..f2d5dc9f6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PlazaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface PlazaDAO extends GenericDAO { + + public List buscar(String nombplaza); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PrecioVentajaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PrecioVentajaDAO.java new file mode 100644 index 000000000..9026b2c5e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PrecioVentajaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; + +/** + * + * @author Igor + */ +public interface PrecioVentajaDAO extends GenericDAO { + + public List buscarPrecioVentaja(Integer origenId, Integer destinoId, Integer rutaId); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java new file mode 100644 index 000000000..e545a2fbc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +public interface PrecoApanheDAO extends GenericDAO { + + public List buscar(String deschotel, String desccolonia, String nombciudad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingAsientoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingAsientoDAO.java new file mode 100644 index 000000000..7dffd65dc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingAsientoDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingAsientoDAO extends GenericDAO { + + public List obtenerPricingCategoria(Pricing pricing, Integer asiento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingCategoriaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingCategoriaDAO.java new file mode 100644 index 000000000..7884de6c2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingCategoriaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; + +/** + * + * @author Rafius + */ +public interface PricingCategoriaDAO extends GenericDAO { + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingClaseDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingClaseDAO.java new file mode 100644 index 000000000..7d9c43069 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingClaseDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; + +/** + * + * @author Rafius + */ +public interface PricingClaseDAO extends GenericDAO { + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingClasseTarifariaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingClasseTarifariaDAO.java new file mode 100644 index 000000000..516786611 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingClasseTarifariaDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; + +public interface PricingClasseTarifariaDAO extends GenericDAO { + + public Boolean validacionSigla(String sigla); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingCorridaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingCorridaDAO.java new file mode 100644 index 000000000..68de7ba48 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingCorridaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; + +/** + * + * @author Rafius + */ +public interface PricingCorridaDAO extends GenericDAO { + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingDAO.java new file mode 100644 index 000000000..ea86afddd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingDAO extends GenericDAO { + + public List buscar(String nombPricing, Empresa empresa, + Short cantboleto, Integer cantdiasanticipacion, + BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo); + + public List buscarPorNombre(String nombPricing); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingDiaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingDiaDAO.java new file mode 100644 index 000000000..0cb9b89e6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingDiaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingDiaDAO extends GenericDAO { + + public List buscarTraslapa(PricingDia pricingDia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoDAO.java new file mode 100644 index 000000000..c7e7da09d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; + +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingEspecificoDAO extends GenericDAO { + + public List buscarPorNome(PricingEspecifico pricingEspecifico); + + public List buscarPorNome(String nome); + + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoOcupacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoOcupacionDAO.java new file mode 100644 index 000000000..6854160be --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoOcupacionDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; + +public interface PricingEspecificoOcupacionDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingFormapagoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingFormapagoDAO.java new file mode 100644 index 000000000..a2ba8f67e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingFormapagoDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; + +public interface PricingFormapagoDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingImporteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingImporteDAO.java new file mode 100644 index 000000000..ff0de3546 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingImporteDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingImporteDAO extends GenericDAO { + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingMarcaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingMarcaDAO.java new file mode 100644 index 000000000..3e2f3ea7c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingMarcaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; + +/** + * + * @author Rafius + */ +public interface PricingMarcaDAO extends GenericDAO { + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingMercadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingMercadoDAO.java new file mode 100644 index 000000000..b0508d1f2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingMercadoDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; + +/** + * + * @author Rafius + */ +public interface PricingMercadoDAO extends GenericDAO { + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java new file mode 100644 index 000000000..5da8a37c4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; + +/** + * + * @author Rafius + */ +public interface PricingOcupaAntecipaDAO extends GenericDAO { + + + public List buscarOcupaAntecipaPricing(Integer pricingId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingPuntoVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingPuntoVentaDAO.java new file mode 100644 index 000000000..15f172d0a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingPuntoVentaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingPuntoVentaDAO extends GenericDAO { + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingRutaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingRutaDAO.java new file mode 100644 index 000000000..44cce2268 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingRutaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +/** + * + * @author Rafius + */ +public interface PricingRutaDAO extends GenericDAO { + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingTipoPtoVtaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingTipoPtoVtaDAO.java new file mode 100644 index 000000000..b76bea53e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingTipoPtoVtaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingTipoPtoVtaDAO extends GenericDAO { + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingTipoServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingTipoServicioDAO.java new file mode 100644 index 000000000..e249fa52c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingTipoServicioDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; + +/** + * + * @author Desenvolvimento + */ +public interface PricingTipoServicioDAO extends GenericDAO { + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingVigenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingVigenciaDAO.java new file mode 100644 index 000000000..e4c98391e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PricingVigenciaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingVigenciaDAO extends GenericDAO { + + public List buscarPorVigencias(PricingVigencia pv); + + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, + Date inicio, Date fim); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdClaseServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdClaseServicioDAO.java new file mode 100644 index 000000000..914fd82c9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdClaseServicioDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; + +/** + * + * @author Rafius + */ +public interface ProdClaseServicioDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdFormaPagoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdFormaPagoDAO.java new file mode 100644 index 000000000..abce37883 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdFormaPagoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; + +/** + * + * @author Rafius + */ +public interface ProdFormaPagoDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdMarcaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdMarcaDAO.java new file mode 100644 index 000000000..cb77755bc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdMarcaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdMarca; + +/** + * + * @author Rafius + */ +public interface ProdMarcaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdMercadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdMercadoDAO.java new file mode 100644 index 000000000..4eb36295d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdMercadoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdMercado; + +/** + * + * @author Rafius + */ +public interface ProdMercadoDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdPrecioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdPrecioDAO.java new file mode 100644 index 000000000..fbfda688f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdPrecioDAO.java @@ -0,0 +1,33 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ProdPrecioDAO extends GenericDAO { + + /** + * Hace una busqueda en los prodPrecio que estan ativos y con los filtros indicados + * @param marca + * @param productoservicio + * @return + */ + public List buscar(Marca marca, ProductoServicio productoservicio); + + /** + * Hace una busqueda en los prodPrecio que estan ativos y con los filtros indicados + * @param marca + * @return + */ + public List buscar(Marca marca); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdPuntoVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdPuntoVentaDAO.java new file mode 100644 index 000000000..727bf9618 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdPuntoVentaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ProdPuntoVentaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdRutaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdRutaDAO.java new file mode 100644 index 000000000..62377f84e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdRutaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdRuta; + +/** + * + * @author Rafius + */ +public interface ProdRutaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdTipoptovtaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdTipoptovtaDAO.java new file mode 100644 index 000000000..8cdd95127 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdTipoptovtaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; + +/** + * + * @author Rafius + */ +public interface ProdTipoptovtaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdVigenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdVigenciaDAO.java new file mode 100644 index 000000000..4978f84e4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProdVigenciaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProdVigenciaDAO extends GenericDAO { + + public List buscarTraslapa(ProdVigencia prodVigencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProductoServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProductoServicioDAO.java new file mode 100644 index 000000000..cd4ae3e34 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ProductoServicioDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface ProductoServicioDAO extends GenericDAO{ + + public List obtener(ProductoServicio ps); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaCheckinDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaCheckinDAO.java new file mode 100644 index 000000000..67041d626 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaCheckinDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; + +public interface PtoVtaCheckinDAO extends GenericDAO { + + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaSeguroDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaSeguroDAO.java new file mode 100644 index 000000000..6a9e4bafc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaSeguroDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; + +public interface PtoVtaSeguroDAO extends GenericDAO { + + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaUsuarioBancarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaUsuarioBancarioDAO.java new file mode 100644 index 000000000..2da71abbe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtoVtaUsuarioBancarioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; + +/** + * + * @author Desenvolvimento + */ +public interface PtoVtaUsuarioBancarioDAO extends GenericDAO { + + public void borrarFisico(PtoVtaUsuarioBancario pto2); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaAgenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaAgenciaDAO.java new file mode 100644 index 000000000..7b57014d4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaAgenciaDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; + + +public interface PtovtaAgenciaDAO extends GenericDAO { + + public List buscar(String numagencia); + + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaAntecipacomissaoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaAntecipacomissaoDAO.java new file mode 100644 index 000000000..f1379c56d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaAntecipacomissaoDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + + +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; + +public interface PtovtaAntecipacomissaoDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaCatIndDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaCatIndDAO.java new file mode 100644 index 000000000..9ecc19f4a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaCatIndDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; + +public interface PtovtaCatIndDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaComissaoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaComissaoDAO.java new file mode 100644 index 000000000..be9876c69 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaComissaoDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface PtovtaComissaoDAO extends GenericDAO { + + public List buscar(int id); + + public List buscarByPuntaVenta(PuntoVenta puntaVenta); + + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaDiversosDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaDiversosDAO.java new file mode 100644 index 000000000..e83446161 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaDiversosDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; + + + + +public interface PtovtaDiversosDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaBloqueadaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaBloqueadaDAO.java new file mode 100644 index 000000000..d73f75eac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaBloqueadaDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; + +public interface PtovtaEmpresaBloqueadaDAO extends GenericDAO { + + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaDAO.java new file mode 100644 index 000000000..f2411b97e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface PtovtaEmpresaDAO extends GenericDAO { + + public List buscar(PtovtaEmpresa ptovtaEmpresa); + + public void borrarFisico(PtovtaEmpresa pto); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEstoqueDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEstoqueDAO.java new file mode 100644 index 000000000..f0b9230b0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaEstoqueDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; + + + + + + +public interface PtovtaEstoqueDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaHorarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaHorarioDAO.java new file mode 100644 index 000000000..587129a9d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaHorarioDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; + + + + + + + +public interface PtovtaHorarioDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java new file mode 100644 index 000000000..502e40a36 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; + +public interface PtovtaTipoEstoqueDAO extends GenericDAO { + + public PtovtaTipoEstoque buscarTipoSuprimento(); + public PtovtaTipoEstoque buscarTipoContabilidade(); + public PtovtaTipoEstoque buscarTipoNormal(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaTitularDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaTitularDAO.java new file mode 100644 index 000000000..8dda0b813 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PtovtaTitularDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; + + + +public interface PtovtaTitularDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java new file mode 100644 index 000000000..3e39c1549 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java @@ -0,0 +1,34 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Administrador + */ +public interface PuntoVentaDAO extends GenericDAO { + + + public List buscaLike(String strEstacion); + + public List busca(String nomPuntoVenta, String numPuntoVenta); + + public List buscaPuntoVenta(String numPuntoVenta); + + public List buscaPuntoVentaParada(Parada parada); + + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta); + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas); + + public List buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoCtrlDAO.java new file mode 100644 index 000000000..f7b76b6c7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoCtrlDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoCtrlDAO extends GenericDAO { + + public List buscar(RedondeoCtrl redondeoCtrl); + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, Boolean indaplicapricing); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoDAO.java new file mode 100644 index 000000000..f425af0f8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoDAO extends GenericDAO { + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo); + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoMarcaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoMarcaDAO.java new file mode 100644 index 000000000..8abbaaacd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RedondeoMarcaDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoMarcaDAO extends GenericDAO { + + public List buscar(Marca marca); + + public List obtenerTodasMarcas(Short[] iDMarcas); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RequisicionBoletoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RequisicionBoletoDAO.java new file mode 100644 index 000000000..db2e698d8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RequisicionBoletoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; + +public interface RequisicionBoletoDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionCategoriaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionCategoriaDAO.java new file mode 100644 index 000000000..ff664873d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionCategoriaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; + +/** + * + * @author Administrador + */ +public interface ReservacionCategoriaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionClaseDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionClaseDAO.java new file mode 100644 index 000000000..449b882ce --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionClaseDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; + +/** + * + * @author Administrador + */ +public interface ReservacionClaseDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionCtrlDAO.java new file mode 100644 index 000000000..304fdf798 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionCtrlDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ReservacionCtrlDAO extends GenericDAO { + + public List buscar(ReservacionCtrl reservacionCtrl); + + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionMarcaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionMarcaDAO.java new file mode 100644 index 000000000..42ea81d08 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionMarcaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; + +/** + * + * @author Administrador + */ +public interface ReservacionMarcaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionMercadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionMercadoDAO.java new file mode 100644 index 000000000..83eea9c18 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionMercadoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; + +/** + * + * @author Administrador + */ +public interface ReservacionMercadoDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionPuntoVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionPuntoVentaDAO.java new file mode 100644 index 000000000..f0c3b2732 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ReservacionPuntoVentaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ReservacionPuntoVentaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RestriccionPagoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RestriccionPagoDAO.java new file mode 100644 index 000000000..9a547682f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RestriccionPagoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; + +/** + * + * @author Administrador + */ +public interface RestriccionPagoDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RhPagoConductorDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RhPagoConductorDAO.java new file mode 100644 index 000000000..088478e73 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RhPagoConductorDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; + +/** + * + * @author Desenvolvimento + */ +public interface RhPagoConductorDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RolOperativoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RolOperativoDAO.java new file mode 100644 index 000000000..a52bb9c17 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RolOperativoDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface RolOperativoDAO extends GenericDAO{ + + public List pesquisar(DiagramaAutobus diagrama,String rol); + + public List buscar(String descroloperativo); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaCasetaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaCasetaDAO.java new file mode 100644 index 000000000..d3e8198d4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaCasetaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + + + +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; + +public interface RutaCasetaDAO extends GenericDAO { + +// public RutaCaseta suscribir(RutaCaseta entidad); + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java new file mode 100644 index 000000000..5c582c592 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaVO; + +import java.util.List; + +/** + * + * @author Rafius + */ +public interface RutaCombinacionDAO extends GenericDAO { + + public boolean busquedaRutaTramo(Ruta ruta, Tramo tramo, Boolean ativo); + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino); + + /** + * Regreso el tramo de la entidade RutaCobinacion donde el tramo tines el origen-destino igual y la Rua sea la misma de RutaCombinacion + * + * @param ruta + * @param origen + * @param destino + * @return + */ + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino); + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino); + + public List obtenerPorRuta(Ruta ruta); + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo); + + /** + * Hace una b�squena en los tramos faltantes en la combinacion de la ruta informada + * @param rutaId + * @return + */ + List tramosFaltantes(Integer rutaId); + + public int borrarCombinaciones(Ruta ruta); + + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino); + + public List pesquisaTarifaObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente); + + public List pesquisaTarifaEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId); + + public List pesquisaTarifaGroupObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa); + + public List pesquisaTarifaOficialEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId); + + public List pesquisaTarifaOficialGroupObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvVigenciaTarifa); + + public List pesquisaTarifaOficialObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvVigenciaTarifa); + + /** + * Indica se existe alguma combinação ativa com o tramo informado + * @param tramo + * @return + */ + public boolean existeTramo(Tramo tramo); + + public boolean existeTramo(Tramo tramo, ClaseServicio claseServicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java new file mode 100644 index 000000000..7cdaf43fc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; + +import java.util.List; + +/** + * + * @author Rafius + */ +public interface RutaDAO extends GenericDAO { + + public List buscarPorTramo(Tramo tramo); + + + public List buscarPorClaseServicio(ClaseServicio claseServicio); + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa); + + public List buscar(String nomeRuta, ClaseServicio claseServicio,Boolean nomeObrigatorio); + + public List obtenerPorEmpresa(Empresa empresa); + + public List buscarTodosExceto(Integer... idRuta); + + public List buscarTodosEstos(Integer[] idRutas); + + public List buscarNumRuta(String numRuta); + + /** + * Regresa la origen de la ruta + * + * @param ruta + * @return + */ + public Parada buscarOrigen(Ruta ruta); + + /** + * Regresa el destino de la ruta + * + * @param ruta + * @return + */ + public Parada buscarDestino(Ruta ruta); + + public List buscaRuta(String palavraPesquisaRuta); + + public List buscaRutasFromOrgao(OrgaoConcedente orgao); + + + public List buscarPorRutaPorEmpresas(List lsEmpresas); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaEmpresaDAO.java new file mode 100644 index 000000000..8996a13b1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaEmpresaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; + +/** + * + * @author Administrador + */ +public interface RutaEmpresaDAO extends GenericDAO { + + public List obtenerPorEmpresa(Empresa empresa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaSecuenciaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaSecuenciaDAO.java new file mode 100644 index 000000000..b4140e875 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/RutaSecuenciaDAO.java @@ -0,0 +1,33 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; + +/** + * + * @author Rafius + */ +public interface RutaSecuenciaDAO extends GenericDAO { + + public List buscarSecuenciaOrdenado(Ruta ruta); + + public int borrarSecuencias(Ruta ruta); + + /** + * Hace la validación de la origen y destino dentro de la secuencia de la ruta.
+ * + * La parada de origen no puede tener el numero de secuencia mayor o igual a la parada de destino
+ * @param ruta + * @param origen + * @param destino + * @return + */ + public boolean paradaSecuenciaValida(Ruta ruta, Parada origen,Parada destino); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SecretariaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SecretariaDAO.java new file mode 100644 index 000000000..e01f04529 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SecretariaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface SecretariaDAO extends GenericDAO { + + public List buscar(String descsecretaria, String cvesecretaria); + + public List buscar(String descsecretaria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SecretariaEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SecretariaEmpresaDAO.java new file mode 100644 index 000000000..3975ecf8f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SecretariaEmpresaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; + +public interface SecretariaEmpresaDAO extends GenericDAO { + + public List buscarPorSecretaria(Secretaria secretaria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SegVKMDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SegVKMDAO.java new file mode 100644 index 000000000..2458906e9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SegVKMDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.SegVKM; + +/** + * + * @author RJ + */ +public interface SegVKMDAO extends GenericDAO { + + public List buscar(String segVKm); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguradoraEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguradoraEmpresaDAO.java new file mode 100644 index 000000000..6c9e674f3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguradoraEmpresaDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; + +public interface SeguradoraEmpresaDAO extends GenericDAO { + public boolean existe(Empresa empresa, String serie); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguroKmDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguroKmDAO.java new file mode 100644 index 000000000..17817445d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguroKmDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; +import java.util.List; + +public interface SeguroKmDAO extends GenericDAO { + + /** + * Indica se existe seguroKm para o orgaoConcedenteId informado + * + * @param orgaoConcedenteId + * @return + */ + public boolean existe(Integer orgaoConcedenteId); + + public List buscarPorOrgao(OrgaoConcedente orgao); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguroTarifaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguroTarifaDAO.java new file mode 100644 index 000000000..385d550e6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SeguroTarifaDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; + +public interface SeguroTarifaDAO extends GenericDAO { + + /** + * Indica se existe seguroTarifa para o orgaoConcedenteId informado + * + * @param orgaoConcedenteId + * @return + */ + public boolean existe(Integer orgaoConcedenteId); + + public List buscarPorOrgao(OrgaoConcedente orgao); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SisdapDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SisdapDAO.java new file mode 100644 index 000000000..1fa210b80 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SisdapDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +public interface SisdapDAO { + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId); + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/SistemaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SistemaDAO.java new file mode 100644 index 000000000..2bc5ce1a7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/SistemaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Sistema; + +/** + * + * @author rodrigo + */ +public interface SistemaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaCategoriaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaCategoriaDAO.java new file mode 100644 index 000000000..8db0b1cb9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaCategoriaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface TarifaCategoriaDAO extends GenericDAO { + + public List buscarPorCategoria(Categoria categoria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java new file mode 100644 index 000000000..1caacf257 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.TarifaService; + +/** + * + * @author rodrigo + */ +public interface TarifaDAO extends GenericDAO { + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda,ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa,Categoria categoria, TipoPuntoVenta tipoPuntoVenta); + + /** + * {@link TarifaService#existe(Marca, Tramo, Moneda, ClaseServicio, VigenciaTarifa, Ruta, OrgaoConcedente)} + * + * @param marca + * @param tramo + * @param moneda + * @param claseServicio + * @param vigenciaTarifa + * @param ruta + * @param orgaoConcedente + * @return + */ + public boolean existe(Marca marca, Tramo tramo, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente); + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta); + + /** + * Lista as tarifas que tem a vigencia informada.
+ * + * As tarifas listadas podem estar ativas ou inativas
+ * + * @param vigencia + * @return + */ + public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia,Empresa empresa); + + /** + * Lista as tarifas que tem a vigencia informada.
+ * + * Só é listado as tarifas ativas
+ * + * @param vigenciaTarifa + * @return + */ + public List buscarTarifasAtivasPorVigencia(VigenciaTarifa vigenciaTarifa); + + public boolean buscarTarifaExisteTramo(Tramo tramo) ; + + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; + + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaHistDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaHistDAO.java new file mode 100644 index 000000000..8849438a5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaHistDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarifaHist; + +/** + * + * @author rodrigo + */ +public interface TarifaHistDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaKmDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaKmDAO.java new file mode 100644 index 000000000..65f98858e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaKmDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; + +public interface TarifaKmDAO extends GenericDAO{ + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java new file mode 100644 index 000000000..d0f302f9a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; + +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface TarifaMinimaDAO extends GenericDAO { + + public List pesquisarPlaza(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Plaza plaza); + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda); + + public List pesquisar( Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, OrgaoConcedente orgaoConcedente); + + public List buscarPorPlaza(Plaza plaza); + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda); + + public List pesquisar(BigDecimal valor, Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio); + + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda); + + public List buscarPorMarcaMoneda(Marca marca, Moneda moneda); + + public List buscarPorClaseServicioMoneda(ClaseServicio claseServicio, + Moneda moneda); + + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java new file mode 100644 index 000000000..4d538d2f9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java @@ -0,0 +1,88 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.service.TarifaOficialService; + + +public interface TarifaOficialDAO extends GenericDAO{ + /** + * See {@link TarifaOficialService#gerarTarifaPorCoeficiente(Integer, Integer)} + * @param ruta + * @param usuarioId TODO + * @param orgaoConcedenteId TODO + * @return TODO + */ + public Integer gerarTarifaPorCoeficiente(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public Integer gerarTarifaArtesp(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public Integer gerarTabelaZerada(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + /** + * See {@link TarifaOficialService#atualizarTarifaPorCoeficiente(Integer, Integer)} + * @param rutaId + * @param usuarioId TODO + * @param orgaoConcedenteId + * @return TODO + */ + public Integer atualizarTarifaCoeficiente(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId); + + /** + * See {@link TarifaOficialService#copiarParaTarifa(VigenciaTarifa)} + * @param vigenciaTarifa + * @param usuarioId TODO + * @param calculaPegagio Boolean + * @param calculaTarifa Boolean + * @param calculaTaxaEmbarque Boolean + */ + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro); + + /** + * See {@link TarifaOficialService#atualizarTaxaEmbarque(Integer, Integer)} + * @param rutaId + * @param usuarioId TODO + * @param orgaoConcedenteId TODO + * @param empresaId TODO + */ + public void atualizarTaxaEmbarque(List lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + /** + * See {@link TarifaOficialService#atualizarSeguroPorKm(Integer, Integer, Integer)} + * @param rutaId + * @param orgaoId + * @param usuarioId + */ + public void atualizarSeguroPorKm(Integer rutaId,Integer orgaoId,Integer usuarioId) ; + + /** + * See {@link TarifaOficialService#atualizarSeguroPorTarifa(Integer, Integer, Integer)} + * @param rutaId + * @param orgaoId + * @param usuarioId + */ + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId,Integer usuarioId); + + /** + * Aplica a regra de arredondamento para as tarifas do �rg�o concedente informado.
+ * + * + * Ap�s somar todos os componentes (precio,importetaxaembarque,importeseguro,importeoutros e importepedagio) obtem-se o PRECO final.
+ * + * Baseado nesse valor, s�o aplicados as regras de arredondamento onde o componente precio pode sofrer um acr�scimo os descr�scimo de pre�o para que o arredondamento
+ * fique certo + * + * @param orgaoConcedenteId + * @param usuarioId TODO + */ + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Integer usuarioId, Boolean taxaEmbarque); + + public void limparTarifasOficiais(); + + public void atualizarPedagio(); + + public long obtenerCount(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaTipoptovtaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaTipoptovtaDAO.java new file mode 100644 index 000000000..38e282681 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarifaTipoptovtaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; + +/** + * + * @author rodrigo + */ +public interface TarifaTipoptovtaDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaCreditoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaCreditoDAO.java new file mode 100644 index 000000000..c83e532df --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaCreditoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; + +public interface TarjetaCreditoDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaFidelidadDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaFidelidadDAO.java new file mode 100644 index 000000000..22aecc32b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaFidelidadDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; + +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TarjetaFidelidadDAO extends GenericDAO{ + + public List obtenerCantDesc(); + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaRecaudacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaRecaudacionDAO.java new file mode 100644 index 000000000..a41efa37f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaRecaudacionDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; + +/** + * + * @author Administrador + */ +public interface TarjetaRecaudacionDAO extends + GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaViajeDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaViajeDAO.java new file mode 100644 index 000000000..d975626e0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TarjetaViajeDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import org.zkoss.zul.Comboitem; + +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; + +public interface TarjetaViajeDAO extends GenericDAO { + + public List buscarTarjetaPorFiltros(Integer autoIni, Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa); + + public List buscarTarjetasParaEnvioNomina(Date fecIni, Date fecFin); + + public List buscarTarjetaPorFiltros(TarjetaViaje tarjeta); + + public boolean buscarTarjetaExisteVolta(TarjetaViaje t); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbLevanteCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbLevanteCtrlDAO.java new file mode 100644 index 000000000..c53615bfd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbLevanteCtrlDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; + +public interface TaxaEmbLevanteCtrlDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueKmDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueKmDAO.java new file mode 100644 index 000000000..ff049efba --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueKmDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueKmDAO extends GenericDAO{ + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueParadaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueParadaDAO.java new file mode 100644 index 000000000..f56a87ea2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueParadaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueParadaDAO extends GenericDAO { + + public List buscarPorLocalidade(Parada parada); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCambioCiudadDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCambioCiudadDAO.java new file mode 100644 index 000000000..b2b06ee59 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCambioCiudadDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; + +/** + * + * @author Administrador + */ +public interface TipoCambioCiudadDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCambioCtrlDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCambioCtrlDAO.java new file mode 100644 index 000000000..d28a610aa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCambioCtrlDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; + +/** + * + * @author Administrador + */ +public interface TipoCambioCtrlDAO extends GenericDAO { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoConvenioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoConvenioDAO.java new file mode 100644 index 000000000..dbc5b2025 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoConvenioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; + +/** + * + * @author Shiro + */ +public interface TipoConvenioDAO extends GenericDAO{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCorteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCorteDAO.java new file mode 100644 index 000000000..b99886b5f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCorteDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoCorteDAO extends GenericDAO { + + public List buscar(String desctipo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDAO.java new file mode 100644 index 000000000..914c05d5f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaDAO extends GenericDAO { + + public List buscar(String descTipo); + + public List obtenerGrupoCortesia(int i); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDescuentoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDescuentoDAO.java new file mode 100644 index 000000000..a9338beb1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDescuentoDAO.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaDescuentoDAO extends + GenericDAO { + + public List pesquisar(TipoCortesia tipoCortesia); + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia); + + public List Onchangue(TipoCortesia Tcselec); + + public List obtenerTipoCortesia(int i); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java new file mode 100644 index 000000000..6250e7bd2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +public interface TipoDocAutobusDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoDomicilioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoDomicilioDAO.java new file mode 100644 index 000000000..97d7057f1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoDomicilioDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoDomicilioDAO extends GenericDAO { + + public List buscar(String desctipo, String cvetipodomicilio); + + public List buscarClave(String cvetipodomicilio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEmpleadoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEmpleadoDAO.java new file mode 100644 index 000000000..9020424c0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEmpleadoDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; + +/** + * + * @author Shiro + */ +public interface TipoEmpleadoDAO extends GenericDAO{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraDAO.java new file mode 100644 index 000000000..6e3b7a7a7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +public interface TipoEventoExtraDAO extends + GenericDAO { + + public List buscar(String descingreso); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraEmpresaDAO.java new file mode 100644 index 000000000..d72b58f2e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraEmpresaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; + +public interface TipoEventoExtraEmpresaDAO extends GenericDAO { + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoIdentificacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoIdentificacionDAO.java new file mode 100644 index 000000000..44ca600e1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoIdentificacionDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; + +public interface TipoIdentificacionDAO extends GenericDAO { + + public List obtenerTodos(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java new file mode 100644 index 000000000..710a3d47a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface TipoMovimentacionDAO extends GenericDAO { + + public TipoMovimentacion buscarTipoMovimentacio(int tipoMovimentacion); + public List obtenerTiposMovimetacionPuntoVenta(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoMovimientoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoMovimientoDAO.java new file mode 100644 index 000000000..cbb5c3927 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoMovimientoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoMovimientoDAO extends GenericDAO { + + public List buscar(String descmovimiento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoOcupacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoOcupacionDAO.java new file mode 100644 index 000000000..4ad29afe7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoOcupacionDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoOcupacionDAO extends GenericDAO { + + public List buscar(String desctipo, String cvetipoocupacion); + + public List buscarClave(String cvetipoocupacion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoParadaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoParadaDAO.java new file mode 100644 index 000000000..c27b1184c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoParadaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoParadaDAO extends GenericDAO { + + public List buscar(String desctipo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoPuntoVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoPuntoVentaDAO.java new file mode 100644 index 000000000..520771540 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoPuntoVentaDAO.java @@ -0,0 +1,32 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoPuntoVentaDAO { + + public List obtenerTodos(); + + public TipoPuntoVenta obtenerID(Short id); + + public TipoPuntoVenta suscribir(TipoPuntoVenta entidad); + + public TipoPuntoVenta actualizacion(TipoPuntoVenta entidad); + + public void borrar(TipoPuntoVenta entidad); + + public Long count(String campo, Object o); + + public List buscar(String desctipo); + + public List obtenerTodosExceto(Short... id); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoServicioDAO.java new file mode 100644 index 000000000..9a4192215 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoServicioDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoServicioDAO extends GenericDAO { + + public List buscar(String descservicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoTarifaPacoteDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoTarifaPacoteDAO.java new file mode 100644 index 000000000..b2918fed2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoTarifaPacoteDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface TipoTarifaPacoteDAO extends GenericDAO { + + public List buscaTipoTarifaPacote(Pacote pacote); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoVentaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoVentaDAO.java new file mode 100644 index 000000000..b875ce2ff --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TipoVentaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoVentaDAO extends GenericDAO{ + + public List buscar(String desctipoventa); + + public TipoVenta obtenerID(Short tipoventaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoDAO.java new file mode 100644 index 000000000..b88c912bd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoDAO.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TramoDAO extends GenericDAO { + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino); + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino); + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via via); + + public Tramo busca(Parada origem, Parada destino, Via via); + + + /** + * Hace la búsqueda del tramo que tiene origen - destino - via - clase servicio. + * + * @param origem + * @param destino + * @param via + * @param claseServicio + * @return + */ + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, ClaseServicio claseServicio); + + public List buscarCveParada(String origen, String destino, String via); + + public Long count(Via via); + public List obtenerViasOrigemDestino(Parada origem, Parada destino); + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) ; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoKmServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoKmServicioDAO.java new file mode 100644 index 000000000..55f2f1b69 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoKmServicioDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TramoKmServicioDAO extends GenericDAO { + + public List buscar(TramoKmServicio tramoKmServicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoServicioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoServicioDAO.java new file mode 100644 index 000000000..9b0990169 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoServicioDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +/** + * + * @author Rafius + */ +public interface TramoServicioDAO extends GenericDAO { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase); + + /** + * Hace la búsqueda del tramo tiempo activo de acuerdo los parametros. + * + * El filtrado tambien se el tramo asociado es activo + * + * @param origen + * @param destino + * @param via + * @param clase + * @return + */ + public TramoServicio buscar(Parada origen,Parada destino,Via via,ClaseServicio clase); + + /** + * Indica si existen tiempos para los trechos del esquemaCorrida. O sea, debe de haber para cada tramo del esquema un tramoServicio válido + * + * @param esquemaCorridaId + * @return + */ + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoTiempoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoTiempoDAO.java new file mode 100644 index 000000000..5ff47c45e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TramoTiempoDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; + +/** + * + * @author Administrador + */ +public interface TramoTiempoDAO extends GenericDAO { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase); + + /** + * Hace una búsqueda por los tramoTiempo activos, con la clase informado y + * donde traslapa feIni y fecFin con horainicio y horafin. + * + * @param tramo + * @param clase + * @param fecIni + * - Es la hora de inicio + * @param fecFin + * - Es la hora de fin + * @return + */ + public List buscar(Tramo tramo, ClaseServicio clase, Date fecIni, Date fecFin); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/TurnoDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TurnoDAO.java new file mode 100644 index 000000000..bce02d5be --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/TurnoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Turno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TurnoDAO extends GenericDAO { + + public List buscar(String descturno); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioBancarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioBancarioDAO.java new file mode 100644 index 000000000..389ca14b4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioBancarioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; + +/** + * + * @author Rafius + */ +public interface UsuarioBancarioDAO extends GenericDAO { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioDAO.java new file mode 100644 index 000000000..a09e02cef --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioDAO.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO; + +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface UsuarioDAO extends GenericDAO { + + public List buscarPeloNome(String nome); + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha); + + public List buscarPorEmpleado(Empleado empleado); + + public List buscarPelaCveUsuario(String cveUsuario); + + public List buscarUsuariosActivo(); + + public List buscarPeloNomeLike(String nome); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java new file mode 100644 index 000000000..13fba99a3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; + +public interface UsuarioEmpresaDAO extends GenericDAO { + + public List obtenerPorUsuario(Usuario usuario); + public List obtenerEmpresa(Usuario usuario) ; + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioPerfilDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioPerfilDAO.java new file mode 100644 index 000000000..9778fd053 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioPerfilDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface UsuarioPerfilDAO extends GenericDAO { + + public List obtenerPorUsuario(Usuario usuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioSesionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioSesionDAO.java new file mode 100644 index 000000000..8dfe62963 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioSesionDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; + +/** + * + * @author RJ Consultores + */ +public interface UsuarioSesionDAO extends GenericDAO { + + public List buscar(Usuario usuario); + + void liberarUsuario(Usuario usuario); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java new file mode 100644 index 000000000..69d259a1d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; + +/** + * + * @author rodrigo + */ +public interface UsuarioUbicacionDAO extends GenericDAO { + + public List buscarPorUsuario(Usuario usuario); + public List buscarPuntoVentaPorUsuario(Usuario usuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/ViaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ViaDAO.java new file mode 100644 index 000000000..467eda04f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/ViaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Via; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ViaDAO extends GenericDAO { + + public List buscar(String nombvia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/VigenciaTarifaDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/VigenciaTarifaDAO.java new file mode 100644 index 000000000..ec697ea5e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/VigenciaTarifaDAO.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import java.util.Date; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface VigenciaTarifaDAO extends GenericDAO { + + public List pesquisar(Date inicio, Date fim); + + + + /** + * Regresa las vigencia que traslapa + * @param vigenciaTarifa + * @return + */ + public List buscarVigenciasIntervalo(VigenciaTarifa vigenciaTarifa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoBoletoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoBoletoHibernateDAO.java new file mode 100644 index 000000000..58841771a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoBoletoHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("abastoBoletoDAO") +public class AbastoBoletoHibernateDAO extends GenericHibernateDAO + implements AbastoBoletoDAO { + + @Autowired + public AbastoBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaAbastoBoletoPorPuntoVenta(PuntoVenta puntoVenta) { + + List abastos = findByCriteria(Restrictions.eq("puntoventa", puntoVenta), Restrictions.eq("activo", Boolean.TRUE)); + return abastos; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java new file mode 100644 index 000000000..4989d3e2a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java @@ -0,0 +1,216 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.ControleEstoqueMigracao; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("abastoCentralDAO") +public class AbastoCentralHibernateDAO extends GenericHibernateDAO implements AbastoCentralDAO { + + @Autowired + public AbastoCentralHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + + public List obtenerBilhetes(Aidf aidf, PuntoVenta origem) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("aidf", aidf)); + c.add(Restrictions.eq("puntoventa", origem)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + + public List obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem) { + + String queryStr = "from AbastoCentral act where act.aidf = :aidf and act.puntoventa = :puntoventa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal"; + + Query query = getSession().createQuery(queryStr); + + query.setLong("aidf", aidf.getAidfId()); + query.setInteger("puntoventa", origem.getPuntoventaId()); + query.setLong("folioinicial", Long.valueOf(formInicial)); + query.setLong("foliofinal", Long.valueOf(formFinal)); + + return (List)query.list(); + } + + @Transactional + public void actualizaBilhetes(List bilhetes, PuntoVenta destino) { + + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + bilhete.setPuntoventa(destino); + session.update(bilhete); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + @Transactional(readOnly=true) + public void suscribirBilhetes(List bilhetes) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + + session.save(bilhete); + + if(++count % 50 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + public List buscaBilhetesPorAidf(Aidf aidf) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("aidf", aidf)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes) { + + String queryStr = "from AbastoCentral act where act.puntoventa = :puntoventa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal"; + + Query query = getSession().createQuery(queryStr); + + query.setInteger("puntoventa", puntoVentaBilhetes.getPuntoventaId()); + query.setLong("folioinicial", Long.valueOf(formInicial)); + query.setLong("foliofinal", Long.valueOf(formFinal)); + + return (List)query.list(); + } + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("estacion", origem)); + c.addOrder(Order.asc("numfoliopreimpreso")); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(String numSerie, String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem) { + + String queryStr = "from AbastoCentral act where act.puntoventa = :puntoventa and act.numseriepreimpresa = :numseriepreimpresa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal"; + + if(origem != null) + queryStr += " and act.estacion = :estacion"; + + Query query = getSession().createQuery(queryStr); + + query.setInteger("puntoventa", puntoVentaBilhetes.getPuntoventaId()); + query.setString("numseriepreimpresa", numSerie); + query.setLong("folioinicial", Long.valueOf(formInicial)); + query.setLong("foliofinal", Long.valueOf(formFinal)); + + if(origem != null) + query.setInteger("estacion", origem.getEstacionId()); + + return (List)query.list(); + } + + @Transactional + public void actualizaBilhetes(List bilhetes, Estacion destino) { + + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + bilhete.setEstacion(destino); + session.update(bilhete); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + @Override + public void gravaControleEstoqueMigracao(PuntoVenta puntoVenta, Date fecmodif, Integer usuarioId) { + Session session = getSessionFactory().getCurrentSession(); + ControleEstoqueMigracao ctrlMigracao = new ControleEstoqueMigracao(puntoVenta, fecmodif, usuarioId); + session.save(ctrlMigracao); + session.flush(); + session.clear(); + } + + @Override + public List buscarSeriesBilhetesPorEstacion(Estacion estacion) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.setProjection(Projections.distinct(Property.forName("numseriepreimpresa"))); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("estacion", estacion)); + c.addOrder(Order.asc("numseriepreimpresa")); + + return (List)c.list(); + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf){ + String hql = " delete from AbastoCentral where aidf.aidfId = " + aidf.getAidfId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java new file mode 100644 index 000000000..9585c035f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("abastoHistoDAO") +public class AbastoHistoHibernateDAO extends GenericHibernateDAO implements AbastoHistoDAO { + + @Autowired + public AbastoHistoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf){ + String hql = " delete from AbastoHisto where aidf.aidfId = " + aidf.getAidfId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } + + public void grabaHistoricoBilhetes(List bilhetes, TipoMovimentacion tipoMovimentacion) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + + Date dataActual = Calendar.getInstance().getTime(); + AbastoHisto nuevoHistorico = new AbastoHisto(bilhete, tipoMovimentacion, dataActual, true, dataActual, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + session.save(nuevoHistorico); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java new file mode 100644 index 000000000..1e271125a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfEspecieDAO; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; + +@Repository("aidfEspecieDAO") +public class AidfEspecieHibernateDAO extends GenericHibernateDAO implements AidfEspecieDAO{ + + @Autowired + public AidfEspecieHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java new file mode 100644 index 000000000..46a0e7372 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +@Repository("aidfDAO") +public class AidfHibernateDAO extends GenericHibernateDAO implements AidfDAO{ + + private static Logger log = Logger.getLogger(AidfHibernateDAO.class); + + @Autowired + public AidfHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public List obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn){ + + PreparedStatement pstmt = null; + ResultSet rs = null; + + StringBuilder sb = new StringBuilder(); + sb.append(" select x.AIDF_ID, "); + sb.append(" x.ESTADO_ID, "); + sb.append(" REGEXP_REPLACE( x.docfiscal ,'[^[:alnum:]'' '']', NULL) , "); + sb.append(" x.ACFISCAL, "); + sb.append(" x.SERIE, "); + sb.append(" x.FORMINICIAL, "); + sb.append(" x.FORMFINAL, "); + sb.append(" x.FECADQUISICION, "); + sb.append(" x.FECVENCIMIENTO, "); + sb.append(" x.INSCESTADUAL, "); + sb.append(" x.EMPRESA_ID, "); + sb.append(" x.AIDFESP_ID, "); + sb.append(" x.AIDFTIPO_ID, "); + sb.append(" x.ACTIVO, "); + sb.append(" x.FECMODIF, "); + sb.append(" x.USUARIO_ID, "); + sb.append(" x.SUBSERIE, "); + sb.append(" x.CNPJ, "); + sb.append(" x.TIPOVALIDAVENTA "); + sb.append(" from AIDF x where x.SERIE like '"+serie+"' "); + sb.append(" and REGEXP_REPLACE( x.docfiscal ,'[^[:alnum:]'' '']', NULL) like '"+docfiscal+"' "); + sb.append(" and x.activo = 1 "); + + + List ls = new ArrayList(); + + try{ + pstmt = conn.prepareStatement(sb.toString()); + + rs = pstmt.executeQuery(); + while (rs.next()){ + AidfVo a = new AidfVo(); + a.setAidfId(rs.getLong(1)); + a.setDocfiscal(rs.getString(3)); + a.setSerie(rs.getString(5)); + a.setForminicial(rs.getString(6)); + a.setFormfinal(rs.getString(7)); + ls.add(a); + } + } catch (Exception e){ + log.error("", e); + } finally { + try { rs.close(); } catch (Exception ignore) { log.error("", ignore); } + try { pstmt.close(); } catch (Exception ignore) { log.error("", ignore); } + } + return ls; + }; + + @Override + public List buscaAidfsPorEmpresas(List empresas) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("empresa", empresas)); + + return (List)c.list(); + } + + public Boolean existeAidfComCodFiscalEEstado(Long idAidf, String docFiscal, Estado estado){ + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("estado", estado)); + c.add(Restrictions.eq("docfiscal", docFiscal)); + + if(idAidf != null){ + c.add(Restrictions.ne("aidfId", idAidf)); + } + + return c.list().isEmpty(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java new file mode 100644 index 000000000..4df4ad6f4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfTipoDAO; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +@Repository("aidfTipoDAO") +public class AidfTipoHibernateDAO extends GenericHibernateDAO implements AidfTipoDAO { + + @Autowired + public AidfTipoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AjusteEventoExtraHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AjusteEventoExtraHibernateDAO.java new file mode 100644 index 000000000..e68a2ed52 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AjusteEventoExtraHibernateDAO.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AjusteEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; + +@Repository("ajusteEventoExtraDAO") +public class AjusteEventoExtraHibernateDAO extends + GenericHibernateDAO implements + AjusteEventoExtraDAO { + + @Autowired + public AjusteEventoExtraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AlertaCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AlertaCtrlHibernateDAO.java new file mode 100644 index 000000000..6cc0a4c9f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AlertaCtrlHibernateDAO.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AlertaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("alertaCtrlDAO") +public class AlertaCtrlHibernateDAO extends GenericHibernateDAO + implements AlertaCtrlDAO { + + @Autowired + public AlertaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Parada origem, Parada destino, Ruta ruta, + ClaseServicio claseServicio, Integer tiempoAlta, + Integer tiempoBaja, BigDecimal percAlta, BigDecimal percBaja) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + + return c.list(); + } + + public List buscarCorrida(Corrida corrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("corrida", corrida)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AliasServicoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AliasServicoHibernateDAO.java new file mode 100644 index 000000000..99ad7a81c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AliasServicoHibernateDAO.java @@ -0,0 +1,127 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AliasServicoDAO; +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +@Repository("aliasServicoDAO") +public class AliasServicoHibernateDAO extends GenericHibernateDAO + implements AliasServicoDAO { + + @Autowired + public AliasServicoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarAliasSemCorrida(Integer origenId, Integer destinoId, Integer rutaId) { + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origen.paradaId",origenId)); + c.add(Restrictions.eq("destino.paradaId",destinoId)); + c.add(Restrictions.eq("ruta.rutaId",rutaId)); + c.add(Restrictions.isNull("corridaId")); + + return c.list(); + } + + @Override + public List buscar(Integer origenId, Integer destinoId, Integer rutaId, Integer corridaId) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origen.paradaId",origenId)); + c.add(Restrictions.eq("destino.paradaId",destinoId)); + c.add(Restrictions.eq("ruta.rutaId",rutaId)); + c.add(Restrictions.eq("corridaId",corridaId)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo) { + + StringBuilder hql = new StringBuilder(); + hql.append("SELECT DISTINCT alias "); + hql.append("FROM AliasServico alias "); + hql.append("INNER JOIN alias.ruta.lsRutaEmpresa as re "); + hql.append(" WHERE alias.activo = 1 "); + + if (!linhas.isEmpty()) { + hql.append(" AND alias.ruta.rutaId IN ("); + for (Ruta r : linhas) { + hql.append(r.getRutaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!empresas.isEmpty()) { + hql.append(" AND re.empresa.empresaId IN ("); + for (Empresa e : empresas) { + hql.append(e.getEmpresaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if(!tiposClasses.isEmpty()){ + hql.append(" AND alias.ruta.claseServicio.claseservicioId IN ("); + for (ClaseServicio c : tiposClasses) { + hql.append(c.getClaseservicioId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if(!orgaos.isEmpty()){ + hql.append(" AND alias.ruta.orgaoConcedente.orgaoConcedenteId IN ("); + for (OrgaoConcedente o : orgaos) { + hql.append(o.getOrgaoConcedenteId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if(prefixo != null && !prefixo.isEmpty()){ + hql.append(" AND alias.ruta.prefixo = '" + prefixo +"'" ); + } + + Query query = getSession().createQuery(hql.toString()); + + return query.list(); + } + + @Override + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida) { + Criteria c = makeCriteria(); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origen.paradaId", origem.getParadaId())); + c.add(Restrictions.eq("destino.paradaId", destino.getParadaId())); + c.add(Restrictions.eq("ruta.rutaId", linha.getRutaId())); + if (idCorrida != null) { + c.add(Restrictions.eq("corridaId", idCorrida)); + } else { + c.add(Restrictions.isNull("corridaId")); + } + return (AliasServico) c.uniqueResult(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ArticuloHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ArticuloHibernateDAO.java new file mode 100644 index 000000000..3503b3210 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ArticuloHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.Articulo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("articuloDAO") +public class ArticuloHibernateDAO extends GenericHibernateDAO + implements ArticuloDAO { + + @Autowired + public ArticuloHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descarticulo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descarticulo", descarticulo)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java new file mode 100644 index 000000000..e62e7b0d7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AsientoExclusivoDAO; +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("asientoExclusivoDAO") +public class AsientoExclusivoHibernateDAO extends GenericHibernateDAO + implements AsientoExclusivoDAO { + + @Autowired + public AsientoExclusivoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java new file mode 100644 index 000000000..1fbeb96f5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AutobusDocDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +@Repository("autobusDocDAO") +public class AutobusDocHibernateDAO extends GenericHibernateDAO +implements AutobusDocDAO { + + @Autowired + public AutobusDocHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List obtenerPorAutobus(Autobus autobus) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("autobus", autobus)); + + return c.list(); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusHibernateDAO.java new file mode 100644 index 000000000..5127bd095 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusHibernateDAO.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AutobusDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("autobusDAO") +public class AutobusHibernateDAO extends GenericHibernateDAO + implements AutobusDAO { + + @Autowired + public AutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numautobus")); + + return c.list(); + } + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numautobus", numautobus)); + c.add(Restrictions.eq("diagramaAutobus", diagramaAutobus)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionHibernateDAO.java new file mode 100644 index 000000000..c537cfbfa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionHibernateDAO.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AutorizacionDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.Perfil; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("autorizacionDAO") +public class AutorizacionHibernateDAO extends GenericHibernateDAO + implements AutorizacionDAO { + + @Autowired + public AutorizacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombautorizacion")); + + return c.list(); + } + + public List buscar(String nombautorizacion, String descautorizacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("nombautorizacion", nombautorizacion)); + c.add(Restrictions.eq("descautorizacion", descautorizacion)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionPerfilHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionPerfilHibernateDAO.java new file mode 100644 index 000000000..3ff50cfdd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionPerfilHibernateDAO.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AutorizacionPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("autorizacionPerfilDAO") +public class AutorizacionPerfilHibernateDAO extends GenericHibernateDAO + implements AutorizacionPerfilDAO { + + @Autowired + public AutorizacionPerfilHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Autorizacion autorizacion, Perfil perfil) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("autorizacion", autorizacion)); + c.add(Restrictions.eq("perfil", perfil)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/BancoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/BancoHibernateDAO.java new file mode 100644 index 000000000..9ee11427c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/BancoHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.BancoDAO; +import com.rjconsultores.ventaboletos.entidad.Banco; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("bancoDAO") +public class BancoHibernateDAO extends GenericHibernateDAO + implements BancoDAO { + + @Autowired + public BancoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(Banco banco) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta", banco.getPuntoVenta())); + c.add(Restrictions.eq("empresa", banco.getEmpresa())); + c.add(Restrictions.eq("moneda", banco.getMoneda())); + c.add(Restrictions.eq("nombbanco", banco.getNombbanco().trim())); + c.add(Restrictions.eq("refcontrato", banco.getRefcontrato().trim())); + c.add(Restrictions.eq("numcuenta", banco.getNumcuenta())); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/BusquedaDatosTicketHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/BusquedaDatosTicketHibernateDAO.java new file mode 100644 index 000000000..a5a118481 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/BusquedaDatosTicketHibernateDAO.java @@ -0,0 +1,385 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.hibernate.type.TimestampType; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.BusquedaDatosTicketDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.EnderecoApanheVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ItemAdicionalVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PagamentoVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PassageiroVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ServicoVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosClientePacoteResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosEnderecoApanheResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosItemAdicionalResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosPagamentoResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosPassageiroResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosServicoResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosTicketResultTransformer; + +@Repository("busquedaDatosTicketDAO") +public class BusquedaDatosTicketHibernateDAO extends GenericHibernateDAO implements BusquedaDatosTicketDAO { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(BusquedaDatosTicketHibernateDAO.class); + private List vendapacoteIds; + + @Autowired + public BusquedaDatosTicketHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaDatosTickets(Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal) { + vendapacoteIds = null; + List pacotes = new ArrayList(); + + try { + pacotes = carregarDadosPacotes(fecInicial, fecFinal, fecVentaInicial, fecVentaFinal); + if(!pacotes.isEmpty()) { + carregarDadosPagamento(pacotes); + carregarDadosServico(pacotes); + carregarDadosPassageiros(pacotes); + carregarDadosCliente(pacotes); + carregarDadosEnderecoApanhe(pacotes); + carregarDadosItemPacotes(pacotes); + } + + } catch(Exception e) { + log.error(e.getMessage(), e); + pacotes.clear(); + } + + return pacotes; + } + + @SuppressWarnings("unchecked") + private List carregarDadosPacotes(Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT VP.VENDAPACOTE_ID, VP.DATAPACOTE, VP.DATAVENDA, VP.SUBTOTAL, VP.TOTAL, VP.DESCONTO, VP.NUMOPERACION, P.PACOTE_ID, ") + .append("P.NOMPACOTE, P.DESCPACOTE, E.NOMBEMPRESA, VP.SITUACAO, PV.NOMBPUNTOVENTA, VP.USUARIO_ID, ") + .append("COUNT(TVP.TARIFAVENDAPACOTE_ID) AS QTDEPASSAGEIRO, ") + .append("SUM(B.PRECIOPAGADO) AS TOTALTARIFA, ") + .append("SUM(B.IMPORTETAXAEMBARQUE) AS TOTALTAXAEMBARQUE, ") + .append("SUM(B.IMPORTEPEDAGIO) AS TOTALPEDAGIO, ") + .append("SUM(B.IMPORTEOUTROS) AS TOTALOUTROS, ") + .append("SUM(B.IMPORTESEGURO) AS TOTALSEGURO, ") + .append("(SELECT COUNT(DISTINCT PFP.PACOTEFORMAPAGO_ID) FROM PACOTE_FORMAPAGO PFP WHERE PFP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID) AS QTDEPACOTEFORMAPAGO ") + .append("FROM VENDA_PACOTE VP ") + .append("JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID ") + .append("JOIN EMPRESA E ON E.EMPRESA_ID = P.EMPRESA_ID ") + .append("LEFT JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = VP.PUNTOVENTA_ID ") + .append("LEFT JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") + .append("WHERE (B.BOLETO_ID IS NULL OR B.INDSTATUSBOLETO = 'V') ") + .append("AND VP.DATAPACOTE BETWEEN :fecInicial AND :fecFinal "); + + if(fecVentaInicial != null) { + sQuery.append("AND VP.DATAVENDA >= :fecVentaInicial "); + } + if(fecVentaFinal != null) { + sQuery.append("AND VP.DATAVENDA <= :fecVentaFinal "); + } + + sQuery.append("GROUP BY VP.VENDAPACOTE_ID, VP.DATAPACOTE, VP.DATAVENDA, VP.SUBTOTAL, VP.TOTAL, ") + .append("VP.DESCONTO, VP.NUMOPERACION, P.PACOTE_ID, P.NOMPACOTE, P.DESCPACOTE, E.NOMBEMPRESA, VP.SITUACAO, PV.NOMBPUNTOVENTA, VP.USUARIO_ID "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("DATAPACOTE", DateType.INSTANCE) + .addScalar("DATAVENDA", TimestampType.INSTANCE) + .addScalar("SUBTOTAL", BigDecimalType.INSTANCE) + .addScalar("TOTAL", BigDecimalType.INSTANCE) + .addScalar("DESCONTO", BigDecimalType.INSTANCE) + .addScalar("NUMOPERACION", StringType.INSTANCE) + .addScalar("PACOTE_ID", LongType.INSTANCE) + .addScalar("NOMPACOTE", StringType.INSTANCE) + .addScalar("DESCPACOTE", StringType.INSTANCE) + .addScalar("NOMBEMPRESA", StringType.INSTANCE) + .addScalar("SITUACAO", IntegerType.INSTANCE) + .addScalar("NOMBPUNTOVENTA", StringType.INSTANCE) + .addScalar("USUARIO_ID", IntegerType.INSTANCE) + .addScalar("QTDEPASSAGEIRO", IntegerType.INSTANCE) + .addScalar("TOTALTARIFA", BigDecimalType.INSTANCE) + .addScalar("TOTALTAXAEMBARQUE", BigDecimalType.INSTANCE) + .addScalar("TOTALPEDAGIO", BigDecimalType.INSTANCE) + .addScalar("TOTALOUTROS", BigDecimalType.INSTANCE) + .addScalar("TOTALSEGURO", BigDecimalType.INSTANCE) + .addScalar("QTDEPACOTEFORMAPAGO", IntegerType.INSTANCE); + + query.setResultTransformer(new DatosTicketResultTransformer()); + query.setParameter("fecInicial", fecInicial, DateType.INSTANCE) + .setParameter("fecFinal", fecFinal, DateType.INSTANCE); + + if(fecVentaInicial != null) { + query.setParameter("fecVentaInicial", fecVentaInicial, TimestampType.INSTANCE); + } + if(fecVentaFinal != null) { + query.setParameter("fecVentaFinal", fecVentaFinal, TimestampType.INSTANCE); + } + + return query.list(); + } + + @SuppressWarnings("unchecked") + private void carregarDadosPagamento(List pacotes) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT PFP.PACOTEFORMAPAGO_ID, PFP.VALOR, PFP.VENDAPACOTE_ID, FP.FORMAPAGO_ID, FP.DESCPAGO, CT.TIPOTARJETA, CT.NUMAUTORIZACION, CT.CANTPARCELAS, ") + .append("NC.NOTACREDITOVENDAPACOTE_ID, VPC.NUMOPERACION AS NUMOPERACAOPACOTECANCELAMENTO ") + .append("FROM PACOTE_FORMAPAGO PFP ") + .append("JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = PFP.FORMAPAGO_ID ") + .append("LEFT JOIN CAJA_DIVERSOS CD ON CD.VENDAPACOTE_ID = PFP.VENDAPACOTE_ID ") + .append("LEFT JOIN CAJA_DIVERSOS_PAGO CDP ON CDP.CAJADIVERSOS_ID = CD.CAJADIVERSOS_ID ") + .append("LEFT JOIN CAJA_TARJETA CT ON CT.CAJATARJETA_ID = CDP.CAJATARJETA_ID ") + .append("LEFT JOIN NOTA_CREDITO_VENDA_PACOTE NC ON NC.VENDAPACOTEPAGAMENTO_ID = PFP.VENDAPACOTE_ID ") + .append("LEFT JOIN VENDA_PACOTE VPC ON NC.VENDAPACOTECANCELAMENTO_ID = VPC.VENDAPACOTE_ID ") + .append("WHERE PFP.VENDAPACOTE_ID IN (:vendapacoteIds) ") + .append("ORDER BY PFP.VENDAPACOTE_ID"); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("PACOTEFORMAPAGO_ID", LongType.INSTANCE) + .addScalar("VALOR", BigDecimalType.INSTANCE) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("FORMAPAGO_ID", IntegerType.INSTANCE) + .addScalar("DESCPAGO", StringType.INSTANCE) + .addScalar("TIPOTARJETA", StringType.INSTANCE) + .addScalar("NUMAUTORIZACION", StringType.INSTANCE) + .addScalar("CANTPARCELAS", IntegerType.INSTANCE) + .addScalar("NOTACREDITOVENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("NUMOPERACAOPACOTECANCELAMENTO", StringType.INSTANCE); + + query.setResultTransformer(new DatosPagamentoResultTransformer()); + query.setParameterList("vendapacoteIds", getVendapacoteIds(pacotes)); + + List pagamentos = query.list(); + for (PacoteVO pacote : pacotes) { + int flag = -1; + for (PagamentoVO pagamento : pagamentos) { + if(pagamento.getVendapacoteId().equals(pacote.getVendapacoteId())) { + flag = 0; + if(pacote.getFormaspagamento() == null) { + pacote.setFormaspagamento(new ArrayList()); + } + + if(isPacoteReserva(pacote) && isPagamentoPacoteReserva(pagamento) || + (isPagamentoPacoteReserva(pagamento) && pacote.getQtdePacoteFormaspago() == 1) || + (!isPacoteReserva(pacote) && !isPagamentoPacoteReserva(pagamento))) { + pacote.getFormaspagamento().add(pagamento); + } + } else if(flag == 0){ + break; + } + } + } + } + + private boolean isPacoteReserva(PacoteVO pacote) { + return SituacaoVendaPacote.RESERVA.toString().equals(pacote.getStatus()); + } + + private boolean isPagamentoPacoteReserva(PagamentoVO pagamento) { + return pagamento.getFormapagoId().equals(Constantes.FORMA_PAGO_RESERVA.intValue()); + } + + @SuppressWarnings("unchecked") + private void carregarDadosServico(List pacotes) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT VP.VENDAPACOTE_ID, B.FECHORVIAJE, B.ORIGEN_ID, CONCAT(CONCAT(ORI.CVEPARADA,' - '),ORI.DESCPARADA) AS ORIGEM, CONCAT(CONCAT(DES.CVEPARADA,' - '),DES.DESCPARADA) AS DESTINO ") + .append("FROM VENDA_PACOTE VP ") + .append("JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID ") + .append("JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") + .append("JOIN PARADA ORI ON ORI.PARADA_ID = B.ORIGEN_ID ") + .append("JOIN PARADA DES ON DES.PARADA_ID = B.DESTINO_ID ") + .append("WHERE VP.VENDAPACOTE_ID IN (:vendapacoteIds) "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("FECHORVIAJE", TimestampType.INSTANCE) + .addScalar("ORIGEN_ID", IntegerType.INSTANCE) + .addScalar("ORIGEM", StringType.INSTANCE) + .addScalar("DESTINO", StringType.INSTANCE); + + query.setResultTransformer(new DatosServicoResultTransformer()); + query.setParameterList("vendapacoteIds", getVendapacoteIds(pacotes)); + + List servicos = query.list(); + for (PacoteVO pacote : pacotes) { + for (ServicoVO servico : servicos) { + if(servico.getVendapacoteId().equals(pacote.getVendapacoteId())) { + pacote.setServico(servico); + break; + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosCliente(List pacotes) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT VP.VENDAPACOTE_ID, CP.RAZAO_SOCIAL, CP.CPF_CNPJ, CP.TIPO_PESSOA, CP.DESCEMAIL, CP.DESCTELEFONE, CP.DESCFAX, CP.CEP, CP.ENDERECO, CP.NUMERO, CP.COMPLEMENTO, CP.PAIS, CP.ESTADO, CP.CIDADE, CP.BAIRRO ") + .append("FROM CLIENTE_PACOTE CP ") + .append("JOIN VENDA_PACOTE VP ON CP.CLIENTEPACOTE_ID = VP.CLIENTEPACOTE_ID ") + .append("WHERE VP.VENDAPACOTE_ID IN (:vendapacoteIds) "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("RAZAO_SOCIAL", StringType.INSTANCE) + .addScalar("CPF_CNPJ", StringType.INSTANCE) + .addScalar("TIPO_PESSOA", IntegerType.INSTANCE) + .addScalar("DESCEMAIL", StringType.INSTANCE) + .addScalar("DESCTELEFONE", StringType.INSTANCE) + .addScalar("DESCFAX", StringType.INSTANCE) + .addScalar("CEP", StringType.INSTANCE) + .addScalar("ENDERECO", StringType.INSTANCE) + .addScalar("NUMERO", StringType.INSTANCE) + .addScalar("COMPLEMENTO", StringType.INSTANCE) + .addScalar("PAIS", StringType.INSTANCE) + .addScalar("ESTADO", StringType.INSTANCE) + .addScalar("CIDADE", StringType.INSTANCE) + .addScalar("BAIRRO", StringType.INSTANCE); + + query.setResultTransformer(new DatosClientePacoteResultTransformer()); + query.setParameterList("vendapacoteIds", getVendapacoteIds(pacotes)); + + List clientesPacotes = query.list(); + for (PacoteVO pacote : pacotes) { + for (ClientePacoteVO clientePacote : clientesPacotes) { + if(clientePacote.getVendapacoteId().equals(pacote.getVendapacoteId())) { + pacote.setClientePacote(clientePacote); + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosPassageiros(List pacotes) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT VP.VENDAPACOTE_ID, TVP.TARIFAVENDAPACOTE_ID, TVP.NOMEPASSAGEIRO, CONCAT(CONCAT(TVP.TIPODOC,' - '), TVP.DOCUMENTO) AS DOCUMENTO, B.NUMASIENTO, C.CATEGORIA_ID, C.DESCCATEGORIA, B.BOLETO_ID ") + .append("FROM VENDA_PACOTE VP ") + .append("JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") + .append("LEFT JOIN CATEGORIA C ON C.CATEGORIA_ID = B.CATEGORIA_ID ") + .append("WHERE VP.VENDAPACOTE_ID IN (:vendapacoteIds) "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("BOLETO_ID", LongType.INSTANCE) + .addScalar("TARIFAVENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("NOMEPASSAGEIRO", StringType.INSTANCE) + .addScalar("DOCUMENTO", StringType.INSTANCE) + .addScalar("NUMASIENTO", StringType.INSTANCE) + .addScalar("CATEGORIA_ID", IntegerType.INSTANCE) + .addScalar("DESCCATEGORIA", StringType.INSTANCE); + + query.setResultTransformer(new DatosPassageiroResultTransformer()); + query.setParameterList("vendapacoteIds", getVendapacoteIds(pacotes)); + + List passageiros = query.list(); + for (PacoteVO pacote : pacotes) { + for (PassageiroVO passageiro : passageiros) { + if(passageiro.getVendapacoteId().equals(pacote.getVendapacoteId())) { + if(pacote.getPax() == null) { + pacote.setPax(new ArrayList()); + } + pacote.getPax().add(passageiro); + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosEnderecoApanhe(List pacotes) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT VP.VENDAPACOTE_ID, EA.LOCAL, EA.DESCHOTEL, EA.CEP, EA.ENDERECO, EA.NUMERO, EA.COMPLEMENTO, EA.CIDADE, EA.BAIRRO, EA.REFERENCIA ") + .append("FROM ENDERECO_APANHE EA ") + .append("JOIN VENDA_PACOTE VP ON EA.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("WHERE VP.VENDAPACOTE_ID IN (:vendapacoteIds) ") + .append("AND EA.ACTIVO = 1"); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("LOCAL", IntegerType.INSTANCE) + .addScalar("CEP", StringType.INSTANCE) + .addScalar("ENDERECO", StringType.INSTANCE) + .addScalar("NUMERO", StringType.INSTANCE) + .addScalar("COMPLEMENTO", StringType.INSTANCE) + .addScalar("CIDADE", StringType.INSTANCE) + .addScalar("BAIRRO", StringType.INSTANCE) + .addScalar("REFERENCIA", StringType.INSTANCE); + + query.setResultTransformer(new DatosEnderecoApanheResultTransformer()); + query.setParameterList("vendapacoteIds", getVendapacoteIds(pacotes)); + + List enderecosApanhe = query.list(); + for (PacoteVO pacote : pacotes) { + for (EnderecoApanheVO enderecoApanhe : enderecosApanhe) { + if(enderecoApanhe.getVendapacoteId().equals(pacote.getVendapacoteId())) { + pacote.setEnderecoApanhe(enderecoApanhe); + } + } + } + } + + private List getVendapacoteIds(List pacotes) { + if(vendapacoteIds == null || vendapacoteIds.isEmpty()) { + vendapacoteIds = new ArrayList(); + for (PacoteVO pacoteVO : pacotes) { + vendapacoteIds.add(pacoteVO.getVendapacoteId()); + } + } + + return vendapacoteIds; + } + + @SuppressWarnings("unchecked") + private void carregarDadosItemPacotes(List pacotes) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT IA.DESCITEMADICIONAL, VP.VENDAPACOTE_ID, PI.ITEMADICIONAL_ID ") + .append("FROM ITEM_ADICIONAL IA ") + .append("JOIN PACOTE_ITEM PI ON IA.ITEMADICIONAL_ID = PI.ITEMADICIONAL_ID ") + .append("JOIN PACOTE P ON P.PACOTE_ID = PI.PACOTE_ID ") + .append("JOIN VENDA_PACOTE VP ON VP.PACOTE_ID = P.PACOTE_ID ") + .append("WHERE IA.ACTIVO = 1 ") + .append("AND VP.VENDAPACOTE_ID IN (:vendapacoteIds) "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("DESCITEMADICIONAL", StringType.INSTANCE) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("ITEMADICIONAL_ID", LongType.INSTANCE); + + query.setResultTransformer(new DatosItemAdicionalResultTransformer()); + query.setParameterList("vendapacoteIds", getVendapacoteIds(pacotes)); + + List itens = query.list(); + for (PacoteVO pacote : pacotes) { + for (ItemAdicionalVO itemAdicional : itens) { + if(itemAdicional.getVendapacoteId().equals(pacote.getVendapacoteId())) { + if(pacote.getItens() == null) { + pacote.setItens(new ArrayList()); + } + pacote.getItens().add(itemAdicional); + } + } + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CajaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CajaHibernateDAO.java new file mode 100644 index 000000000..16516e6bf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CajaHibernateDAO.java @@ -0,0 +1,385 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaFormapagoException; +import com.rjconsultores.ventaboletos.vo.caja.CajaCerradoVO; +import com.rjconsultores.ventaboletos.vo.caja.CajaVO; +import com.rjconsultores.ventaboletos.vo.caja.ReceitaDespesaVO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; + +@Repository("cajaDAO") +public class CajaHibernateDAO extends GenericHibernateDAO implements CajaDAO { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(CajaHibernateDAO.class); + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public CajaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta) { + List list = new ArrayList(); + HashMap map = new HashMap(); + + String sqlBuscarCajaFecha = sqlBuilder.getSQLBuscarCajaFecha(yaCerrado, fechaDesde, fechaHasta); + SQLQuery sql = getSession().createSQLQuery(sqlBuscarCajaFecha) + .addScalar("cajaId", LongType.INSTANCE) + .addScalar("numAsiento", StringType.INSTANCE) + .addScalar("categoriaId", IntegerType.INSTANCE) + .addScalar("numFolioSistema", StringType.INSTANCE) + .addScalar("claseServicioId", IntegerType.INSTANCE) + .addScalar("marcaId", IntegerType.INSTANCE) + .addScalar("origenId", IntegerType.INSTANCE) + .addScalar("destinoId", IntegerType.INSTANCE) + .addScalar("corridaId", IntegerType.INSTANCE) + .addScalar("fecCorrida", DateType.INSTANCE) + .addScalar("nombPasajero", StringType.INSTANCE) + .addScalar("precioBase", BigDecimalType.INSTANCE) + .addScalar("precioPagado", BigDecimalType.INSTANCE) + .addScalar("tipoVentaId", IntegerType.INSTANCE) + .addScalar("numSeriePreimpresa", StringType.INSTANCE) + .addScalar("numFolioPreImpreso", StringType.INSTANCE) + .addScalar("fecHorViaje", DateType.INSTANCE) + .addScalar("fecHorVenta", DateType.INSTANCE) + .addScalar("puntoVentaId", IntegerType.INSTANCE) + .addScalar("numPuntoVenta", StringType.INSTANCE) + .addScalar("numKmViaje", BigDecimalType.INSTANCE) + .addScalar("numOperacion", StringType.INSTANCE) + .addScalar("motivoCancelacionId", IntegerType.INSTANCE) + .addScalar("empresaPuntoVentaId", IntegerType.INSTANCE) + .addScalar("empresaCorridaId", IntegerType.INSTANCE) + .addScalar("turnoId", IntegerType.INSTANCE) + .addScalar("importeTaxaEmbarque", BigDecimalType.INSTANCE) + .addScalar("importePedagio", BigDecimalType.INSTANCE) + .addScalar("importeOutros", BigDecimalType.INSTANCE) + .addScalar("importeSeguro", BigDecimalType.INSTANCE) + .addScalar("rutaId", IntegerType.INSTANCE) + .addScalar("usuarioId", IntegerType.INSTANCE) + .addScalar("numAutorizacion", StringType.INSTANCE) + .addScalar("ordenSevicio", StringType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(CajaVO.class)); + + for (CajaVO cv : (List) sql.list()) { + if (map.containsKey(cv.getCajaId()) && map.get(cv.getCajaId()).getImporteTaxaEmbarque() != null && + !map.get(cv.getCajaId()).getImporteTaxaEmbarque().equals(0)) { + cv.setImporteTaxaEmbarque(new BigDecimal(0)); + } else { + map.put(cv.getCajaId(), cv); + } + list.add(cv); + } + + return list; + } + + public List buscarCajaCerrado(Date fecha, String cveusuario, String turnoid) { + return buscarCajaCerrado(fecha, cveusuario, turnoid, false); + } + + @Override + public List buscarUsuarioCerrado(Date fecha) { + return buscarCajaCerrado(fecha, "*", "*", true); + } + + private List buscarCajaCerrado(Date fecha, String cveusuario, String turnoid, boolean sinDatosCaja) { + List list = new ArrayList(); + HashMap map = new HashMap(); + + try { + String sqlBuscarUsuariosCajaCerrado = sqlBuilder.getSQLBuscarUsuariosCajaCerrado(fecha, cveusuario, turnoid); + + SQLQuery sql = getSession().createSQLQuery(sqlBuscarUsuariosCajaCerrado) + .addScalar("usuarioId", IntegerType.INSTANCE) + .addScalar("cveusuario", StringType.INSTANCE) + .addScalar("puntoVentaId", IntegerType.INSTANCE) + .addScalar("numPuntoVenta", StringType.INSTANCE) + .addScalar("fecCorte", DateType.INSTANCE) + .addScalar("turnoId", IntegerType.INSTANCE) + .addScalar("importeTotal", BigDecimalType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(UsuarioVO.class)); + + List usuarios = sql.list(); + if (sinDatosCaja) { + return usuarios; + } + for (UsuarioVO u : usuarios) { + String sqlBuscarCajaFecha = sqlBuilder.getSQLBuscarCajaCerrado(u.getUsuarioId(), fecha, turnoid); + + sql = getSession().createSQLQuery(sqlBuscarCajaFecha) + .addScalar("cajaId", LongType.INSTANCE) + .addScalar("numFolioSistema", StringType.INSTANCE) + .addScalar("origen", StringType.INSTANCE) + .addScalar("destino", StringType.INSTANCE) + .addScalar("corridaId", IntegerType.INSTANCE) + .addScalar("precioPagado", BigDecimalType.INSTANCE) + .addScalar("fecHorVenta", DateType.INSTANCE) + .addScalar("importeTaxaEmbarque", BigDecimalType.INSTANCE) + .addScalar("ruta", StringType.INSTANCE) + .addScalar("numAutorizacion", StringType.INSTANCE) + .addScalar("ordenSevicio", StringType.INSTANCE) + .addScalar("secretaria", StringType.INSTANCE) + .addScalar("cvesecretaria", StringType.INSTANCE) + .addScalar("emissorTarjeta", StringType.INSTANCE) + .addScalar("tipoPasaje", StringType.INSTANCE) + .addScalar("formaPago", StringType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(CajaCerradoVO.class)); + + for (CajaCerradoVO cv : (List) sql.list()) { + if (map.containsKey(cv.getCajaId()) && map.get(cv.getCajaId()).getImporteTaxaEmbarque() != null && + !map.get(cv.getCajaId()).getImporteTaxaEmbarque().equals(0)) { + cv.setImporteTaxaEmbarque(new BigDecimal(0)); + } else { + map.put(cv.getCajaId(), cv); + } + list.add(cv); + } + + u.setPasajes(list); + + String sqlBuscarReceitaDespesa = sqlBuilder.getSQLBuscarReceitasDespesasCaja(u.getUsuarioId(), fecha); + sql = getSession().createSQLQuery(sqlBuscarReceitaDespesa) + .addScalar("precio", BigDecimalType.INSTANCE) + .addScalar("tipoEvento", StringType.INSTANCE); + sql.setResultTransformer(new AliasToBeanResultTransformer(ReceitaDespesaVO.class)); + u.setDiversos((List) sql.list()); + } + return usuarios; + } catch (Exception e) { + log.error("", e); + + return null; + } + } + + @Override + @Transactional(rollbackFor={BusinessException.class,VendaEmbarcadaBoletoException.class,VendaEmbarcadaBoletoFormapagoException.class,VendaEmbarcadaCajaException.class,VendaEmbarcadaCajaFormapagoException.class}) + public void gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException, VendaEmbarcadaBoletoFormapagoException, VendaEmbarcadaCajaException, VendaEmbarcadaCajaFormapagoException { + inserirBoletoVendaEmbarcada(vendaEmbarcada); + inserirBoletoFormaPagoVendaEmbarcada(vendaEmbarcada); + inserirCajaVendaEmbarcada(vendaEmbarcada); + inserirCajaFormaPagoVendaEmbarcada(vendaEmbarcada); + } + + private void inserirCajaVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaCajaException{ + + try { + + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirCajaVendaEmbarcada()); + + vendaEmbarcada.setCajaId(obterIdCaja().longValue()); + + query.setLong("cajaId", vendaEmbarcada.getCajaId()); + query.setString("numAsiento", vendaEmbarcada.getNumAsiento()); + query.setInteger("categoriaId", vendaEmbarcada.getCategoriaId()); + query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId()); + query.setInteger("marcaId",vendaEmbarcada.getMarcaId()); + query.setInteger("origemId",vendaEmbarcada.getOrigemId()); + query.setInteger("destinoId",vendaEmbarcada.getDestinoId()); + query.setInteger("corridaId",vendaEmbarcada.getCorridaId()); + query.setDate("fecCorrida",vendaEmbarcada.getFecCorrida()); + query.setBigDecimal("precioBase",vendaEmbarcada.getPrecio()); + query.setBigDecimal("precioPagado",vendaEmbarcada.getPrecio()); + query.setInteger("tipoVentaId",vendaEmbarcada.getTipoVentaId()); + query.setDate("fechorViaje",vendaEmbarcada.getFechorViaje()); + query.setDate("fechorVenta",vendaEmbarcada.getFechorVenta()); + query.setInteger("puntoVentaId",vendaEmbarcada.getPuntoVentaId()); + query.setString("numOperacion",vendaEmbarcada.getNumOperacion()); + query.setBigInteger("empresaPuntoVentaId",vendaEmbarcada.getEmpresaId()); + query.setBigInteger("empresaCorridaId",vendaEmbarcada.getEmpresaId()); + query.setInteger("estacionId",vendaEmbarcada.getEstacionId()); + query.setInteger("usuarioId",vendaEmbarcada.getUsuarioId()); + query.setBigDecimal("importeTaxaEmbarque",vendaEmbarcada.getImporteTaxaEmbarque()); + query.setBigDecimal("importePedagio",vendaEmbarcada.getImportePedagio()); + query.setBigDecimal("importeOutros",vendaEmbarcada.getImporteOutros()); + query.setBigDecimal("importeSeguro",vendaEmbarcada.getImporteSeguro()); + query.setDate("fecCreacion", vendaEmbarcada.getFechorVenta()); + query.setInteger("rutaId", vendaEmbarcada.getRutaId()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaCajaException("Erro ao gerar caixa venda embarcada"); + } + + } catch (VendaEmbarcadaCajaException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaCajaException(e.getMessage(), e); + } + + } + + private void inserirCajaFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaCajaFormapagoException { + try { + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirCajaFormaPagoVendaEmbarcada()); + + query.setInteger("formaPagoId", vendaEmbarcada.getFormaPagoId()); + query.setLong("cajaId", vendaEmbarcada.getCajaId()); + query.setBigDecimal("importe", vendaEmbarcada.getPrecio()); + query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId()); + query.setLong("cajaFormaPagoId", obterIdCajaFormaPago().longValue()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaCajaFormapagoException("Erro ao gerar forma de pagamento do caixa venda embarcada"); + } + + } catch (VendaEmbarcadaCajaFormapagoException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaCajaFormapagoException(e.getMessage(), e); + } + } + + private void inserirBoletoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException { + try { + + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoVendaEmbarcada()); + + vendaEmbarcada.setBoletoId(obterIdBoleto().longValue()); + vendaEmbarcada.setNumOperacion(obterNumOperacion().toString()); + + query.setBigInteger("empresaCorridaId", vendaEmbarcada.getEmpresaId()); + query.setInteger("destinoId", vendaEmbarcada.getDestinoId()); + query.setInteger("tipoVentaId",vendaEmbarcada.getTipoVentaId()); + query.setInteger("categoriaId",vendaEmbarcada.getCategoriaId()); + query.setInteger("corridaId", vendaEmbarcada.getCorridaId()); + query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId()); + query.setDate("fecCorrida", vendaEmbarcada.getFecCorrida()); + query.setInteger("puntoVentaId", vendaEmbarcada.getPuntoVentaId()); + query.setBigInteger("empresaPuntoVentaId", vendaEmbarcada.getEmpresaId()); + query.setInteger("origemId", vendaEmbarcada.getOrigemId()); + query.setInteger("marcaId", vendaEmbarcada.getMarcaId()); + query.setString("numAsiento", vendaEmbarcada.getNumAsiento()); + query.setBigDecimal("precioPagado", vendaEmbarcada.getPrecio()); + query.setDate("fechorViaje", vendaEmbarcada.getFechorViaje()); + query.setDate("fechorVenta", vendaEmbarcada.getFechorVenta()); + query.setString("numOperacion", vendaEmbarcada.getNumOperacion()); + query.setInteger("usuarioId",vendaEmbarcada.getUsuarioId()); + query.setBigDecimal("precioBase", vendaEmbarcada.getPrecio()); + query.setInteger("estacionId", vendaEmbarcada.getEstacionId()); + query.setBigDecimal("importeTaxaEmbarque", vendaEmbarcada.getImporteTaxaEmbarque()); + query.setBigDecimal("importePedagio", vendaEmbarcada.getImportePedagio()); + query.setBigDecimal("importeOutros", vendaEmbarcada.getImporteOutros()); + query.setBigDecimal("importeSeguro", vendaEmbarcada.getImporteSeguro()); + query.setInteger("rutaId", vendaEmbarcada.getRutaId()); + query.setLong("boletoId", vendaEmbarcada.getBoletoId()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + query.setBigDecimal("precioPricing", vendaEmbarcada.getPrecio()); + query.setString("numFolioPreimpresso", vendaEmbarcada.getNumFolioPreimpresso()); + query.setString("serieImpFiscal", vendaEmbarcada.getSerieImpFiscal()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaBoletoException("Erro ao gerar boleto venda embarcada"); + } + + } catch (VendaEmbarcadaBoletoException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaBoletoException(e.getMessage(), e); + } + } + + private void inserirBoletoFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoFormapagoException{ + try { + + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoFormaPagoVendaEmbarcada()); + + query.setInteger("formaPagoId", vendaEmbarcada.getFormaPagoId()); + query.setLong("boletoId", vendaEmbarcada.getBoletoId()); + query.setBigDecimal("importe", vendaEmbarcada.getPrecio()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId()); + query.setBigDecimal("boletoFormaPagoId", obterIdBoletoFormaPago()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaBoletoFormapagoException("Erro ao gerar forma de pagamento do boleto venda embarcada"); + } + + } catch (VendaEmbarcadaBoletoFormapagoException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaBoletoFormapagoException(e.getMessage(), e); + } + } + + private BigDecimal obterIdBoletoFormaPago(){ + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceBoletoFormaPago()); + + return gerarChave((BigDecimal)sql.uniqueResult()); + } + + private BigDecimal obterIdCajaFormaPago(){ + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago()); + + return gerarChave((BigDecimal)sql.uniqueResult()); + } + + private BigDecimal obterIdBoleto(){ + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago()); + + return gerarChave((BigDecimal)sql.uniqueResult()); + } + + private BigDecimal obterIdCaja(){ + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCaja()); + + return gerarChave((BigDecimal)sql.uniqueResult()); + } + + private BigDecimal obterNumOperacion(){ + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenciaNumOperacion()); + + return gerarChave((BigDecimal)sql.uniqueResult()); + } + + private BigDecimal gerarChave(BigDecimal seq){ + Integer tamChave = 13; + + String chave = "1"; + + --tamChave; + + while ((seq.toString().length() + chave.length()) <= (tamChave)){ + chave += "0"; + } + + return new BigDecimal(chave += seq); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java new file mode 100644 index 000000000..4ce5cddd7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java @@ -0,0 +1,363 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("calcularPeajeDAO") +public class CalcularPeajeHibernateDAO extends GenericHibernateDAO implements CalcularPeajeDAO{ + + @Autowired + public CalcularPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc){ + + StringBuilder sql = new StringBuilder(); + sql.append(" select distinct r from Ruta r , RutaCaseta rc , RutaSecuencia rs , CasetaPeaje cp "); + sql.append(" where rc.rutaSecuencia.rutasecuenciaId = rs.rutasecuenciaId "); + sql.append(" and rc.casetaPeaje.casetaPeajeId = cp.casetaPeajeId "); + sql.append(" and rs.ruta.rutaId = r.rutaId "); + if(oc != null && oc.getOrgaoConcedenteId() != null){ + sql.append(" and r.orgaoConcedente.orgaoConcedenteId = :orgaoConcedenteId "); + } + + sql.append(" order by r.descruta "); + + Query query = getSession().createQuery(sql.toString()); + + if(oc != null && oc.getOrgaoConcedenteId() != null){ + query.setInteger("orgaoConcedenteId", oc.getOrgaoConcedenteId()); + } + return (List)query.list(); + } + + @Override + public List buscarCasetasPeajeWithinTramo(Ruta ruta){ + + StringBuilder sql = new StringBuilder(); + + sql.append(" with temp_table as ( "); + sql.append(" select tra.origen_id as orig , tra.DESTINO_ID as dest, tra.tramo_id as tra, tra.desctramo as traDesc, tra.origen_id as traorig, "); + sql.append(" tra.destino_id as tradest, tra.via_id as travia, tra.cantkmreal as tracantkm, "); + sql.append(" tra.cantkmpagoconductor as tracantkmpago, tra.activo as traactivo, tra.fecmodif as trafecmodif, tra.usuario_id as trausuario "); + sql.append(" from RUTA_COMBINACION rcom inner join ruta r on r.RUTA_ID = rcom.RUTA_ID "); + sql.append(" inner join ORGAO_CONCEDENTE oc on oc.ORGAOCONCEDENTE_ID = r.ORGAOCONCEDENTE_ID "); + sql.append(" inner join tramo tra on tra.tramo_id = rcom.tramo_id "); + sql.append(" where r.RUTA_ID = :rutaId "); + sql.append(" ) , "); //select * from temp_table + sql.append(" "); + sql.append(" myTable as ( "); + sql.append(" select rseq3.numsecuencia as origen_tramo_inicial_seq , rseq4.numsecuencia as destino_tramo_final_seq , T.tramo_id as ttramo, t2.tramo_id as tt2tramo , tt.tra as traComb, tt.orig as ttorig, tt.dest as ttdest, "); + sql.append(" tt.tradesc as traCombdesc, tt.traorig as traComborig, tt.tradest as traCombdest, tt.travia as tracombvia, tt.tracantkm as tracombcantkm, "); + sql.append(" tt.tracantkmpago as tracombcantkmpago, tt.traactivo as tracombactivo, tt.trafecmodif as tracombfecmodif, tt.trausuario as tracombusuario "); + sql.append(" from ruta_secuencia rseq3 "); + sql.append(" inner join tramo t on t.tramo_id = rseq3.tramo_id and rseq3.ruta_id = :rutaId "); + sql.append(" INNER JOIN ruta_secuencia rseq4 ON rseq3.ruta_id = rseq4.ruta_id "); + sql.append(" INNER JOIN TRAMO T2 ON T2.TRAMO_ID = rseq4.tramo_id and rseq4.ruta_id = :rutaId "); + sql.append(" inner join temp_table tt on t.ORIGEN_ID = tt.orig and T2.DESTINO_ID = tt.dest "); +// sql.append(" -- and t.ORIGEN_ID = 19231 "); +// sql.append(" -- AND T2.DESTINO_ID = 21708 "); + sql.append(" ) , "); + sql.append(" "); //select * from myTable + sql.append(" caseta_tramo_da_ruta as ( "); + sql.append(" select rcas.rutacaseta_id as rutacasetaid, rcas.rutasecuencia_id as rutasecuenciaId, rcas.casetaPeaje_Id, rseq.numSecuencia as numSecuencia, rseq.tramo_id as tramoid, rseq2.numSecuencia as numSecuencia2, "); + sql.append(" casp.casetaPeaje_id as casetaPeajeid, casp.desccaseta as desccaseta, casp.importeida as importeida, casp.importevuelta as importevuelta, casp.activo as caspActivo, "); + sql.append(" casp.fecmodif as caspfecmodif, casp.usuario_id as caspusuario "); + sql.append(" from RUTA_CASETA rcas inner join RUTA_SECUENCIA rseq on rcas.RUTASECUENCIA_ID = rseq.RUTASECUENCIA_ID "); + sql.append(" inner join RUTA_SECUENCIA rseq2 on rseq2.TRAMO_ID = rseq.TRAMO_ID "); + sql.append(" inner join tramo tra on tra.tramo_id = rseq.TRAMO_ID and rseq.ruta_id = :rutaId "); + sql.append(" inner join caseta_peaje casp on casp.casetapeaje_id = rcas.casetapeaje_id "); + sql.append(" ) "); + sql.append(" select distinct "); + sql.append(" origen_tramo_inicial_seq, destino_tramo_final_seq, ttramo, tt2tramo, traComb, ttorig, ttdest, traCombdesc, traComborig, traCombdest, tracombvia, tracombcantkm, tracombcantkmpago, tracombactivo, tracombfecmodif, tracombusuario, rutacasetaid, rutasecuenciaId, casetaPeaje_Id, tramoid, casetaPeajeid, desccaseta, importeida, importevuelta, caspActivo, caspfecmodif, caspusuario "); + sql.append(" from myTable my inner join caseta_tramo_da_ruta ctr on ctr.numSecuencia between my.origen_tramo_inicial_seq and my.destino_tramo_final_seq order by tracomb "); + + + Query query = getSession().createSQLQuery(sql.toString()); + query.setInteger("rutaId", ruta.getRutaId()); + query.setInteger("rutaId", ruta.getRutaId()); + query.setInteger("rutaId", ruta.getRutaId()); + query.setInteger("rutaId", ruta.getRutaId()); + + return query.list(); + + + +// return new ArrayList(); + } + + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao){ + + int[] retorno = {}; + //pra cada ruta obter as combinacoes de tramos, cada tramo com sua lista de casetaPeaje + + + StringBuilder updateSQL = new StringBuilder(); + updateSQL.append(" update PEAJE set activo = 0 where ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()).append(" "); + + List lsSql = new ArrayList(); + + for(Ruta r : lsRuta){ + List lsObj = buscarCasetasPeajeWithinTramo(r); + if(null != lsObj && 0 != lsObj.size()){ + + for(Object oArr : lsObj){ + StringBuilder insertSQL = new StringBuilder(); + + Object o[] = (Object[])oArr; + + PeajeVO pvo = new PeajeVO(); +// pvo.setPeajeId(o[]); + pvo.setRutaId(r.getRutaId()); + pvo.setOrigenId(Integer.parseInt(""+o[8])); + pvo.setDestinoId(Integer.parseInt(""+o[9])); + pvo.setOrgaoId(orgao.getOrgaoConcedenteId()); + pvo.setCasetaPeajeId(Integer.parseInt(""+o[20]));// + pvo.setCantAsientos(r.getCantAsientos()); + pvo.setCantEixos(r.getCantEixos()); + if(r.getIndSentidoIda()){ + pvo.setImportePeaje(BigDecimal.valueOf(Double.parseDouble(""+o[22])));// + }else{ + pvo.setImportePeaje(BigDecimal.valueOf(Double.parseDouble(""+o[23])));// + } + pvo.setIndicePeaje(orgao.getIndicePeaje()); + pvo.setActivo(1); + pvo.setFecmodif(Calendar.getInstance().getTime()); + pvo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + Integer qtdEixos = r.getCantEixos(); + Integer cantAsientos = r.getCantAsientos(); + BigDecimal indice = orgao.getIndicePeaje(); + BigDecimal pedagioPuro = pvo.getImportePeaje(); + BigDecimal pedagioCalculado = BigDecimal.valueOf(0); + if(Constantes.ORGAOS_CONCEDENTES_CALCULO_ARTESP.contains(orgao.getOrgaoConcedenteId())){ // 21 = artesp + if(qtdEixos == null ){ + int[] x ={-3,r.getRutaId()}; + return x;}else{ + if(indice == null){ + int[] x ={-2,orgao.getOrgaoConcedenteId()}; + return x; + } + } + pedagioCalculado = BigDecimal.valueOf(((pedagioPuro.doubleValue() * qtdEixos) / indice.doubleValue())); + }else if(Constantes.ORGAOS_CONCEDENTES_CALCULO_ANTT.contains(orgao.getOrgaoConcedenteId())){// 3 = antt + if(qtdEixos == null || cantAsientos == null ){ + int[] x ={-1,r.getRutaId()}; + return x;}else{ + if(indice == null){ + int[] x ={-2,orgao.getOrgaoConcedenteId()}; + return x; + } + } + pedagioCalculado = BigDecimal.valueOf(((pedagioPuro.doubleValue() * qtdEixos) / ( indice.doubleValue() * cantAsientos))); + } + + + pvo.setImportePeaje(pedagioCalculado); + + + insertSQL.append(" insert into PEAJE ( PEAJE_ID , RUTA_ID , ORIGEN_ID , DESTINO_ID , ORGAOCONCEDENTE_ID , CASETAPEAJE_ID ,"); + insertSQL.append(" CANTASIENTOS , CANTEIXOS , IMPORTEPEAJE , INDICEPEAJE , ACTIVO , FECMODIF , USUARIO_ID ) "); + insertSQL.append(" values "); + insertSQL.append(" ( PEAJE_SEQ.NEXTVAL , "); + insertSQL.append(pvo.getRutaId()).append(" , "); + insertSQL.append(pvo.getOrigenId()).append(" , "); + insertSQL.append(pvo.getDestinoId()).append(" , "); + insertSQL.append(pvo.getOrgaoId()).append(" , "); + insertSQL.append(pvo.getCasetaPeajeId()).append(" , "); + insertSQL.append(pvo.getCantAsientos()).append(" , "); + insertSQL.append(pvo.getCantEixos()).append(" , "); + insertSQL.append(pvo.getImportePeaje()).append(" , "); + insertSQL.append(pvo.getIndicePeaje()).append(" , "); + insertSQL.append(pvo.getActivo()).append(" , "); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pvo.getFecmodif()); + StringBuilder minhaData = new StringBuilder().append("TO_DATE('").append(calendar.get(Calendar.YEAR)).append("/"); + minhaData.append(String.format("%02d",calendar.get(Calendar.MONTH)+1)).append("/"); + minhaData.append(String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH))).append(" "); + minhaData.append(String.format("%02d",calendar.get(Calendar.HOUR_OF_DAY))).append(":"); + minhaData.append(String.format("%02d",calendar.get(Calendar.MINUTE))).append(":"); + minhaData.append(String.format("%02d",calendar.get(Calendar.SECOND))).append("', 'yyyy/mm/dd hh24:mi:ss')"); + insertSQL.append(minhaData).append(" , "); //TO_DATE('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss') + + insertSQL.append(pvo.getUsuarioId()).append(" ) "); + + lsSql.add(insertSQL.toString()); + //------------------------------------------- existia um if(arredondamento) +// if (trechoPracaPedagio.getSentido().equals("0")) {//IDA // esse trecho veio do calculo da artesp e NAO da antt +// va = (tp_ida * linhaEixo.getQuantidadeEixos()) / divisor; +// } else { +// va = (tp_volta * linhaEixo.getQuantidadeEixos()) / divisor; +// } + //--------------------- +// // calculo IDA // esse veio da antt , e estava dentro +// va = ((tp_ida * qtdEixos) / (lot * iap)); // de um if desnecessário pois o corpo do true ou false +// //arredondamento para cima ou para baixo com 3 casas decimais // faziam a mesma coisa +// BigDecimal bd = new BigDecimal(va); +// bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP); +// va = bd.doubleValue(); + } + } + } + + Connection con = getSession().connection(); + + try { + Statement stmt = con.createStatement(); + con.setAutoCommit(false); + stmt.addBatch(updateSQL.toString()); + for(String x : lsSql){ + stmt.addBatch(x); + } + retorno = stmt.executeBatch(); + con.commit(); + + } catch (SQLException e) { + e.printStackTrace(); + } + + return retorno; + } + + private class PeajeVO { + private Integer peajeId; + private Integer rutaId; + private Integer origenId; + private Integer destinoId; + private Integer orgaoId; + private Integer casetaPeajeId; + private Integer cantAsientos; + private Integer cantEixos; + private BigDecimal importePeaje; + private BigDecimal indicePeaje; + private Integer activo; + private Date fecmodif; + private Integer usuarioId; + + public Integer getPeajeId() { + return peajeId; + } + + public void setPeajeId(Integer peajeId) { + this.peajeId = peajeId; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public Integer getOrgaoId() { + return orgaoId; + } + + public void setOrgaoId(Integer orgaoId) { + this.orgaoId = orgaoId; + } + + public Integer getCasetaPeajeId() { + return casetaPeajeId; + } + + public void setCasetaPeajeId(Integer casetaPeajeId) { + this.casetaPeajeId = casetaPeajeId; + } + + public Integer getCantAsientos() { + return cantAsientos; + } + + public void setCantAsientos(Integer cantAsientos) { + this.cantAsientos = cantAsientos; + } + + public Integer getCantEixos() { + return cantEixos; + } + + public void setCantEixos(Integer cantEixos) { + this.cantEixos = cantEixos; + } + + public BigDecimal getImportePeaje() { + return importePeaje; + } + + public void setImportePeaje(BigDecimal importePeaje) { + this.importePeaje = importePeaje; + } + + public BigDecimal getIndicePeaje() { + return indicePeaje; + } + + public void setIndicePeaje(BigDecimal indicePeaje) { + this.indicePeaje = indicePeaje; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCargoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCargoHibernateDAO.java new file mode 100644 index 000000000..079d896a5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCargoHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CancelacionCargoDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("cancelacionCargoDAO") +public class CancelacionCargoHibernateDAO extends GenericHibernateDAO + implements CancelacionCargoDAO { + + @Autowired + public CancelacionCargoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCtrlHibernateDAO.java new file mode 100644 index 000000000..a2b55ecb7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCtrlHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CancelacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("cancelacionCtrlDAO") +public class CancelacionCtrlHibernateDAO extends GenericHibernateDAO + implements CancelacionCtrlDAO { + + @Autowired + public CancelacionCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, + Parada paradaDestino, Marca marca) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("tiempoprevsalida", tiempoprevsalida)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.add(Restrictions.eq("paradaOrigem", paradaOrigem)); + c.add(Restrictions.eq("paradaDestino", paradaDestino)); + c.add(Restrictions.eq("marca", marca)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeHibernateDAO.java new file mode 100644 index 000000000..f3162896a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; + +@Repository("casetaPeajeDAO") +public class CasetaPeajeHibernateDAO extends GenericHibernateDAO implements CasetaPeajeDAO { + + @Autowired + public CasetaPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return (List) c.list(); + } + + public List buscarTodosOrdenadoPorDescricao() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccaseta")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + return (List) c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscar(String casetaPeajeDesc) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccaseta", casetaPeajeDesc)); + return c.list(); + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaClaseHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaClaseHibernateDAO.java new file mode 100644 index 000000000..199636b48 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaClaseHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaClaseDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaClaseDAO") +public class CategoriaClaseHibernateDAO extends GenericHibernateDAO + implements CategoriaClaseDAO { + + @Autowired + public CategoriaClaseHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaClase) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCorridaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCorridaHibernateDAO.java new file mode 100644 index 000000000..b20b81a80 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCorridaHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaCorridaDAO") +public class CategoriaCorridaHibernateDAO extends GenericHibernateDAO + implements CategoriaCorridaDAO { + + @Autowired + public CategoriaCorridaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaCorrida) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCtrlHibernateDAO.java new file mode 100644 index 000000000..4ec3086f9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCtrlHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaCtrlDAO") +public class CategoriaCtrlHibernateDAO extends GenericHibernateDAO + implements CategoriaCtrlDAO { + + @Autowired + public CategoriaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java new file mode 100644 index 000000000..da17a82ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaDescuentoDAO") +public class CategoriaDescuentoHibernateDAO + extends GenericHibernateDAO + implements CategoriaDescuentoDAO { + + @Autowired + public CategoriaDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaHibernateDAO.java new file mode 100644 index 000000000..e935d3d32 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaDAO") +public class CategoriaHibernateDAO extends GenericHibernateDAO + implements CategoriaDAO { + + @Autowired + public CategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccategoria")); + + return c.list(); + } + + public List buscar(String desccategoria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccategoria", desccategoria)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMarcaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMarcaHibernateDAO.java new file mode 100644 index 000000000..e8cbc17d6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMarcaHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaMarcaDAO") +public class CategoriaMarcaHibernateDAO extends GenericHibernateDAO + implements CategoriaMarcaDAO { + + @Autowired + public CategoriaMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaMarca) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMercadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMercadoHibernateDAO.java new file mode 100644 index 000000000..84ad8a3c6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMercadoHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaMercadoDAO") +public class CategoriaMercadoHibernateDAO + extends GenericHibernateDAO + implements CategoriaMercadoDAO { + + @Autowired + public CategoriaMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaMercado) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaOrgaoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaOrgaoHibernateDAO.java new file mode 100644 index 000000000..392c2eea9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaOrgaoHibernateDAO.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CategoriaOrgaoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; + +@Repository("categoriaOrgaoDAO") + +public class CategoriaOrgaoHibernateDAO extends GenericHibernateDAO + implements CategoriaOrgaoDAO { + + @Autowired + public CategoriaOrgaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaOrgao) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaPeriodoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaPeriodoHibernateDAO.java new file mode 100644 index 000000000..6ca33d17a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaPeriodoHibernateDAO.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaPeriodoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaPeriodoDAO") +public class CategoriaPeriodoHibernateDAO + extends GenericHibernateDAO + implements CategoriaPeriodoDAO { + + @Autowired + public CategoriaPeriodoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo) { + + Calendar feciniciovigencia = Calendar.getInstance(); + feciniciovigencia.setTime(cPeriodo.getFecinicio()); + feciniciovigencia.set(Calendar.MILLISECOND, 0); + feciniciovigencia.set(Calendar.SECOND, 0); + + Calendar fecfinvigencia = Calendar.getInstance(); + fecfinvigencia.setTime(cPeriodo.getFecfin()); + fecfinvigencia.set(Calendar.MILLISECOND, 0); + fecfinvigencia.set(Calendar.SECOND, 0); + + Criteria c = this.getSession().createCriteria(CategoriaPeriodo.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfin", feciniciovigencia.getTime())); + c.add(Restrictions.le("fecinicio", fecfinvigencia.getTime())); + c.add(Restrictions.eq("categoriaDescuento", cPeriodo.getCategoriaDescuento())); + + + return c.list(); + } + + @Override + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("categoriaDescuento", categoriaDescuento)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaTipoPtoVtaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaTipoPtoVtaHibernateDAO.java new file mode 100644 index 000000000..5cc9c0d84 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaTipoPtoVtaHibernateDAO.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("categoriaTipoPtoVtaDAO") +public class CategoriaTipoPtoVtaHibernateDAO extends GenericHibernateDAO + implements CategoriaTipoPtoVtaDAO { + + @Autowired + public CategoriaTipoPtoVtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipoPuntoVenta", tipoPuntoVenta)); + + return c.list(); + } + + public void borrarFisico(CategoriaTipoPtoVta cd) { + + String hql = " delete from CategoriaTipoPtoVta where categoriatipoptovtaId = " + cd.getCategoriatipoptovtaId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CiudadHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CiudadHibernateDAO.java new file mode 100644 index 000000000..d6e82b81a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CiudadHibernateDAO.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CiudadDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author MCosso + */ +@Repository("ciudadDAO") +public class CiudadHibernateDAO extends GenericHibernateDAO + implements CiudadDAO { + + @Autowired + public CiudadHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombciudad")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscar(String nombciudad, Estado estado, Plaza plaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombciudad", nombciudad)); + c.add(Restrictions.eq("estado", estado)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscaLike(String strCiudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("nombciudad", strCiudad, MatchMode.START)); + c.addOrder(Order.asc("nombciudad")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarPorEstado(Estado estado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("estado", estado)); + c.addOrder(Order.asc("nombciudad")); + + return c.list(); + } + + @Override + public List buscaCodMun(Integer codMun, Estado estado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("codmunicipio", codMun)); + c.add(Restrictions.eq("estado", estado)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClaseservicioEquivalenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClaseservicioEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..4276dc1b3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClaseservicioEquivalenciaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ClaseservicioEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("claseservicioEquivalenciaDAO") +public class ClaseservicioEquivalenciaHibernateDAO + extends GenericHibernateDAO + implements ClaseservicioEquivalenciaDAO { + + @Autowired + public ClaseservicioEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(ClaseServicio claseServicio, ComisionistaExterno comisionistaExterno) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("claseservicio", claseServicio)); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("equivalenciaId", claseServicioEquivalencia.getEquivalenciaId())); + + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClasseServicoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClasseServicoHibernateDAO.java new file mode 100644 index 000000000..dc4261a0b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClasseServicoHibernateDAO.java @@ -0,0 +1,82 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClasseServicoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; + +/** + * + * @author Administrador + */ +@Repository("claseServicioDAO") +public class ClasseServicoHibernateDAO extends GenericHibernateDAO implements ClasseServicoDAO { + + @Autowired + public ClasseServicoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descclase")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscarPorEmpresasDoUsuario(String empresasUsuario) { + + String consulta = "SELECT DISTINCT mcs.marcaClaseservicioPK.claseservicio " + + "FROM MarcaClaseServicio mcs " + + "WHERE mcs.marcaClaseservicioPK.marca.empresa.empresaId IN (:empresas) "; + + List ids = new ArrayList(); + for (String empresa : empresasUsuario.split(",")) { + ids.add(new Integer(empresa)); + } + Query query = getSession().createQuery(consulta); + query.setParameterList("empresas", ids); + + List result = (List) query.list(); + return result; + } + + public List buscarPorNome(String nomeClaseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descclase", nomeClaseServicio)); + + return c.list(); + } + + public List buscarTodosExceto(Integer... idClase) { + Criteria c = this.makeCriteria(); + for (Integer id : idClase) { + c.add(Restrictions.ne("claseservicioId", id)); + } + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descclase")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteCursoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteCursoHibernateDAO.java new file mode 100644 index 000000000..3bf3d5d46 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteCursoHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClienteCursoDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; + +@Repository("clienteCursoDAO") +public class ClienteCursoHibernateDAO extends GenericHibernateDAO + implements ClienteCursoDAO { + + @Autowired + public ClienteCursoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @Override + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("cliente", cliente)); + c.add(Restrictions.eq("curso", curso)); + + return (ClienteCurso) c.uniqueResult(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDescuentoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDescuentoHibernateDAO.java new file mode 100644 index 000000000..25e3f7c9e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDescuentoHibernateDAO.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClienteDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; + +@Repository("clienteDescuentoDAO") +public class ClienteDescuentoHibernateDAO extends GenericHibernateDAO +implements ClienteDescuentoDAO { + + @Autowired + public ClienteDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Cliente cliente) { + Criteria c = getSession().createCriteria(getPersistentClass()); + //c.add(Restrictions.eq("activo", 1)); + c.add(Restrictions.eq("cliente", cliente)); + return c.list(); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDireccionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDireccionHibernateDAO.java new file mode 100644 index 000000000..19fd4bd9e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDireccionHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + + + +import com.rjconsultores.ventaboletos.dao.ClienteDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; + + +@Repository("clienteDireccionDAO") +public class ClienteDireccionHibernateDAO extends GenericHibernateDAO + implements ClienteDireccionDAO { + + @Autowired + public ClienteDireccionHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(Integer clienteId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + Cliente cliente = new Cliente(); + cliente.setClienteId(clienteId); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("clienteId", cliente)); + return c.list(); + } + + public List buscar(Cliente cliente){ + Criteria c = getSession().createCriteria(getPersistentClass()); + //c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("clienteId", cliente)); + return c.list(); + } +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteHibernateDAO.java new file mode 100644 index 000000000..fb259d830 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteHibernateDAO.java @@ -0,0 +1,70 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClienteDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +@Repository("clienteDAO") +public class ClienteHibernateDAO extends GenericHibernateDAO + implements ClienteDAO { + + @Autowired + public ClienteHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(String nombCliente) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombcliente", nombCliente)); + + return c.list(); + } + + @Override + public Cliente buscarPorNumeroFidelidade(Integer numeroFidelidade, Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + Criteria clienteFidelidad = null; + clienteFidelidad = c.createCriteria("listClienteFidelidad"); + clienteFidelidad.add(Restrictions.eq("activo", Boolean.TRUE)); + clienteFidelidad.add(Restrictions.eq("empresa", empresa)); + + Criteria tarjetaFidelidad = null; + tarjetaFidelidad = clienteFidelidad.createCriteria("tarjetaFidelidad"); + tarjetaFidelidad.add(Restrictions.eq("numTarjeta", Long.valueOf(numeroFidelidade))); + tarjetaFidelidad.add(Restrictions.eq("activo", Boolean.TRUE)); + + List clientes = c.list(); + return clientes.size() > 0 ? clientes.get(0) : null; + } + + @Override + public List buscarPorDocumento(String documento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numIdentificaUno", documento)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClientePacoteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClientePacoteHibernateDAO.java new file mode 100644 index 000000000..87356fd7d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ClientePacoteHibernateDAO.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClientePacoteDAO; +import com.rjconsultores.ventaboletos.entidad.ClientePacote; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; + +@Repository("clientePacoteDAO") +public class ClientePacoteHibernateDAO extends GenericHibernateDAO implements ClientePacoteDAO { + + @Autowired + public ClientePacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List busquedaDatosClientePacote(String cpfCnpj) { + List clientePacoteVOs = new ArrayList(); + if(StringUtils.isNotBlank(cpfCnpj)) { + Map parametros = new HashMap(); + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT NEW com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO(cp.razaoSocial, cp.cpfCnpj, cp.tipoPessoa, cp.descemail, cp.desctelefone, cp.descfax, cp.cep, ") + .append("cp.endereco, cp.numero, cp.complemento, cp.pais, cp.estado, cp.cidade, cp.bairro) ") + .append("FROM ClientePacote cp "); + + if(StringUtils.isNotBlank(cpfCnpj)) { + sQuery.append("WHERE cp.cpfCnpj = :cpfCnpj "); + parametros.put("cpfCnpj", cpfCnpj.replaceAll("[^0-9]", "")); + } + + sQuery.append("ORDER BY cp.razaoSocial "); + Query qr = getSession().createQuery(sQuery.toString()); + for (Entry parametro : parametros.entrySet()) { + qr.setParameter(parametro.getKey(), parametro.getValue()); + } + + clientePacoteVOs = qr.list(); + } + + return clientePacoteVOs; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CoeficienteTarifaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CoeficienteTarifaHibernateDAO.java new file mode 100644 index 000000000..825fdc658 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CoeficienteTarifaHibernateDAO.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CoeficienteTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; + +@Repository("coeficienteTarifaDAO") +public class CoeficienteTarifaHibernateDAO extends GenericHibernateDAO + implements CoeficienteTarifaDAO { + + @Autowired + public CoeficienteTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descCoeficiente")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscar(String nomb) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ilike("descCoeficiente", nomb, MatchMode.START)); + c.addOrder(Order.asc("descCoeficiente")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java new file mode 100644 index 000000000..0391cd98c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ColoniaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; + +import java.util.List; + +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("coloniaDAO") +public class ColoniaHibernateDAO extends GenericHibernateDAO + implements ColoniaDAO { + + @Autowired + public ColoniaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccolonia")); + + return c.list(); + } + + public List buscar(String desccolonia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccolonia", desccolonia)); + + return c.list(); + } + + public List buscarPorCiudad(Ciudad ciudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ciudad", ciudad)); + c.addOrder(Order.asc("desccolonia")); + return c.list(); + } + + @Override + public List buscaLike(String desccolonia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("desccolonia", desccolonia, MatchMode.START)); + c.addOrder(Order.asc("desccolonia")); + + return c.list(); + } + + @Override + public List buscarPorCodMun(Ciudad ciudad, String desccolonia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ciudad", ciudad)); + c.add(Restrictions.eq("desccolonia", desccolonia)); + return c.list(); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ComisionistaExternoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ComisionistaExternoHibernateDAO.java new file mode 100644 index 000000000..8a3adcb70 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ComisionistaExternoHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ComisionistaExternoDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("comisionistaExternoDAO") +public class ComisionistaExternoHibernateDAO extends GenericHibernateDAO + implements ComisionistaExternoDAO { + + @Autowired + public ComisionistaExternoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccomisionista")); + + return c.list(); + } + + public List buscar(String desccomisionista) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccomisionista", desccomisionista)); + + c.addOrder(Order.asc("desccomisionista")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoHibernateDAO.java new file mode 100644 index 000000000..28efbb0ec --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoHibernateDAO.java @@ -0,0 +1,213 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.BooleanType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +@Repository("comissaoHibernateDAO") +public class ComissaoHibernateDAO extends GenericHibernateDAO implements ComissaoDAO { + + @Autowired + public ComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarReceitasComissoes(Integer puntoVentaId, Integer empresaId, Date periodo) { + + StringBuffer sql = new StringBuffer(); + sql.append("select "); + sql.append("b.marca_id as empresaId, b.puntoventa_id as puntoVentaId, "); + sql.append("to_char(b.fechorventa, 'dd-mm-yyyy') as datavenda, b.indstatusboleto as indstatusboleto, "); + sql.append("b.tipoventa_id as tipoVenta, b.motivocancelacion_id as motivoCancelacionId, "); + sql.append("coalesce(sum(b.preciopagado), 0) as valorpagado, coalesce(sum(b.importeseguro), 0) as seguro, "); + sql.append("coalesce(sum(b.importepedagio), 0) as pedagio, coalesce(sum(b.importetaxaembarque), 0) as embarque, "); + sql.append("coalesce(sum(case when ee.tipoeventoextra_id = 1 then ee.impingreso else 0 end), 0) as excessoBagagem, "); + sql.append("coalesce(sum(case when ee.tipoeventoextra_id = 21 then ee.impingreso else 0 end), 0) as seguroOpcional, "); + sql.append("coalesce(sum(case when ee.tipoeventoextra_id <> 21 "); + sql.append(" or ee.tipoeventoextra_id <> 1 then ee.impingreso else 0 end), 0) as seguroOutros, "); + sql.append("case when c.ptovtaventa_id = b.puntoventa_id then 1 else 0 end as ptoVtaOrigem, "); + sql.append("ei.icms as icmsBase, e.estado_id as estadoId "); + sql.append("from boleto b "); + sql.append("inner join parada origen on origen.parada_id = b.origen_id "); + sql.append("inner join ciudad ci on origen.ciudad_id = ci.ciudad_id "); + sql.append("inner join estado e on ci.estado_id = e.estado_id "); + sql.append("inner join punto_venta p on b.puntoventa_id = p.puntoventa_id "); + sql.append("inner join empresa_imposto ei on (ei.estado_id = e.estado_id "); + sql.append(" and ei.empresa_id = b.marca_id and ei.activo = 1) "); + sql.append("left join caja c on c.numoperacion = b.numoperacion and c.numfoliosistema = b.numfoliosistema "); + sql.append(" and c.numfoliopreimpreso = b.numfoliopreimpreso and c.numseriepreimpresa = b.numseriepreimpresa "); + sql.append("left join evento_extra ee on ee.boleto_id = b.boleto_id "); + sql.append("where to_char(b.fechorventa, 'mmyyyy') = to_char(:periodo, 'mmyyyy') "); + sql.append("and b.marca_id = :empresaId "); + sql.append("and (p.puntoventa_id = :puntoventaId or p.puntoventapadre_id = :puntoventaId) "); + sql.append("group by b.marca_id, b.puntoventa_id, to_char(b.fechorventa, 'dd-mm-yyyy'), "); + sql.append("b.indstatusboleto, b.tipoventa_id, b.motivocancelacion_id, c.ptovtaventa_id, ei.icms, e.estado_id "); + sql.append("order by datavenda "); + + Query query = getSession().createSQLQuery(sql.toString()) + .addScalar("empresaId", IntegerType.INSTANCE) + .addScalar("puntoVentaId", IntegerType.INSTANCE) + .addScalar("datavenda", StringType.INSTANCE) + .addScalar("tipoVenta", IntegerType.INSTANCE) + .addScalar("indstatusboleto", StringType.INSTANCE) + .addScalar("motivoCancelacionId", IntegerType.INSTANCE) + .addScalar("valorpagado", BigDecimalType.INSTANCE) + .addScalar("seguro", BigDecimalType.INSTANCE) + .addScalar("pedagio", BigDecimalType.INSTANCE) + .addScalar("embarque", BigDecimalType.INSTANCE) + .addScalar("excessoBagagem", BigDecimalType.INSTANCE) + .addScalar("seguroOpcional", BigDecimalType.INSTANCE) + .addScalar("seguroOutros", BigDecimalType.INSTANCE) + .addScalar("ptoVtaOrigem", BooleanType.INSTANCE) + .addScalar("icmsBase", BigDecimalType.INSTANCE) + .addScalar("estadoId", IntegerType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(BoletoComissao.class)); + + query.setTimestamp("periodo", periodo); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + + return query.list(); + } + + @Override + public Comissao buscaComissaoVigencia(Integer puntoVentaId, Integer empresaId, String competencia) { + + StringBuilder hql = new StringBuilder(); + hql.append(" from Comissao c "); + hql.append(" where c.activo = 1 "); + hql.append(" AND c.puntoVenta.puntoventaId = :puntoventaId "); + hql.append(" AND c.empresaId = :empresaId "); + hql.append(" AND c.competencia = :periodo "); + + Query query = getSession().createQuery(hql.toString()); + query.setString("periodo", competencia); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + + return (Comissao) query.uniqueResult(); + } + + @Override + @SuppressWarnings("unchecked") + public List buscaHistoricoComissao(Integer puntoVentaId, Integer empresaId, Date periodoInicio, Date periodoFim) { + + String competenciaInicio = DateUtil.getStringDate(periodoInicio, "MM/yyyy"); + String competenciaFim = DateUtil.getStringDate(periodoFim, "MM/yyyy"); + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT c.competencia AS competencia, pv.nombpuntoventa, pv.numpuntoventa, "); + sql.append(" c.datapagamento AS dataPagamento, "); + sql.append(" c.comissao_bpr AS comissaoBpr, "); + sql.append(" c.receita_excessobagagem AS receitaExcessobagagem, "); + sql.append(" c.receita_seguroopcional AS receitaSeguroopcional, "); + sql.append(" c.descontos_fixos AS descontosFixos, "); + sql.append(" c.descontos_eventuais AS descontosEventuais, "); + sql.append(" c.royaties AS royaties, "); + sql.append(" c.iss_retido AS issRetido, "); + sql.append(" c.bonificacao_metas AS bonificacaoMetas, "); + sql.append(" c.entregas_passagem AS entregasPassagem, "); + sql.append(" c.receita_outros AS receitaOutros, "); + sql.append(" c.indpago AS indPago, "); + sql.append(" CASE WHEN c.indpago = 1 THEN 'PAGO' ELSE 'PENDENTE' END AS pagamento, "); + sql.append(" up.nombusuario AS usuarioPagamento, "); + sql.append(" ul.nombusuario AS usuarioLancamento, "); + sql.append(" e.nombempresa, e.cnpj, "); + sql.append(" pa.numagencia as agencia, pa.numconta || '-' || pa.digito as conta, if.nome as banco, "); + sql.append(" ci.nombciudad as cidade, pv.descCorreo "); + /* + private String sigla; + private String nome; + */ + sql.append("FROM comissao c "); + sql.append("JOIN punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sql.append("JOIN empresa e on e.empresa_id = c.empresa_id "); + sql.append("LEFT JOIN ptovta_agencia pa on pa.ptovtaagencia_id = pv.ptovtaagencia_id "); + sql.append("LEFT JOIN insti_financeira if on if.instifinanceira_id = pa.instifinanceira_id "); + sql.append("LEFT JOIN colonia co on co.colonia_id = pv.colonia_id "); + sql.append("LEFT JOIN ciudad ci on ci.ciudad_id = co.ciudad_id "); + sql.append("LEFT JOIN usuario up ON up.usuario_id = c.usuariopagamento_id "); + sql.append("LEFT JOIN usuario ul ON ul.usuario_id = c.usuario_id "); + sql.append("WHERE c.activo = 1 "); + sql.append(" AND c.empresa_id = :empresaId "); + sql.append(" AND TO_DATE(c.competencia,'MM/YYYY') BETWEEN TO_DATE(:periodoInicio,'MM/YYYY') and TO_DATE(:periodoFim,'MM/YYYY') "); + + if(puntoVentaId != null) { + sql.append(" AND c.puntoventa_id = :puntoventaId "); + } + sql.append("ORDER BY pv.nombpuntoventa, TO_DATE(c.competencia,'MM/YYYY') "); + + Query query = getSession().createSQLQuery(sql.toString()) + .addScalar("competencia", StringType.INSTANCE) + .addScalar("nombpuntoventa", StringType.INSTANCE) + .addScalar("numpuntoventa", StringType.INSTANCE) + .addScalar("dataPagamento", DateType.INSTANCE) + .addScalar("comissaoBpr", BigDecimalType.INSTANCE) + .addScalar("receitaExcessobagagem", BigDecimalType.INSTANCE) + .addScalar("receitaSeguroopcional", BigDecimalType.INSTANCE) + .addScalar("descontosFixos", BigDecimalType.INSTANCE) + .addScalar("descontosEventuais", BigDecimalType.INSTANCE) + .addScalar("royaties", BigDecimalType.INSTANCE) + .addScalar("issRetido", BigDecimalType.INSTANCE) + .addScalar("bonificacaoMetas", BigDecimalType.INSTANCE) + .addScalar("entregasPassagem", BigDecimalType.INSTANCE) + .addScalar("receitaOutros", BigDecimalType.INSTANCE) + .addScalar("indPago", BooleanType.INSTANCE) + .addScalar("pagamento", StringType.INSTANCE) + .addScalar("usuarioPagamento", StringType.INSTANCE) + .addScalar("usuarioLancamento", StringType.INSTANCE) + .addScalar("nombempresa", StringType.INSTANCE) + .addScalar("cnpj", StringType.INSTANCE) + .addScalar("conta", StringType.INSTANCE) + .addScalar("banco", StringType.INSTANCE) + .addScalar("cidade", StringType.INSTANCE) + .addScalar("agencia", StringType.INSTANCE) + .addScalar("descCorreo", StringType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(HistoricoComissao.class)); + + query.setString("periodoInicio", competenciaInicio); + query.setString("periodoFim", competenciaFim); + query.setInteger("empresaId", empresaId); + + if(puntoVentaId != null) { + query.setInteger("puntoventaId", puntoVentaId); + } + + return query.list(); + } + + @Override + @SuppressWarnings("unchecked") + public List buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId) { + StringBuilder sQuery = new StringBuilder("SELECT pv FROM PtovtaComissao c "); + sQuery.append("JOIN c.puntoventaId pv ") + .append("JOIN c.empresaId e ") + .append("WHERE pv.activo = 1 ") + .append("AND e.empresaId = :empresaId ") + .append("AND c.activo = 1"); + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("empresaId", empresaId); + return qr.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDAO.java new file mode 100644 index 000000000..62c742f20 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CompaniaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("companiaBancariaDAO") +public class CompaniaBancariaHibernateDAO extends GenericHibernateDAO + implements CompaniaBancariaDAO { + + @Autowired + public CompaniaBancariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(CompaniaBancaria companiaBancaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("cvecompania", companiaBancaria.getCvecompania())); + c.add(Restrictions.eq("cvesucursal", companiaBancaria.getCvesucursal())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConductorHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConductorHibernateDAO.java new file mode 100644 index 000000000..e488facb4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConductorHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ConductorDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Conductor; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("conductorDAO") +public class ConductorHibernateDAO extends GenericHibernateDAO + implements ConductorDAO { + + @Autowired + public ConductorHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public Conductor buscar(String claveConductor, String contraSenha) { + Conductor c = new Conductor(1); + c.setNombconductor("Rafius"); + + return c; + } + + public Conductor buscarPorEmpleado(int empleadoId){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empleado.empleadoId", empleadoId)); + + return (Conductor) c.uniqueResult(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionConfHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionConfHibernateDAO.java new file mode 100644 index 000000000..d11e27302 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionConfHibernateDAO.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionConfDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +@Repository("conexionConfDAO") +public class ConexionConfHibernateDAO extends GenericHibernateDAO + implements ConexionConfDAO { + + @Autowired + public ConexionConfHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("grupo", numgrupo)); + + Criteria ctrl = c.createCriteria("conexionCtrl"); + ctrl.add(Restrictions.eq("conexionctrlId", conexionCtrlId)); + + return (ConexionConf) c.uniqueResult(); + } + + @Override + public List buscarPorConexionCtrl(ConexionCtrl conexionCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("conexionCtrl", conexionCtrl)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java new file mode 100644 index 000000000..fe66618de --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +@Repository("conexionCtrlDAO") +public class ConexionCtrlHibernateDAO extends GenericHibernateDAO + implements ConexionCtrlDAO { + + @Autowired + public ConexionCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarConexionesCtrl(Integer origenId, Integer destinoId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from ConexionCtrl "); + sb.append(" where activo = 1 "); + + if (origenId != null) { + sb.append(" and origenId = ").append(origenId); + } + if (destinoId != null) { + sb.append(" and destinoId = ").append(destinoId); + } + + Query query = getSession().createQuery(sb.toString()); + List list = query.list(); + + return list; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionHibernateDAO.java new file mode 100644 index 000000000..0c58ef00c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; + +@Repository("conexionExcepcionDAO") +public class ConexionExcepcionHibernateDAO extends GenericHibernateDAO + implements ConexionExcepcionDAO { + + @Autowired + public ConexionExcepcionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionctrlId", conexionctrlId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionRutaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionRutaHibernateDAO.java new file mode 100644 index 000000000..1805fe61c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionRutaHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; + +@Repository("conexionExcepcionRutaDAO") +public class ConexionExcepcionRutaHibernateDAO extends GenericHibernateDAO + implements ConexionExcepcionRutaDAO { + + @Autowired + public ConexionExcepcionRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionctrlId", conexionctrlId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java new file mode 100644 index 000000000..11f53dd64 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java @@ -0,0 +1,288 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrlTemp; +import com.rjconsultores.ventaboletos.entidad.ConexionTemp; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +@Repository("conexionDAO") +public class ConexionHibernateDAO extends GenericHibernateDAO + implements ConexionDAO { + + @Autowired + public ConexionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarConexionesValidas() { + + StringBuilder sb = new StringBuilder(); + sb.append("SELECT DISTINCT cct.conexionctrl_id AS conexionCtrlId, "); + sb.append(" po1.descparada AS conOrigen, "); + sb.append(" pd1.descparada AS conDestino, "); + sb.append(" c.numgrupo AS grupo, "); + sb.append(" po2.descparada AS tramoOrigen, "); + sb.append(" pd2.descparada AS tramoDestino, "); + sb.append(" c.numsecuencia AS numSecuencia "); + sb.append("FROM conexion c "); + sb.append(" inner join conexion_conf cf "); + sb.append(" ON ( cf.conexionctrl_id = c.conexionctrl_id "); + sb.append(" AND cf.activo = 1 ) "); + sb.append(" inner join conexion_ctrl cct "); + sb.append(" ON ( cct.conexionctrl_id = c.conexionctrl_id "); + sb.append(" AND cct.activo = 1 ) "); + sb.append(" inner join parada po1 "); + sb.append(" ON ( po1.parada_id = cct.origen_id ) "); + sb.append(" inner join parada pd1 "); + sb.append(" ON ( pd1.parada_id = cct.destino_id ) "); + sb.append(" inner join parada po2 "); + sb.append(" ON ( po2.parada_id = c.origen_id ) "); + sb.append(" inner join parada pd2 "); + sb.append(" ON ( pd2.parada_id = c.destino_id ) "); + sb.append("WHERE cct.activo = 1 "); + sb.append("ORDER BY po1.descparada, "); + sb.append(" pd1.descparada, "); + sb.append(" cct.conexionctrl_id, "); + sb.append(" c.numgrupo, "); + sb.append(" c.numsecuencia, "); + sb.append(" po2.descparada, "); + sb.append(" pd2.descparada "); + + Query query = getSession().createSQLQuery(sb.toString()); + List conexionVOs = new ArrayList(); + + for (Object o : query.list()) { + Object[] oc = (Object[]) o; + + ConexionVO conexionVO = new ConexionVO(); + conexionVO.setConexionCtrlId(((BigDecimal) oc[0]).longValue()); + conexionVO.setConOrigen((String) oc[1]); + conexionVO.setConDestino((String) oc[2]); + conexionVO.setGrupo(((BigDecimal) oc[3]).intValue()); + conexionVO.setTramoOrigen((String) oc[4]); + conexionVO.setTramoDestino((String) oc[5]); + conexionVOs.add(conexionVO); + } + + return conexionVOs; + } + + @Override + public List buscarConexiones(Integer origenId, Integer destinoId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select cc.conexionctrl_id as conexionCtrlId, occ.descparada as conOrigen, dcc.descparada as conDestino, "); + sb.append(" c.numgrupo as grupo, oc.descparada as tramoOrigen, dc.descparada as tramoDestino "); + sb.append(" from conexion_ctrl cc "); + sb.append(" inner join conexion_conf conf "); + sb.append(" on conf.conexionctrl_id = cc.conexionctrl_id, "); + sb.append(" conexion c, "); + sb.append(" parada occ, "); + sb.append(" parada dcc, "); + sb.append(" parada oc, "); + sb.append(" parada dc "); + sb.append(" where cc.activo = 1 "); + sb.append(" and cc.conexionctrl_id = c.conexionctrl_id "); + sb.append(" and occ.parada_id = cc.origen_id "); + sb.append(" and conf.grupo = c.numgrupo "); + sb.append(" and dcc.parada_id = cc.destino_id "); + sb.append(" and oc.parada_id = c.origen_id "); + sb.append(" and dc.parada_id = c.destino_id "); + if (origenId != null) { + sb.append(" and cc.origen_id = ").append(origenId); + } + if (destinoId != null) { + sb.append(" and cc.destino_id = ").append(destinoId); + } + sb.append(" order by occ.descparada, dcc.descparada, cc.conexionctrl_id, c.numgrupo, c.numsecuencia, oc.descparada, dc.descparada "); + + Query query = getSession().createSQLQuery(sb.toString()); + List list = query.list(); + + List vos = new ArrayList(); + for (Object[] o : list) { + ConexionVO vo = new ConexionVO(); + vo.setConexionCtrlId(((BigDecimal) o[0]).longValue()); + vo.setConOrigen((String) o[1]); + vo.setConDestino((String) o[2]); + vo.setGrupo(((BigDecimal) o[3]).intValue()); + vo.setTramoOrigen((String) o[4]); + vo.setTramoDestino((String) o[5]); + + vos.add(vo); + } + + return vos; + } + + @Override + public void generarConexiones(Integer usuarioId) { + this.getSession().createQuery("DELETE ConexionTemp").executeUpdate(); + this.getSession().createQuery("DELETE ConexionCtrlTemp").executeUpdate(); + + Query queryParadas = this.getSession().createQuery("select distinct t.origem.paradaId,t.destino.paradaId from Tramo t where t.activo = 1 order by t.origem.paradaId "); + List lsParadas = queryParadas.list(); + + StringBuilder sb = new StringBuilder(""); + sb.append("SELECT "); + sb.append(" t.origem.paradaId, "); + sb.append(" t.destino.paradaId, "); + sb.append(" t2.origem.paradaId, "); + sb.append(" t2.destino.paradaId, "); + sb.append(" MAX(t.kmReal), "); + sb.append(" MAX(tcs.tiemporecorrido), "); + sb.append(" MAX(t2.kmReal), "); + sb.append(" MAX(tcs2.tiemporecorrido) "); + sb.append(" "); + sb.append("FROM "); + sb.append(" Tramo t, "); + sb.append(" Tramo t2, "); + sb.append(" TramoServicio tcs, "); + sb.append(" TramoServicio tcs2 "); + sb.append(" "); + sb.append("where "); + sb.append(" t.origem.paradaId = :origen "); + sb.append(" and t.activo=1 "); + sb.append(" "); + sb.append(" and t2.destino.paradaId = :destino "); + sb.append(" and t2.activo=1 "); + sb.append(" and t2.origem= t.destino "); + sb.append(" "); + sb.append(" and tcs.tramo=t "); + sb.append(" and tcs.activo=1 "); + sb.append(" "); + sb.append(" and tcs2.tramo=t2 "); + sb.append(" and tcs2.activo=1 "); + sb.append(" "); + sb.append("group by "); + sb.append(" t.origem.paradaId, "); + sb.append(" t.destino.paradaId, "); + sb.append(" t2.origem.paradaId, "); + sb.append(" t2.destino.paradaId "); + + Map mapConexionCtrlId = new HashMap(); + for (Object[] obj : lsParadas) { + int grupo = 0; + Integer origenId = (Integer) obj[0]; + Integer destinoId = (Integer) obj[1]; + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("origen", origenId); + query.setParameter("destino", destinoId); + + List list = query.list(); + + for (Object[] objConexion : list) { + Integer origen1 = (Integer) objConexion[0]; + Integer destino1 = (Integer) objConexion[1]; + Integer origen2 = (Integer) objConexion[2]; + Integer destino2 = (Integer) objConexion[3]; + + String claveConexionCtrl = origenId + "-" + destinoId; + + Long conexionCtrlId = mapConexionCtrlId.get(claveConexionCtrl); + + if (conexionCtrlId == null) { + ConexionCtrlTemp c = new ConexionCtrlTemp(); + c.setActivo(true); + c.setOrigenId(origen1); + c.setDestinoId(destino2); + c.setFecmodif(new java.util.Date()); + c.setUsuarioId(usuarioId); + + conexionCtrlId = (Long) this.getSession().save(c); + mapConexionCtrlId.put(claveConexionCtrl, conexionCtrlId); + } + grupo++; + + ConexionTemp cTemp = new ConexionTemp(); + cTemp.setActivo(true); + cTemp.setConexionctrlId(conexionCtrlId); + cTemp.setOrigenId(origen1); + cTemp.setDestinoId(destino1); + cTemp.setNumgrupo(grupo); + cTemp.setNumsecuencia((short) 1); + cTemp.setUsuarioId(usuarioId); + cTemp.setFecmodif(new java.util.Date()); + + ConexionTemp cTemp2 = new ConexionTemp(); + cTemp2.setActivo(true); + cTemp2.setConexionctrlId(conexionCtrlId); + cTemp2.setOrigenId(origen2); + cTemp2.setDestinoId(destino2); + cTemp2.setNumgrupo(grupo); + cTemp2.setNumsecuencia((short) 2); + cTemp2.setUsuarioId(usuarioId); + cTemp2.setFecmodif(new java.util.Date()); + + getSession().save(cTemp); + getSession().save(cTemp2); + } + } + + // deletando, exceto conexoes que foram criadas manualmente: + this.getSession().createQuery("DELETE Conexion c WHERE c.conexionctrlId NOT IN (SELECT cc.conexionCtrl.conexionctrlId FROM ConexionConf cc)").executeUpdate(); + this.getSession().createQuery("DELETE ConexionCtrl cct WHERE cct.conexionctrlId NOT IN (SELECT cc.conexionCtrl.conexionctrlId FROM ConexionConf cc)").executeUpdate(); + + sb = new StringBuilder(""); + sb.append(" INSERT INTO ConexionCtrl (conexionctrlId,fecmodif,activo,usuarioId,origenId,destinoId) "); + sb.append(" SELECT cct.conexionctrlId, "); + sb.append(" cct.fecmodif, "); + sb.append(" cct.activo, "); + sb.append(" cct.usuarioId, "); + sb.append(" cct.origenId, "); + sb.append(" cct.destinoId "); + sb.append(" FROM ConexionCtrlTemp cct "); + sb.append(" WHERE cct.origenId || '_' || cct.destinoId NOT IN "); + sb.append(" ( SELECT cc.origenId || '_' || cc.destinoId "); + sb.append(" FROM ConexionCtrl cc "); + sb.append(" WHERE cc.activo = 1) "); + this.getSession().createQuery(sb.toString()).executeUpdate(); + + sb = new StringBuilder(""); + sb.append(" INSERT INTO Conexion (conexionId,numgrupo,numsecuencia,activo,fecmodif,usuarioId,origenId,destinoId,conexionctrlId) "); + sb.append(" SELECT ct.conexionId, "); + sb.append(" ct.numgrupo, "); + sb.append(" ct.numsecuencia, "); + sb.append(" ct.activo, "); + sb.append(" ct.fecmodif, "); + sb.append(" ct.usuarioId, "); + sb.append(" ct.origenId, "); + sb.append(" ct.destinoId, "); + sb.append(" ct.conexionctrlId "); + sb.append(" FROM ConexionTemp ct "); + sb.append(" WHERE ct.origenId || '_' || ct.destinoId NOT IN "); + sb.append(" ( SELECT c.origenId || '_' || c.destinoId "); + sb.append(" FROM Conexion c "); + sb.append(" WHERE c.activo = 1) "); + this.getSession().createQuery(sb.toString()).executeUpdate(); + } + + @Override + public List buscarPorConexionCtrl(Long conexionCtrlId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionctrlId", conexionCtrlId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numgrupo")); + c.addOrder(Order.asc("numsecuencia")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java new file mode 100644 index 000000000..0129454eb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoCanalVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; + +@Repository("confRestricaoCanalVentaDAO") +public class ConfRestricaoCanalVentaHibernateDAO extends GenericHibernateDAO implements ConfRestricaoCanalVentaDAO { + + @Autowired + public ConfRestricaoCanalVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoExcecaoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoExcecaoHibernateDAO.java new file mode 100644 index 000000000..4b8519902 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoExcecaoHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoExcecaoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; + +@Repository("confRestricaoExcecaoDAO") +public class ConfRestricaoExcecaoHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoExcecaoDAO { + + @Autowired + public ConfRestricaoExcecaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoPtovtaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoPtovtaHibernateDAO.java new file mode 100644 index 000000000..0600634b7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoPtovtaHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoPtovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; + +@Repository("confRestricaoPtovtaDAO") +public class ConfRestricaoPtovtaHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoPtovtaDAO { + + @Autowired + public ConfRestricaoPtovtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java new file mode 100644 index 000000000..ec8cabddd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java @@ -0,0 +1,976 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeSet; + +import javax.sql.DataSource; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.Hibernate; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.Transformers; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO; +import com.rjconsultores.ventaboletos.dao.ContaCorrenteAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; + +@Repository("conferenciaComissaoDAO") +public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO implements ConferenciaComissaoDAO { + + private static Logger log = Logger.getLogger(ConferenciaComissaoHibernateDAO.class); + + @Autowired + private ContaCorrenteAgenciaDAO contaCorrenteAgenciaDAO; + + @Autowired + private DataSource dataSourceRead; + + @Autowired + public ConferenciaComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + Connection con = null; + try { + con = dataSourceRead.getConnection(); + + List lsConferencias = new ArrayList(); + + carregarPuntoVentas(lsConferencias, competencia, empresa, puntoVenta); + carregarConferenciasRegistradas(lsConferencias, competencia, empresa, puntoVenta); + carregarMovimentoVendas(con, lsConferencias, competencia, empresa, puntoVenta); + carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta); + + Collections.sort(lsConferencias); + + return lsConferencias; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + try { + if(con != null && !con.isClosed()) { + con.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @SuppressWarnings({ "unchecked", "deprecation" }) + private void carregarPuntoVentas(List lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + try { + + if(puntoVenta != null && puntoVenta.getPuntoventaId() > -1) { + Set diasSemMovimentos = DateUtil.carregarDiasCompetencia(competencia); + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setPuntoventaId(puntoVenta.getPuntoventaId()); + conferenciaComissao.setNombpuntoventa(puntoVenta.getNombpuntoventa()); + conferenciaComissao.setNumPuntoVenta(puntoVenta.getNumPuntoVenta()); + conferenciaComissao.setCompetencia(competencia); + conferenciaComissao.setDiasSemMovimentos(diasSemMovimentos); + lsConferencias.add(conferenciaComissao); + return; + } + + Map parametros = new HashMap(); + StringBuilder sQuery = new StringBuilder("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", PV.NOMBPUNTOVENTA as \"nombpuntoventa\" "); + sQuery.append("FROM PUNTO_VENTA PV ") + .append("JOIN PTOVTA_EMPRESA PTE ON PTE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID AND PTE.ACTIVO = 1 ") + .append("WHERE PV.ACTIVO = 1 "); + + if(empresa != null) { + sQuery.append("AND PTE.EMPRESA_ID = :empresaId "); + parametros.put("empresaId", empresa.getEmpresaId()); + } + + sQuery.append("ORDER BY PV.NOMBPUNTOVENTA "); + + log.info(sQuery.toString()); + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("puntoventaId", Hibernate.INTEGER) + .addScalar("numPuntoVenta", Hibernate.STRING) + .addScalar("nombpuntoventa", Hibernate.STRING) + .setResultTransformer(Transformers.aliasToBean(ConferenciaComissaoVO.class)); + setParametros(qr, parametros); + + processarQueryConferenciaComissao(qr.list(), lsConferencias, competencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @SuppressWarnings("unchecked") + private void carregarConferenciasRegistradas(List lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + try { + Map parametros = carregarParametros(competencia, empresa, puntoVenta, null); + StringBuilder sQuery = new StringBuilder("SELECT co FROM Conferencia co "); + sQuery.append("JOIN co.empresa em ") + .append("JOIN co.puntoVenta pv ") + .append("WHERE co.activo = 1 ") + .append("AND co.datamovimento BETWEEN :dataInicial AND :dataFinal "); + + if(parametros.containsKey("empresaId")) { + sQuery.append("AND em.empresaId = :empresaId "); + } + + if(parametros.containsKey("puntoventaId")) { + sQuery.append("AND pv.puntoventaId = :puntoventaId "); + } + + log.info(sQuery.toString()); + Query qr = getSession().createQuery(sQuery.toString()); + setParametros(qr, parametros); + processarQueryConferencia(qr.list(), lsConferencias, competencia); + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @SuppressWarnings("rawtypes") + private void setParametros(Query qr, Map parametros) { + for (Entry parametro : parametros.entrySet()) { + if(parametro.getValue() instanceof Collection) { + qr.setParameterList(parametro.getKey(), (Collection) parametro.getValue()); + } else if(parametro.getValue() instanceof List) { + qr.setParameterList(parametro.getKey(), (List) parametro.getValue()); + } else { + qr.setParameter(parametro.getKey(), parametro.getValue()); + } + } + } + + private void carregarMovimentoVendas(Connection con, List lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException, SQLException { + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + Map parametros = carregarParametros(competencia, empresa, puntoVenta, null); + StringBuilder sQuery = new StringBuilder("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", PV.NOMBPUNTOVENTA as \"nombpuntoventa\", TO_DATE(B.FECHORVENTA, 'DD/MM/YY') as \"datamovimento\" "); + sQuery.append("FROM BOLETO B ") + .append("INNER JOIN PUNTO_VENTA PV ON B.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ") + .append("WHERE PV.ACTIVO = 1 ") + .append("AND B.FECHORVENTA BETWEEN ? AND ? "); + + if(parametros.containsKey("empresaId")) { + sQuery.append("AND B.MARCA_ID = ? "); + } + + if(parametros.containsKey("puntoventaId")) { + sQuery.append("AND PV.PUNTOVENTA_ID = ? "); + } + + sQuery.append("GROUP BY PV.PUNTOVENTA_ID, PV.NUMPUNTOVENTA, PV.NOMBPUNTOVENTA, TO_DATE(B.FECHORVENTA, 'DD/MM/YY') "); + + log.info(sQuery.toString()); + + stmt = con.prepareStatement(sQuery.toString()); + int idxParametro = 1; + stmt.setDate(idxParametro++, new java.sql.Date(((Date)parametros.get("dataInicial")).getTime())); + stmt.setDate(idxParametro++, new java.sql.Date(((Date)parametros.get("dataFinal")).getTime())); + if(parametros.containsKey("empresaId")) { + stmt.setInt(idxParametro++, (Integer) parametros.get("empresaId")); + } + if(parametros.containsKey("puntoventaId")) { + stmt.setInt(idxParametro++, (Integer) parametros.get("puntoventaId")); + } + + rset = stmt.executeQuery(); + List movimentos = new ArrayList(); + while(rset.next()) { + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setPuntoventaId(rset.getInt("puntoventaId")); + conferenciaComissao.setNumPuntoVenta(rset.getString("numPuntoVenta")); + conferenciaComissao.setNombpuntoventa(rset.getString("nombpuntoventa")); + conferenciaComissao.setDatamovimento(rset.getDate("datamovimento")); + + movimentos.add(conferenciaComissao); + } + + processarQueryConferenciaComissao(movimentos, lsConferencias, competencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + if(rset != null && !rset.isClosed()) { + rset.close(); + } + if(stmt != null && !stmt.isClosed()) { + stmt.close(); + } + } + } + + /** + * Carrega a {@link ConferenciaComissaoVO} a partir de uma consulta com sql nativo, transformando o resultado em uma coleção de {@link ConferenciaComissaoVO} + * @param lsQuery + * @param lsConferencias + * @param competencia + * @param corPadrao + * @throws ParseException + */ + private void processarQueryConferenciaComissao(List lsQuery, List lsConferencias, String competencia) throws ParseException { + Set diasSemMovimentos = DateUtil.carregarDiasCompetencia(competencia); + + for (ConferenciaComissaoVO conferenciaComissaoMovimentoDiario : lsQuery) { + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setCompetencia(competencia); + conferenciaComissao.setPuntoventaId(conferenciaComissaoMovimentoDiario.getPuntoventaId()); + conferenciaComissao.setNumPuntoVenta(conferenciaComissaoMovimentoDiario.getNumPuntoVenta()); + conferenciaComissao.setNombpuntoventa(conferenciaComissaoMovimentoDiario.getNombpuntoventa()); + conferenciaComissao.setDiasSemMovimentos(new TreeSet(diasSemMovimentos)); + + if(lsConferencias.contains(conferenciaComissao)) { + conferenciaComissao = lsConferencias.get(lsConferencias.indexOf(conferenciaComissao)); + } + + if(conferenciaComissaoMovimentoDiario.getDatamovimento() != null) { + Integer dia = Integer.valueOf(DateUtil.getStringDate(conferenciaComissaoMovimentoDiario.getDatamovimento(), "dd")); + if(conferenciaComissao.getDiasSemMovimentos().contains(dia)) { + + DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO(); + diaConferenciaComissao.setDia(dia); + diaConferenciaComissao.setData(DateUtil.getDateFromString(dia + "/" + competencia, "dd/MM/yyyy")); + + if(conferenciaComissao.getDias() == null) { + conferenciaComissao.setDias(new ArrayList()); + } + + conferenciaComissao.getDias().add(diaConferenciaComissao); + conferenciaComissao.getDiasSemMovimentos().remove(diaConferenciaComissao.getDia()); + } + } + + if(!lsConferencias.contains(conferenciaComissao)) { + lsConferencias.add(conferenciaComissao); + } + } + } + + /** + * Carrega a {@link ConferenciaComissaoVO} a partir dos registros da tabela {@link Conferencia} + * @param lsQuery + * @param lsConferencias + * @param competencia + * @throws ParseException + */ + private void processarQueryConferencia(List lsQuery, List lsConferencias, String competencia) throws ParseException { + Set diasSemMovimentos = DateUtil.carregarDiasCompetencia(competencia); + + for (Conferencia conferencia : lsQuery) { + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setCompetencia(competencia); + conferenciaComissao.setPuntoventaId(conferencia.getPuntoVenta().getPuntoventaId()); + conferenciaComissao.setNumPuntoVenta(conferencia.getPuntoVenta().getNumPuntoVenta()); + conferenciaComissao.setNombpuntoventa(conferencia.getPuntoVenta().getNombpuntoventa()); + conferenciaComissao.setDiasSemMovimentos(new TreeSet(diasSemMovimentos)); + + if(lsConferencias.contains(conferenciaComissao)) { + conferenciaComissao = lsConferencias.get(lsConferencias.indexOf(conferenciaComissao)); + } + + if(conferencia.getDatamovimento() != null) { + Integer dia = Integer.valueOf(DateUtil.getStringDate(conferencia.getDatamovimento(), "dd")); + if(conferenciaComissao.getDiasSemMovimentos().contains(dia)) { + + DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO(); + diaConferenciaComissao.setConferenciaId(conferencia.getConferenciaId()); + diaConferenciaComissao.setDia(dia); + diaConferenciaComissao.setData(DateUtil.getDateFromString(dia + "/" + competencia, "dd/MM/yyyy")); + diaConferenciaComissao.setIndboletogerado(conferencia.getIndboletogerado()); + diaConferenciaComissao.setIndconferido(conferencia.getIndconferido()); + diaConferenciaComissao.setIndmaloterecebido(conferencia.getIndmaloterecebido()); + diaConferenciaComissao.setIndpendencia(conferencia.getIndpendencia()); + diaConferenciaComissao.setIndsemmovimento(conferencia.getIndsemmovimento()); + + if(conferenciaComissao.getDias() == null) { + conferenciaComissao.setDias(new ArrayList()); + } + + conferenciaComissao.getDias().add(diaConferenciaComissao); + conferenciaComissao.getDiasSemMovimentos().remove(diaConferenciaComissao.getDia()); + } + } + + if(!lsConferencias.contains(conferenciaComissao)) { + lsConferencias.add(conferenciaComissao); + } + } + } + + private void carregarDiasSemMovimento(List lsConferencias, String competencia, Empresa empresa, PuntoVenta puntoVenta) throws ParseException { + for (ConferenciaComissaoVO conferenciaComissao : lsConferencias) { + for (Integer diaSemMovimento : conferenciaComissao.getDiasSemMovimentos()) { + DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO(); + diaConferenciaComissao.setDia(diaSemMovimento); + diaConferenciaComissao.setData(DateUtil.getDateFromString(diaSemMovimento + "/" + competencia, "dd/MM/yyyy")); + diaConferenciaComissao.setIndsemmovimento(true); + + if(conferenciaComissao.getDias() == null) { + conferenciaComissao.setDias(new ArrayList()); + } + conferenciaComissao.getDias().add(diaConferenciaComissao); + } + conferenciaComissao.getDiasSemMovimentos().clear(); + } + } + + private Map carregarParametros(String competencia, Empresa empresa, PuntoVenta puntoVenta, Date datamovimento) throws ParseException { + Map parametros = new HashMap(); + if(empresa != null) { + parametros.put("empresaId", empresa.getEmpresaId()); + } + if(puntoVenta != null && puntoVenta.getPuntoventaId() > -1) { + parametros.put("puntoventaId", puntoVenta.getPuntoventaId()); + } + + if(datamovimento != null) { + parametros.put("dataMovimentoInicial", DateUtil.getStringDate(DateUtil.inicioFecha(datamovimento), "dd/MM/yyyy HH:mm")); + parametros.put("dataMovimentoFinal", DateUtil.getStringDate(DateUtil.fimFecha(datamovimento), "dd/MM/yyyy HH:mm")); + } + + if(StringUtils.isNotBlank(competencia)) { + String[] vetCompetencia = competencia.split("/"); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.MONTH, Integer.valueOf(vetCompetencia[0]) - 1); + cal.set(Calendar.YEAR, Integer.valueOf(vetCompetencia[1])); + + parametros.put("dataInicial", DateUtil.getDateFromString(cal.getActualMinimum(Calendar.DAY_OF_MONTH) + "/" + competencia + " 00:00:00", "dd/MM/yyyy hh:mm:ss")); + parametros.put("dataFinal", DateUtil.getDateFromString(cal.getActualMaximum(Calendar.DAY_OF_MONTH) + "/" + competencia + " 23:59:59", "dd/MM/yyyy hh:mm:ss")); + } + + return parametros; + } + + @Override + @Transactional + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException { + try { + conferencia.setIndmaloterecebido(Boolean.TRUE); + if(conferencia.isSemPendenciaConferencia()) { + return encerrarMovimentoDiario(conferencia); + } + return suscribirOrActualizacion(conferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @Transactional + public Conferencia suscribirOrActualizacion(Conferencia entidad) { + if(entidad.getConferenciaId() == null) { + return suscribir(entidad); + } else { + return actualizacion(entidad); + } + } + + @Override + @Transactional + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException { + try { + conferencia.setIndconferido(Boolean.TRUE); + conferencia.setIndpendencia(isMovimentoDiarioPendencia(conferencia)); + conferencia.setIndboletogerado(isMovimentoDiarioBoletoGerado(conferencia)); + + gerarLancamentoContaCorrente(conferencia); + return suscribirOrActualizacion(conferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @Transactional + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException { + try { + conferencia.setIndconferido(Boolean.FALSE); + return suscribirOrActualizacion(conferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + private boolean isMovimentoDiarioBoletoGerado(Conferencia conferencia) throws BusinessException { + try { + Map parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta(), null); + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT FECHAMENTOCNTCORRENTE_ID ") + .append("FROM FECHAMENTO_CNTCORRENTE ") + .append("WHERE ACTIVO = 1 ") + .append("AND :datamovimento BETWEEN FECINIFECHAMENTO AND FECFINFECHAMENTO "); + + parametros.put("datamovimento", conferencia.getDatamovimento()); + + if(parametros.containsKey("empresaId")) { + sQuery.append("AND EMPRESA_ID = :empresaId "); + } + + if(parametros.containsKey("puntoventaId")) { + sQuery.append("AND PUNTOVENTA_ID = :puntoventaId "); + } + + log.info(sQuery.toString()); + + Query qr = getSession().createSQLQuery(sQuery.toString()); + setParametros(qr, parametros); + + return !qr.list().isEmpty(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + private boolean isMovimentoDiarioPendencia(Conferencia conferencia) { + Query qr = getSession().createQuery("SELECT COUNT(log) FROM LogConferencia log WHERE log.activo = 1 AND log.conferencia.conferenciaId = :conferenciaId AND log.status = :status"); + qr.setParameter("conferenciaId", conferencia.getConferenciaId()); + qr.setParameter("status", StatusLogConferencia.PENDENCIA); + return !qr.list().isEmpty() && ((Long)qr.list().get(0)) > 0; + } + + @Override + @SuppressWarnings({ "unchecked", "deprecation" }) + public List carregarEventosFinanceiros(Conferencia conferencia) throws BusinessException { + try { + Map parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta(), conferencia.getDatamovimento()); + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT EE.EVENTOEXTRA_ID AS \"eventoextraId\", EE.NUMDOCUMENTO AS \"numdocumento\", ") + .append("EE.IMPINGRESO AS \"impingreso\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", EE.DESCINFO AS \"descinfo\", ") + .append("LOG.STATUS AS \"status\", FP.FORMAPAGO_ID AS \"formapagoId\", FP.DESCPAGO AS \"descpago\", ") + .append("TEE.INDTIPO AS \"indtipo\", U.NOMBUSUARIO AS \"nombusuario\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", ") + .append("COMFP.COMEMPFORMAPAGO_ID AS \"comempformapagoId\", COMTEE.COMEMPTIPOEVENTOEXTRA_ID AS \"comemptipoeventoextraId\", ") + .append("CEC.INDEVENTOSFINANCEIROS AS \"exigeConferenciaAba\" ") + .append("FROM EVENTO_EXTRA EE ") + .append("JOIN TIPO_EVENTO_EXTRA TEE ON EE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID ") + .append("INNER JOIN USUARIO U ON EE.USUARIO_ID = U.USUARIO_ID ") + .append("LEFT JOIN COM_EMP_CONFERENCIA CEC ON EE.EMPRESA_ID = CEC.EMPRESA_ID AND CEC.ACTIVO = 1 ") + .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID AND LOG.ACTIVO = 1 ") + .append("LEFT JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = EE.FORMAPAGO_ID ") + .append("LEFT JOIN COM_EMP_FORMAPAGO COMFP ON COMFP.FORMAPAGO_ID = FP.FORMAPAGO_ID AND COMFP.EMPRESA_ID = EE.EMPRESA_ID AND COMFP.ACTIVO = 1 ") + .append("LEFT JOIN COM_EMP_TIPOEVENTOEXTRA COMTEE ON COMTEE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID AND COMTEE.EMPRESA_ID = EE.EMPRESA_ID AND COMTEE.ACTIVO = 1 ") + .append("WHERE EE.ACTIVO = 1 ") + .append("AND EE.FECHORINGRESO BETWEEN TO_DATE(:dataMovimentoInicial, 'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataMovimentoFinal, 'DD/MM/YYYY HH24:MI') "); + + if(parametros.containsKey("empresaId")) { + sQuery.append("AND EE.EMPRESA_ID = :empresaId "); + } + + if(parametros.containsKey("puntoventaId")) { + sQuery.append("AND EE.PUNTOVENTA_ID = :puntoventaId "); + } + + sQuery.append("ORDER BY TEE.DESCTIPOEVENTO "); + + log.info(sQuery.toString()); + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("eventoextraId", Hibernate.LONG) + .addScalar("numdocumento", Hibernate.STRING) + .addScalar("impingreso", Hibernate.BIG_DECIMAL) + .addScalar("desctipoevento", Hibernate.STRING) + .addScalar("descinfo", Hibernate.STRING) + .addScalar("status", Hibernate.INTEGER) + .addScalar("formapagoId", Hibernate.INTEGER) + .addScalar("descpago", Hibernate.STRING) + .addScalar("comempformapagoId", Hibernate.INTEGER) + .addScalar("comemptipoeventoextraId", Hibernate.INTEGER) + .addScalar("indtipo", Hibernate.STRING) + .addScalar("nombusuario", Hibernate.STRING) + .addScalar("logconferenciaId", Hibernate.LONG) + .addScalar("exigeConferenciaAba", Hibernate.BOOLEAN) + .setResultTransformer(Transformers.aliasToBean(EventosFinanceirosVO.class)); + setParametros(qr, parametros); + + return qr.list(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @SuppressWarnings({ "deprecation", "unchecked" }) + public List carregarLogConferencia(Conferencia conferencia) throws BusinessException { + try { + if(conferencia != null && conferencia.getConferenciaId() != null) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", LOG.OBSERVACAO AS \"observacao\", LOG.PRECO AS \"preco\", ") + .append("LOG.STATUS AS \"status\", B.NUMFOLIOSISTEMA AS \"numfoliosistema\", LOG.TIPO AS \"tipo\", ") + .append("O.NUMOPERACION AS \"numoperacion\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", U.NOMBUSUARIO AS \"nombusuario\", ") + .append("LOG.FECMODIF AS \"fecmodif\", LOG.INDCREDITO AS \"indcredito\", B.BOLETO_ID AS \"boletoId\", O.OCD_ID AS \"ocdId\", EE.EVENTOEXTRA_ID AS \"eventoextraId\" ") + .append("FROM LOG_CONFERENCIA LOG ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = LOG.BOLETO_ID ") + .append("LEFT JOIN EVENTO_EXTRA EE ON EE.EVENTOEXTRA_ID = LOG.EVENTOEXTRA_ID ") + .append("LEFT JOIN TIPO_EVENTO_EXTRA TEE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ") + .append("LEFT JOIN OCD O ON O.OCD_ID = LOG.OCD_ID ") + .append("JOIN USUARIO U ON U.USUARIO_ID = LOG.USUARIO_ID ") + .append("WHERE LOG.ACTIVO = 1 ") + .append("AND LOG.CONFERENCIA_ID = :conferenciaId "); + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("logconferenciaId", Hibernate.LONG) + .addScalar("observacao", Hibernate.STRING) + .addScalar("preco", Hibernate.BIG_DECIMAL) + .addScalar("status", Hibernate.INTEGER) + .addScalar("numfoliosistema", Hibernate.STRING) + .addScalar("tipo", Hibernate.INTEGER) + .addScalar("numoperacion", Hibernate.STRING) + .addScalar("desctipoevento", Hibernate.STRING) + .addScalar("nombusuario", Hibernate.STRING) + .addScalar("fecmodif", Hibernate.TIMESTAMP) + .addScalar("indcredito", Hibernate.BOOLEAN) + .addScalar("boletoId", Hibernate.LONG) + .addScalar("ocdId", Hibernate.LONG) + .addScalar("eventoextraId", Hibernate.LONG) + .setResultTransformer(Transformers.aliasToBean(LogConferenciaVO.class)); + qr.setParameter("conferenciaId", conferencia.getConferenciaId()); + + return qr.list(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + + return new ArrayList(); + } + + @Override + @Transactional + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) throws BusinessException { + try { + if(logConferencia.getConferencia().getConferenciaId() == null) { + logConferencia.setConferencia(suscribir(logConferencia.getConferencia())); + } + + getSession().save(logConferencia); + return logConferencia; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @Transactional + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException { + try { + if(logConferencia.getContaCorrentePtoVta() != null) { + ContaCorrentePtoVta contaCorrentePtoVta = logConferencia.getContaCorrentePtoVta(); + contaCorrentePtoVta.setActivo(Boolean.FALSE); + contaCorrentePtoVta.setFecmodif(logConferencia.getFecmodif()); + contaCorrentePtoVta.setUsuario(logConferencia.getUsuario()); + + contaCorrenteAgenciaDAO.actualizacion(contaCorrentePtoVta); + } + getSession().merge(logConferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId) { + try { + return (LogConferencia) this.getHibernateTemplate().get(LogConferencia.class.getName(), logconferenciaId); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + @Override + @SuppressWarnings({ "unchecked", "deprecation" }) + public List carregarBilhetesComissao(Conferencia conferencia) throws BusinessException { + try { + Map parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta(), conferencia.getDatamovimento()); + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT B.BOLETO_ID AS \"boletoId\", B.NUMASIENTO AS \"numAsiento\", B.NUMASIENTOVINCULADO AS \"numAsientoVinculado\", ") + .append("B.NUMOPERACION AS \"numoperacion\", B.NUMFOLIOSISTEMA AS \"numFolioSistema\", B.NUMSERIEPREIMPRESA AS \"numSeriePreimpresa\", ") + .append("B.NUMFOLIOPREIMPRESO AS \"numFolioPreImpreso\", EST.CVEESTADO AS \"uf\", CAT.DESCCATEGORIA AS \"desccategoria\", ") + .append("NVL(B.PRECIOPAGADO,0) AS \"valorpagado\", NVL(B.IMPORTEOUTROS,0) AS \"seguroOutros\", ") + .append("NVL(B.IMPORTEPEDAGIO,0) AS \"pedagio\", NVL(B.IMPORTESEGURO,0) AS \"seguro\", NVL(B.IMPORTETAXAEMBARQUE,0) AS \"embarque\", ") + .append("B.TIPOVENTA_ID AS \"tipoVenta\", B.INDSTATUSBOLETO AS \"indstatusboleto\", LOG.STATUS AS \"status\", ") + .append("FP.FORMAPAGO_ID AS \"formapagoId\", FP.DESCPAGO AS \"descpago\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", ") + .append("MC.DESCMOTIVO AS \"descmotivocancelacion\", U.NOMBUSUARIO AS \"nombusuario\", B.MOTIVOCANCELACION_ID AS \"motivocancelacionId\", ") + .append("BF.IMPORTE AS \"importeFp\", COMFP.COMEMPFORMAPAGO_ID AS \"comempformapagoId\", COMCAT.COMEMPCATEGORIA_ID AS \"comempcategoriaId\", ") + .append("BO1.TIPOVENTA_ID \"tipoVentaOriginal1\", BO2.TIPOVENTA_ID \"tipoVentaOriginal2\", OCD.OCD_ID \"ocdId\", ") + .append("B.NOMBPASAJERO AS \"nombpasajero\", E.INDCARBOLETOSDEVOLVIDOSCONF AS \"indcarboletosdevolvidosconf\", ") + .append("B.FECCORRIDA AS \"feccorrida\", B.CORRIDA_ID \"corridaId\" ") + .append("FROM BOLETO B ") + .append("LEFT JOIN BOLETO BO1 ON BO1.BOLETO_ID = B.BOLETOORIGINAL_ID ") + .append("LEFT JOIN BOLETO BO2 ON BO2.BOLETO_ID = BO1.BOLETOORIGINAL_ID ") + .append("LEFT JOIN OCD OCD ON B.BOLETOORIGINAL_ID = OCD.BOLETO_ID ") + .append("LEFT JOIN PARADA ORI ON ORI.PARADA_ID = B.ORIGEN_ID ") + .append("LEFT JOIN CIUDAD CID ON CID.CIUDAD_ID = ORI.PARADA_ID ") + .append("LEFT JOIN ESTADO EST ON EST.ESTADO_ID = CID.ESTADO_ID ") + .append("LEFT JOIN CATEGORIA CAT ON CAT.CATEGORIA_ID = B.CATEGORIA_ID ") + .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.BOLETO_ID = B.BOLETO_ID AND LOG.ACTIVO = 1 ") + .append("LEFT JOIN MOTIVO_CANCELACION MC ON MC.MOTIVOCANCELACION_ID = B.MOTIVOCANCELACION_ID ") + .append("INNER JOIN BOLETO_FORMAPAGO BF ON BF.BOLETO_ID = B.BOLETO_ID ") + .append("INNER JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = BF.FORMAPAGO_ID ") + .append("INNER JOIN USUARIO U ON B.USUARIO_ID = U.USUARIO_ID ") + .append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = B.MARCA_ID ") + .append("LEFT JOIN COM_EMP_FORMAPAGO COMFP ON COMFP.FORMAPAGO_ID = FP.FORMAPAGO_ID AND COMFP.EMPRESA_ID = B.EMPRESACORRIDA_ID AND COMFP.ACTIVO = 1 ") + .append("LEFT JOIN COM_EMP_CATEGORIA COMCAT ON COMCAT.CATEGORIA_ID = B.CATEGORIA_ID AND COMCAT.EMPRESA_ID = B.EMPRESACORRIDA_ID AND COMCAT.ACTIVO = 1 ") + .append("WHERE B.ACTIVO = 1 ") + .append("AND B.FECHORVENTA BETWEEN TO_DATE(:dataMovimentoInicial, 'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataMovimentoFinal, 'DD/MM/YYYY HH24:MI') "); + + if(parametros.containsKey("empresaId")) { + sQuery.append("AND B.MARCA_ID = :empresaId "); + } + + if(parametros.containsKey("puntoventaId")) { + sQuery.append("AND B.PUNTOVENTA_ID = :puntoventaId "); + } + + if(StringUtils.isNotBlank(conferencia.getNumfoliosistema())) { + sQuery.append("AND B.NUMFOLIOSISTEMA = :numfoliosistema "); + parametros.put("numfoliosistema", conferencia.getNumfoliosistema()); + } + + sQuery.append("ORDER BY B.BOLETO_ID "); + + log.info(sQuery.toString()); + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("boletoId", Hibernate.LONG) + .addScalar("numAsiento", Hibernate.STRING) + .addScalar("numAsientoVinculado", Hibernate.STRING) + .addScalar("numFolioSistema", Hibernate.STRING) + .addScalar("numSeriePreimpresa", Hibernate.STRING) + .addScalar("numFolioPreImpreso", Hibernate.STRING) + .addScalar("uf", Hibernate.STRING) + .addScalar("desccategoria", Hibernate.STRING) + .addScalar("valorpagado", Hibernate.BIG_DECIMAL) + .addScalar("seguroOutros", Hibernate.BIG_DECIMAL) + .addScalar("pedagio", Hibernate.BIG_DECIMAL) + .addScalar("seguro", Hibernate.BIG_DECIMAL) + .addScalar("embarque", Hibernate.BIG_DECIMAL) + .addScalar("tipoVenta", Hibernate.INTEGER) + .addScalar("indstatusboleto", Hibernate.STRING) + .addScalar("status", Hibernate.INTEGER) + .addScalar("formapagoId", Hibernate.INTEGER) + .addScalar("descpago", Hibernate.STRING) + .addScalar("logconferenciaId", Hibernate.LONG) + .addScalar("descmotivocancelacion", Hibernate.STRING) + .addScalar("nombusuario", Hibernate.STRING) + .addScalar("motivoCancelacionId", Hibernate.INTEGER) + .addScalar("importeFp", Hibernate.BIG_DECIMAL) + .addScalar("comempformapagoId", Hibernate.INTEGER) + .addScalar("comempcategoriaId", Hibernate.INTEGER) + .addScalar("numoperacion", Hibernate.STRING) + .addScalar("tipoVentaOriginal1", Hibernate.INTEGER) + .addScalar("tipoVentaOriginal2", Hibernate.INTEGER) + .addScalar("ocdId", Hibernate.INTEGER) + .addScalar("nombpasajero", Hibernate.STRING) + .addScalar("indcarboletosdevolvidosconf", Hibernate.BOOLEAN) + .addScalar("feccorrida", Hibernate.DATE) + .addScalar("corridaId", Hibernate.INTEGER) + .setResultTransformer(Transformers.aliasToBean(BoletoComissao.class)); + setParametros(qr, parametros); + + List lsBoletoComissao = new ArrayList(); + List auxLsBoletoComissao = qr.list(); + for (BoletoComissao boletoComissao : auxLsBoletoComissao) { + if(boletoComissao.getFormapagos() == null) { + boletoComissao.setFormapagos(new HashSet()); + } + + if(boletoComissao.getNumFolioSistema() != null && (boletoComissao.getNumFolioSistema().equals("210703") || boletoComissao.getNumFolioSistema().equals("216049"))) { + log.info(""); + } + + if(lsBoletoComissao.contains(boletoComissao)) { + BoletoComissao aux = lsBoletoComissao.get(lsBoletoComissao.indexOf(boletoComissao)); + aux.setComempcategoriaId(boletoComissao.getComempcategoriaId() != null ? boletoComissao.getComempcategoriaId() : aux.getComempcategoriaId()); + aux.setComempformapagoId(boletoComissao.getComempformapagoId() != null ? boletoComissao.getComempformapagoId() : aux.getComempformapagoId()); + aux.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(), boletoComissao.getDescpago(), boletoComissao.getIndconferenciafisicacomissao(), boletoComissao.getImporteFp())); + lsBoletoComissao.set(lsBoletoComissao.indexOf(boletoComissao), aux); + } else { + boletoComissao.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(), boletoComissao.getDescpago(), boletoComissao.getIndconferenciafisicacomissao(), boletoComissao.getImporteFp())); + lsBoletoComissao.add(boletoComissao); + } + } + + return lsBoletoComissao; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @SuppressWarnings({ "unchecked", "deprecation" }) + public List carregarOcds(Conferencia conferencia) throws BusinessException { + try { + Map parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta(), conferencia.getDatamovimento()); + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT O.OCD_ID AS \"ocdId\", O.NUMOPERACION AS \"numoperacion\", O.FECINC AS \"fecinc\", O.FECPAGAR AS \"fecpagar\", O.FECPAGO AS \"fecpago\", ") + .append("O.INDPAGO AS \"indpago\", O.VALOR_PAGAR AS \"valorPagar\", (B.PRECIOPAGADO * (O.PENALIZACION / 100)) AS \"penalizacion\", LOG.STATUS AS \"status\", ") + .append("U.NOMBUSUARIO AS \"nombusuario\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", U.CVEUSUARIO AS \"login\", B.NUMFOLIOSISTEMA AS \"numFolioSistema\", ") + .append("CEC.INDOCD AS \"exigeConferenciaAba\" ") + .append("FROM OCD O ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = O.BOLETO_ID ") + .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.OCD_ID = O.OCD_ID AND LOG.ACTIVO = 1 ") + .append("INNER JOIN USUARIO U ON O.USUARIOPAGO_ID = U.USUARIO_ID ") + .append("LEFT JOIN COM_EMP_CONFERENCIA CEC ON CEC.EMPRESA_ID = B.EMPRESACORRIDA_ID AND CEC.ACTIVO = 1 ") + .append("WHERE O.ACTIVO = 1 ") + .append("AND O.FECPAGO BETWEEN TO_DATE(:dataMovimentoInicial, 'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataMovimentoFinal, 'DD/MM/YYYY HH24:MI') ") + .append("AND O.INDPAGO = 1 "); + + if(parametros.containsKey("empresaId")) { + sQuery.append("AND B.EMPRESACORRIDA_ID = :empresaId "); + } + + if(parametros.containsKey("puntoventaId")) { + sQuery.append("AND O.PUNTOVENTAPAGO_ID = :puntoventaId "); + } + + log.info(sQuery.toString()); + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("ocdId", Hibernate.LONG) + .addScalar("numoperacion", Hibernate.STRING) + .addScalar("fecinc", Hibernate.DATE) + .addScalar("fecpagar", Hibernate.DATE) + .addScalar("fecpago", Hibernate.DATE) + .addScalar("indpago", Hibernate.BOOLEAN) + .addScalar("valorPagar", Hibernate.BIG_DECIMAL) + .addScalar("penalizacion", Hibernate.BIG_DECIMAL) + .addScalar("status", Hibernate.INTEGER) + .addScalar("nombusuario", Hibernate.STRING) + .addScalar("logconferenciaId", Hibernate.LONG) + .addScalar("login", Hibernate.STRING) + .addScalar("numFolioSistema", Hibernate.STRING) + .addScalar("exigeConferenciaAba", Hibernate.BOOLEAN) + .setResultTransformer(Transformers.aliasToBean(OcdVO.class)); + setParametros(qr, parametros); + + return qr.list(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException { + try { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT co ") + .append("FROM Conferencia co ") + .append("WHERE co.activo = 1 ") + .append("AND co.datamovimento = :datamovimento ") + .append("AND co.empresa.empresaId = :empresaId ") + .append("AND co.puntoVenta.puntoventaId = :puntoventaId "); + + log.info(sQuery.toString()); + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("datamovimento", datamovimento); + qr.setParameter("empresaId", empresaId); + qr.setParameter("puntoventaId", puntoventaId); + qr.setMaxResults(1); + return (Conferencia) qr.uniqueResult(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Transactional + private void gerarLancamentoContaCorrente(Conferencia conferencia) throws BusinessException { + try { + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DAY_OF_MONTH, 1); + + List lsLogConferencia = carregarLogConferencia(conferencia.getConferenciaId()); + String sDataMovimento = DateUtil.getStringDate(conferencia.getDatamovimento(), "dd/MM/yyyy"); + String descOperacion = "CONFERENCIA MOVIMENTO DIA - " + sDataMovimento; + + for (LogConferencia logConferencia : lsLogConferencia) { + if(logConferencia.getStatus().equals(StatusLogConferencia.CONFERIDO) || + ((logConferencia.getContaCorrentePtoVta() != null && + logConferencia.getContaCorrentePtoVta().getActivo() != null && + logConferencia.getContaCorrentePtoVta().getActivo())) || + (logConferencia.getPreco() == null || logConferencia.getPreco().doubleValue() == 0d)) { + continue; + } + + ContaCorrentePtoVta contaCorrentePtoVta = contaCorrenteAgenciaDAO.gravarContaCorrente(conferencia.getPuntoVenta().getPuntoventaId(), + descOperacion, cal.getTime(), conferencia.getUsuarioId(), + logConferencia.isIndcredito() ? Constantes.TIPO_OPERACION_CC_PAGO : Constantes.TIPO_OPERACION_CC_LQ, + conferencia.getEmpresa().getEmpresaId(), + Constantes.TURNO_AUTOMATICO, BigDecimal.ZERO, + BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, + BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, + BigDecimal.ZERO, logConferencia.getPreco(), false, + BigDecimal.ZERO, BigDecimal.ZERO, logConferencia.getPreco()); + + logConferencia.setContaCorrentePtoVta(contaCorrentePtoVta); + suscribirLogConferencia(logConferencia); + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @SuppressWarnings("unchecked") + public List carregarLogConferencia(Long conferenciaId) throws BusinessException { + try { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT log ") + .append("FROM LogConferencia log ") + .append("WHERE log.activo = 1 ") + .append("AND log.conferencia.conferenciaId = :conferenciaId "); + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("conferenciaId", conferenciaId); + return qr.list(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + try { + List lsConferencias = new ArrayList(); + + carregarConferenciasRegistradas(lsConferencias, competencia, empresa, puntoVenta); + carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta); + + for (ConferenciaComissaoVO conferenciaComissao : lsConferencias) { + for (DiaConferenciaComissaoVO diaConferenciaComissao : conferenciaComissao.getDias()) { + if(!diaConferenciaComissao.getIndsemmovimento() && !diaConferenciaComissao.getIndconferido()) { + return false; + } + } + } + + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public BigDecimal carregarValorDepositoContaCorrente(Integer empresaId, Integer puntoventaId, Date datamovimento) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT SUM(importeTotalEfectivo) ") + .append("FROM ContaCorrentePtoVta cc ") + .append("WHERE cc.activo = 1 ") + .append("AND cc.empresa.empresaId = :empresaId ") + .append("AND cc.puntoVenta.puntoventaId = :puntoventaId ") + .append("AND cc.fecHorOperacion = :datamovimento "); + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("empresaId", empresaId); + qr.setParameter("puntoventaId", puntoventaId); + qr.setParameter("datamovimento", datamovimento); + qr.setMaxResults(1); + + return (BigDecimal) qr.uniqueResult(); + } + + @Override + @SuppressWarnings("unchecked") + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + try { + String competencia = DateUtil.getStringDate(datamovimento, "MM/yyyy"); + Map parametros = carregarParametros(competencia, empresa, puntoVenta, null); + StringBuilder sQuery = new StringBuilder("SELECT co FROM Conferencia co "); + sQuery.append("JOIN co.empresa em ") + .append("JOIN co.puntoVenta pv ") + .append("WHERE co.activo = 1 ") + .append("AND co.datamovimento BETWEEN :dataInicial AND :dataFinal "); + + if(parametros.containsKey("empresaId")) { + sQuery.append("AND em.empresaId = :empresaId "); + } + + if(parametros.containsKey("puntoventaId")) { + sQuery.append("AND pv.puntoventaId = :puntoventaId "); + } + + log.info(sQuery.toString()); + Query qr = getSession().createQuery(sQuery.toString()); + setParametros(qr, parametros); + qr.setParameter("dataInicial", datamovimento); + qr.setParameter("dataFinal", datamovimento); + + List lsConferenciaComissao = new ArrayList(); + processarQueryConferencia(qr.list(), lsConferenciaComissao, competencia); + + if(!lsConferenciaComissao.isEmpty()) { + for (DiaConferenciaComissaoVO diaConferenciaComissao : lsConferenciaComissao.iterator().next().getDiasOrdenado()) { + if(diaConferenciaComissao.getData().equals(datamovimento)) { + return diaConferenciaComissao; + } + } + } + + return null; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfigRestriccionPagoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfigRestriccionPagoHibernateDAO.java new file mode 100644 index 000000000..73c1cf39f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfigRestriccionPagoHibernateDAO.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ConfigRestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("configRestriccionPagoDAO") +public class ConfigRestriccionPagoHibernateDAO + extends GenericHibernateDAO + implements ConfigRestriccionPagoDAO { + + @Autowired + public ConfigRestriccionPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("restriccion", restriccionPago)); + c.add(Restrictions.eq("formaPago", formaPago)); + + return c.list(); + } + + public Map buscar(FormaPago formaPago) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("formaPago", formaPago)); + + Map mapRespuesta = new LinkedHashMap(); + + List list = c.list(); + if (!list.isEmpty()) { + for (ConfigRestriccionPago crp : list) { + mapRespuesta.put(crp.getRestriccion().getRestriccionId().intValue(), crp); + } + } + + return mapRespuesta; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConstanteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConstanteHibernateDAO.java new file mode 100644 index 000000000..cec1db24f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConstanteHibernateDAO.java @@ -0,0 +1,57 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("constanteDAO") +public class ConstanteHibernateDAO extends GenericHibernateDAO + implements ConstanteDAO { + + @Autowired + public ConstanteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombconstante")); + + return c.list(); + } + + public Constante buscarPorNomeConstante(String nomeConstante) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombconstante", nomeConstante)); + + return (Constante) c.uniqueResult(); + } + + public List buscar(String nombconstante) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombconstante", nombconstante)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaCorrenteAgenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaCorrenteAgenciaHibernateDAO.java new file mode 100644 index 000000000..792d384fc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaCorrenteAgenciaHibernateDAO.java @@ -0,0 +1,74 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; + +import org.apache.log4j.Logger; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ContaCorrenteAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoOperacionCC; +import com.rjconsultores.ventaboletos.entidad.Turno; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +@Repository("contaCorrenteAgenciaDAO") +public class ContaCorrenteAgenciaHibernateDAO extends GenericHibernateDAO implements ContaCorrenteAgenciaDAO { + + private static Logger log = Logger.getLogger(ContaCorrenteAgenciaHibernateDAO.class); + + @Autowired + public ContaCorrenteAgenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @Transactional + public ContaCorrentePtoVta gravarContaCorrente(Integer puntoVentaId, String descOperacion, Date fecCorte, Integer usuarioId, Integer tipoOperacionCCId, Integer empresaId, short turnoId, BigDecimal importeTotalTarifa, BigDecimal importeTotalPedagio, BigDecimal importeTotalTasaAbordaje, BigDecimal importeTotalSeguro, BigDecimal importeTotalIngreso, BigDecimal importeTotalEgreso, BigDecimal importeTotalDevolucion, BigDecimal importeTotalTransferencia, BigDecimal importeFinal, boolean corteAutomatico, BigDecimal totalVentaSegOpcional, BigDecimal totalCancSegOpcional, BigDecimal importeTotalEfectivo) throws BusinessException { + try { + + ContaCorrentePtoVta ccPtoVta = new ContaCorrentePtoVta(); + ccPtoVta.setActivo(Boolean.TRUE); + ccPtoVta.setDescOperacion(descOperacion); + ccPtoVta.setEmpresa(new Empresa(empresaId)); + ccPtoVta.setFecmodif(Calendar.getInstance().getTime()); + ccPtoVta.setImporteTotalTarifa(importeTotalTarifa); + ccPtoVta.setImporteTotalPedagio(importeTotalPedagio); + ccPtoVta.setImporteTotalTasaAbordaje(importeTotalTasaAbordaje); + ccPtoVta.setImporteTotalSeguro(importeTotalSeguro); + ccPtoVta.setImporteTotalIngreso(importeTotalIngreso); + ccPtoVta.setImporteTotalEgreso(importeTotalEgreso); + ccPtoVta.setImporteTotalDevolucion(importeTotalDevolucion); + ccPtoVta.setImporteTotalTransferencia(importeTotalTransferencia); + ccPtoVta.setImporte(importeFinal); + ccPtoVta.setImporteTotalEfectivo(importeTotalEfectivo); + ccPtoVta.setPuntoVenta(new PuntoVenta(puntoVentaId)); + ccPtoVta.setTurno(new Turno(turnoId)); + ccPtoVta.setUsuarioModifId(usuarioId); + ccPtoVta.setUsuario(new Usuario(usuarioId)); + ccPtoVta.setTipoOperacionCC(new TipoOperacionCC(tipoOperacionCCId)); + ccPtoVta.setFecCorte(fecCorte); + ccPtoVta.setFecHorOperacion(fecCorte); + ccPtoVta.setTotalVentaSegOpcional(totalVentaSegOpcional); + ccPtoVta.setTotalCancSegOpcional(totalCancSegOpcional); + ccPtoVta.setIndComissao(Boolean.TRUE); + + getSession().save(ccPtoVta); + + return ccPtoVta; + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioDetHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioDetHibernateDAO.java new file mode 100644 index 000000000..1cdb9cf8f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioDetHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ConvenioDetDAO; +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("convenioDetDAO") +public class ConvenioDetHibernateDAO extends GenericHibernateDAO + implements ConvenioDetDAO { + + @Autowired + public ConvenioDetHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioHibernateDAO.java new file mode 100644 index 000000000..e92fb815b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.Convenio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("convenioDAO") +public class ConvenioHibernateDAO extends GenericHibernateDAO + implements ConvenioDAO { + + @Autowired + public ConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descconvenio")); + + return c.list(); + } + + public List buscar(String descconvenio, String cveconvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descconvenio", descconvenio)); + c.add(Restrictions.eq("cveconvenio", cveconvenio)); + + c.addOrder(Order.asc("descconvenio")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaCtrlHibernateDAO.java new file mode 100644 index 000000000..d8997da84 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaCtrlHibernateDAO.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CorridaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("corridaCtrlDAO") +public class CorridaCtrlHibernateDAO extends GenericHibernateDAO + implements CorridaCtrlDAO { + + @Autowired + public CorridaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, + Date horario, boolean isPisoExtra) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("horario", horario)); + + if (isPisoExtra) { + // CorridaCtrl para Piso Extra + c.add(Restrictions.eq("pisoExtra", true)); + } else { + // num piso == null ou false + c.add(Restrictions.or(Restrictions.not(Restrictions.eq("pisoExtra", true)), Restrictions.isNull("pisoExtra"))); + } + + List lsCorridaCtrl = c.list(); + + if ((lsCorridaCtrl == null) || (lsCorridaCtrl.isEmpty())) { + return null; + } else { + return lsCorridaCtrl.get(0); + } + } + + @Override + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca) { + StringBuilder hql = new StringBuilder(); + hql.append(" SELECT cc "); + hql.append(" FROM CorridaCtrl cc "); + hql.append(" INNER JOIN cc.ruta.rutaCombinacionList AS rutaCombinacionList "); + hql.append(" INNER JOIN rutaCombinacionList.tramo AS tramo"); + hql.append(" WHERE cc.activo = true "); + hql.append(" AND cc.corridaId = :corridaId "); + hql.append(" AND cc.marca.marcaId = :marcaId "); + hql.append(" AND cc.claseServicio = :claseservicioId "); + hql.append(" AND tramo.activo = true "); + hql.append(" AND tramo.origem.paradaId = :paradaOrigemId "); + hql.append(" AND tramo.destino.paradaId = :paradaDestinoId "); + hql.append(" AND rutaCombinacionList.activo = true "); + + Query sq = getSession().createQuery(hql.toString()); + sq.setInteger("corridaId", corridaId); + sq.setInteger("marcaId", marca.getMarcaId()); + sq.setInteger("claseservicioId", claseServicio.getClaseservicioId()); + sq.setInteger("paradaOrigemId", origem.getParadaId()); + sq.setInteger("paradaDestinoId", destino.getParadaId()); + + return (CorridaCtrl) sq.uniqueResult(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java new file mode 100644 index 000000000..179a1672f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java @@ -0,0 +1,702 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; + +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CorridaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Corrida.Id; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.utilerias.ActivoUtil; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +/** + * + * @author rodrigo + */ +@Repository("corridaDAO") +public class CorridaHibernateDAO extends GenericHibernateDAO implements CorridaDAO { + + @Autowired + private SQLBuilder sqlBuilder; + private static final Integer ULTIMA_HORA_DIA = Integer.valueOf(23); + private static final Integer ULTIMO_MINUTO_SEGUNDO = Integer.valueOf(59); + private static final Integer ULTIMO_MILLISEGUNDO = Integer.valueOf(99); + + @Autowired + public CorridaHibernateDAO(@Qualifier("sessionFactory") final SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public Boolean existe(final Id id) { + + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("id", id)); + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + @Override + public Corrida suscribir(final Corrida entity) { + + if (ApplicationProperties.getInstance().gerarCampoEquivalenciaCorrida()) { + String sql = "SELECT VTABOL.CORRIDA_EQUIVALENCIA_SEQ.NEXTVAL FROM DUAL"; + Object o = this.getSession().createSQLQuery(sql).uniqueResult(); + entity.setEquivalenciaId(o.toString()); + } + + Corrida corrida = super.suscribir(entity); + this.getSession().flush(); + return corrida; + } + + @Override + public List buscarPorAutobusCorridasFuturas(final DiagramaAutobus diagramaAutobus) { + String hql = " select co from Corrida co, Autobus ab " + + " where ab.autobusId = co.autobus.autobusId " + + " and ab.diagramaAutobus.diagramaautobusId = " + diagramaAutobus.getDiagramaautobusId() + + " and co.id.feccorrida > current_timestamp()"; + + Query sq = getSession().createQuery(hql); + + List lsCorridas = sq.list(); + + return lsCorridas; + } + + @Override + public List buscarPorRolOperativoCorridasFuturas(final DiagramaAutobus diagramaAutobus) { + String hql = " select co from Corrida co, RolOperativo rol " + + " where rol.roloperativoId = co.rolOperativo.roloperativoId " + + " and rol.diagramaAutobus.diagramaautobusId = " + diagramaAutobus.getDiagramaautobusId() + + " and co.id.feccorrida > current_timestamp()"; + + Query sq = getSession().createQuery(hql); + List lsCorridas = sq.list(); + + return lsCorridas; + } + + @Override + public List buscarPorFecCorrida(final Date value) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + + c.add(Restrictions.eq("id.feccorrida", value)); + + return c.list(); + } + + @Override + public Long count(final Ruta ruta) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + + } + + @Override + public List verificarCorridaId(Integer corridaId) { + + StringBuilder hql = new StringBuilder(); + hql.append("select distinct "); + hql.append(" new com.rjconsultores.ventaboletos.entidad.Corrida("); + hql.append(" c.id.corridaId, "); + hql.append(" c.origem, "); + hql.append(" c.destino) "); + hql.append("from "); + hql.append(" Corrida c "); + hql.append("where "); + hql.append(" 1 = 1 "); + hql.append(" and c.activo = 1 "); + hql.append(" and cast(c.id.corridaId as string) like :corridaId "); + hql.append(" group by "); + hql.append(" c.id.corridaId, "); + hql.append(" c.origem, "); + hql.append(" c.destino) "); + + Query sq = getSession().createQuery(hql.toString()); + + if (corridaId != null) { + sq.setParameter("corridaId", corridaId.toString() + '%'); + } else { + sq.setParameter("corridaId", '%'); + } + + return sq.list(); + } + + @Override + public List buscarPorId(final Integer idCorrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("id.corridaId", idCorrida)); + + return c.list(); + } + + @Override + public List buscarFiltro(final Parada ori, final Parada des, final Date hora, final ClaseServicio cs) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("origem", ori)); + c.add(Restrictions.eq("destino", des)); + c.add(Restrictions.between("fechorsalida", getDiaGeracaoHoraIni(hora), getDiaGeracaoHoraFim(hora))); + c.add(Restrictions.eq("claseServicio", cs)); + + return c.list(); + } + + @Override + public boolean count(final Parada ori, final Parada des, final Date hora, + final ClaseServicio cs, final boolean pisoExtra) { + + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("origem", ori)); + c.add(Restrictions.eq("destino", des)); + c.add(Restrictions.between("fechorsalida", getDiaGeracaoHoraIni(hora), getDiaGeracaoHoraFim(hora))); + c.add(Restrictions.eq("claseServicio", cs)); + + // Se for piso extra numPiso = 2 + if (pisoExtra) { + // Corrida Piso Extra + c.add(Restrictions.eq("numPiso", 2)); + } else { + // num piso == null ou diferente de 2 + c.add(Restrictions.or(Restrictions.not(Restrictions.eq("numPiso", 2)), Restrictions.isNull("numPiso"))); + } + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + private Date getDiaGeracaoHoraIni(final Date hora) { + Date dataCorreta = new Date(); + + // para pegar a hora e adicionar ao dia da geracao: + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(hora); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(hora); + gcalendar.set(Calendar.HOUR_OF_DAY, gAux.get(Calendar.HOUR_OF_DAY)); + gcalendar.set(Calendar.MINUTE, gAux.get(Calendar.MINUTE)); + gcalendar.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + gcalendar.set(Calendar.MILLISECOND, NumberUtils.INTEGER_ZERO); + + dataCorreta = gcalendar.getTime(); + + return dataCorreta; + } + + private Date getDiaGeracaoHoraFim(final Date hora) { + Date dataCorreta = new Date(); + + // para pegar a hora e adicionar ao dia da geracao: + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(hora); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(hora); + gcalendar.set(Calendar.HOUR_OF_DAY, gAux.get(Calendar.HOUR_OF_DAY)); + gcalendar.set(Calendar.MINUTE, gAux.get(Calendar.MINUTE)); + gcalendar.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + gcalendar.set(Calendar.MILLISECOND, ULTIMA_HORA_DIA); + + dataCorreta = gcalendar.getTime(); + + return dataCorreta; + } + + @Override + public List buscarDistinct(final Parada ori, final Parada des, final Date horaSalidaInicio, + final Date horaSalidaFin, final ClaseServicio cs, final Integer corridaId) { + StringBuilder hql = new StringBuilder(""); + hql.append("select distinct "); + hql.append(" new com.rjconsultores.ventaboletos.entidad.Corrida("); + hql.append(" c.marca, "); + hql.append(" c.id.corridaId, "); + hql.append(" c.origem, "); + hql.append(" c.destino, "); + hql.append(" c.claseServicio, "); + hql.append(" c.corridaCtrl.horario) "); + hql.append("from "); + hql.append(" Corrida c "); + hql.append("where "); + hql.append(" 1 = 1 "); + if (ori != null) { + hql.append(" and c.origem = :origen "); + } + if (des != null) { + hql.append(" and c.destino = :destino"); + } + if (cs != null) { + hql.append(" and c.claseServicio = :claseServicio "); + } + if (corridaId != null) { + hql.append(" and c.id.corridaId = :corridaId "); + } + if (horaSalidaInicio != null) { + + hql.append(" and c.corridaCtrl.horario >= :horaSalidaInicio"); + } + if (horaSalidaFin != null) { + + hql.append(" and c.corridaCtrl.horario <= :horaSalidaFin"); + } + + hql.append(" order by c.id.corridaId,c.corridaCtrl.horario"); + + Query query = getSession().createQuery(hql.toString()); + + if (ori != null) { + query.setParameter("origen", ori); + } + if (des != null) { + query.setParameter("destino", des); + } + if (cs != null) { + query.setParameter("claseServicio", cs); + } + if (corridaId != null) { + query.setParameter("corridaId", corridaId); + } + + if (horaSalidaInicio != null) { + + query.setParameter("horaSalidaInicio", horaSalidaInicio); + } + if (horaSalidaFin != null) { + query.setParameter("horaSalidaFin", horaSalidaFin); + + } + + return query.list(); + } + + @Override + public boolean existe(final Ruta ruta, final Date fecCorrida, final Date horaCorrida, + final ClaseServicio claseServicio, final Marca marca, final boolean pisoExtra) { + Calendar soloFecha = Calendar.getInstance(); + soloFecha.setTime(fecCorrida); + soloFecha.set(Calendar.HOUR, NumberUtils.INTEGER_ZERO); + soloFecha.set(Calendar.MINUTE, NumberUtils.INTEGER_ZERO); + soloFecha.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + soloFecha.set(Calendar.MILLISECOND, NumberUtils.INTEGER_ZERO); + + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("id.feccorrida", soloFecha.getTime())); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("marca", marca)); + + // Se for piso extra numPiso = 2 + if (pisoExtra) { + // Corrida Piso Extra + c.add(Restrictions.eq("numPiso", 2)); + } else { + // num piso == null ou diferente de 2 + c.add(Restrictions.or(Restrictions.not(Restrictions.eq("numPiso", 2)), Restrictions.isNull("numPiso"))); + } + + Criteria cCorridaCtrl = c.createCriteria("corridaCtrl"); + cCorridaCtrl.add(Restrictions.eq("horario", horaCorrida)); + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + @Override + public Long cantCorridaGeneradasHoy() { + Calendar cTmp1 = Calendar.getInstance(); + Calendar cTmp2 = Calendar.getInstance(); + + cTmp1.set(Calendar.HOUR_OF_DAY, NumberUtils.INTEGER_ZERO); + cTmp1.set(Calendar.MINUTE, NumberUtils.INTEGER_ZERO); + cTmp1.set(Calendar.MILLISECOND, NumberUtils.INTEGER_ZERO); + cTmp1.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + + cTmp2.set(Calendar.HOUR_OF_DAY, ULTIMA_HORA_DIA); + cTmp2.set(Calendar.MINUTE, ULTIMO_MINUTO_SEGUNDO); + cTmp2.set(Calendar.SECOND, ULTIMO_MINUTO_SEGUNDO); + cTmp2.set(Calendar.MILLISECOND, ULTIMO_MILLISEGUNDO); + + String sql = "select count(c.fecmodif) from Corrida c where c.fecmodif between :inicio and :fim"; + + Query query = getSession().createQuery(sql); + query.setParameter("inicio", cTmp1.getTime()); + query.setParameter("fim", cTmp2.getTime()); + Long count = HibernateFix.count(query.uniqueResult()); + + return count; + } + + public List buscarGroupCorrridaId(final Integer corridaId, final Integer origem, final Integer destino, + final Integer ruta, final Integer numRuta, final Date dateInicio, final Date dateFin) { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT c.corrida_id "); + sql.append(" FROM corrida c "); + if (numRuta != null) { + sql.append(" INNER JOIN Ruta r ON r.ruta_id=c.ruta_id "); + } + sql.append(" WHERE c.feccorrida BETWEEN :dateInicio AND :dateFin "); + sql.append(" AND c.corrida_id LIKE :corridaId "); + + if (origem != null) { + sql.append(" AND c.ORIGEN_ID=").append(origem); + } + if (destino != null) { + sql.append(" AND c.DESTINO_ID=").append(destino); + } + if (ruta != null) { + sql.append(" AND c.RUTA_ID=").append(ruta); + } + if (numRuta != null) { + sql.append(" AND r.NUMRUTA=").append(numRuta); + } + + sql.append(" GROUP BY c.corrida_id "); + + Query sq = getSession().createSQLQuery(sql.toString()); + + if (corridaId != null) { + sq.setParameter("corridaId", corridaId.toString() + '%'); + } else { + sq.setParameter("corridaId", '%'); + } + + sq.setParameter("dateInicio", dateInicio); + sq.setParameter("dateFin", dateFin); + + List lsObject = sq.list(); + + List lsCorridas = new ArrayList(); + + if (lsObject != null && !lsObject.isEmpty()) { + + for (Object object : lsObject) { + + BigDecimal id = (BigDecimal) object; + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM Corrida "); + hql.append(" WHERE id.corridaId = " + id); + + Query squery = getSession().createQuery(hql.toString()); + squery.setMaxResults(NumberUtils.INTEGER_ONE); + + List lsCorridasAux = squery.list(); + + if (lsCorridasAux != null && !lsCorridasAux.isEmpty()) { + lsCorridas.add(lsCorridasAux.iterator().next()); + } + } + } + + return lsCorridas; + } + + public List buscarGroupCorrridaId(final Integer corridaId, final Date dateInicio, final Date dateFin) { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT c.corrida_id "); + sql.append(" FROM corrida c "); + sql.append(" WHERE c.feccorrida BETWEEN :dateInicio AND :dateFin "); + sql.append(" AND c.corrida_id LIKE :corridaId "); + sql.append(" GROUP BY c.corrida_id "); + + Query sq = getSession().createSQLQuery(sql.toString()); + + if (corridaId != null) { + sq.setParameter("corridaId", corridaId.toString() + '%'); + } else { + sq.setParameter("corridaId", '%'); + } + + sq.setParameter("dateInicio", dateInicio); + sq.setParameter("dateFin", dateFin); + + List lsObject = sq.list(); + + List lsCorridas = new ArrayList(); + + if (lsObject != null && !lsObject.isEmpty()) { + + for (Object object : lsObject) { + + BigDecimal id = (BigDecimal) object; + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM Corrida "); + hql.append(" WHERE id.corridaId = " + id); + + Query squery = getSession().createQuery(hql.toString()); + squery.setMaxResults(NumberUtils.INTEGER_ONE); + + List lsCorridasAux = squery.list(); + + if (lsCorridasAux != null && !lsCorridasAux.isEmpty()) { + lsCorridas.add(lsCorridasAux.iterator().next()); + } + } + } + + return lsCorridas; + } + + @Override + public void actualizaFecHusoFecVerano(final Corrida corrida) { + + Integer corridaId = corrida.getId().getCorridaId(); + Date feccorrida = corrida.getId().getFeccorrida(); + + Query queryCorrida = getSession().createQuery( + sqlBuilder.getSQLActualizarCorridaFecHusoFecVerano()); + queryCorrida.setInteger("corridaId", corridaId); + queryCorrida.setInteger("corridaId", corridaId); + queryCorrida.setDate("feccorrida", feccorrida); + queryCorrida.executeUpdate(); + + Query queryCorridaTramo = getSession().createQuery( + sqlBuilder.getSQLActualizarCorridaTramoFecHusoFecVerano()); + queryCorridaTramo.setInteger("corridaId", corridaId); + queryCorridaTramo.setDate("feccorrida", feccorrida); + queryCorridaTramo.executeUpdate(); + } + + @Override + public void actualizaFecHusoFecVerano(final List corridas) { + + for (Corrida corrida : corridas) { + + Date husoHorVeranoLlegadaAnterior = null; + Date fechorSalidaOriginalUpdate = null; + Date fechorsalidaUpdate = null; + Date fechorllegadaUpdate = null; + Integer corridatramoId = 0; + Date fechorSalidaOriginal = null; + Date fechorsalida = null; + Date fechorllegada = null; + Integer tiempoHorHusoOrigem = Integer.valueOf(0); + Integer tiempoHorVeranoOrigem = Integer.valueOf(0); + Integer tiempoHorHusoDestino = Integer.valueOf(0); + Integer tiempoHorVeranoDestino = Integer.valueOf(0); + Date tiempoestancia = null; + + List tramos = buscarTramosCorrida(corrida); + + for (Object[] objeto : tramos) { + corridatramoId = Integer.valueOf(objeto[0].toString()); + fechorSalidaOriginal = (Date) objeto[2]; + fechorsalida = (Date) objeto[3]; + fechorllegada = (Date) objeto[4]; + tiempoHorHusoOrigem = Integer.valueOf(objeto[5].toString()); + tiempoHorVeranoOrigem = Integer.valueOf(objeto[6].toString()); + tiempoHorHusoDestino = Integer.valueOf(objeto[7].toString()); + tiempoHorVeranoDestino = Integer.valueOf(objeto[8].toString()); + tiempoestancia = (Date) objeto[9]; + + if (husoHorVeranoLlegadaAnterior == null) { + fechorSalidaOriginalUpdate = fechorSalidaOriginal; + fechorsalidaUpdate = fechorsalida; + } else { + fechorSalidaOriginalUpdate = husoHorVeranoLlegadaAnterior; + fechorsalidaUpdate = husoHorVeranoLlegadaAnterior; + } + + husoHorVeranoLlegadaAnterior = calcularHusoHorVeranoLlegada( + fechorsalida, + fechorllegada, + fechorsalidaUpdate, + tiempoHorHusoOrigem + tiempoHorVeranoOrigem, + tiempoHorHusoDestino + tiempoHorVeranoDestino); + + if(tiempoestancia != null) { + Calendar aux = Calendar.getInstance(); + aux.setTime(DateUtil.normalizar(husoHorVeranoLlegadaAnterior)); + aux.add(Calendar.MINUTE, tiempoestancia.getMinutes()); + aux.add(Calendar.HOUR_OF_DAY, tiempoestancia.getHours()); + + husoHorVeranoLlegadaAnterior = aux.getTime(); + + Calendar auxFechorsalidaUpdate = Calendar.getInstance(); + auxFechorsalidaUpdate.setTime(DateUtil.normalizar(fechorsalidaUpdate)); + auxFechorsalidaUpdate.add(Calendar.MINUTE, tiempoestancia.getMinutes()); + auxFechorsalidaUpdate.add(Calendar.HOUR_OF_DAY, tiempoestancia.getHours()); + + fechorsalidaUpdate = auxFechorsalidaUpdate.getTime(); + } + + if (husoHorVeranoLlegadaAnterior != null) { + fechorllegadaUpdate = husoHorVeranoLlegadaAnterior; + } else { + fechorllegadaUpdate = fechorllegada; + } + + Query queryCorridaTramo = getSession().createQuery(sqlBuilder.getSQLActualizarCorridaTramoFecHusoFecVerano()); + queryCorridaTramo.setTimestamp("fechorSalidaOriginalH", fechorSalidaOriginalUpdate); + queryCorridaTramo.setTimestamp("fechorsalidaH", fechorsalidaUpdate); + queryCorridaTramo.setTimestamp("fechorllegadaH", fechorllegadaUpdate); + queryCorridaTramo.setInteger("corridatramoId", corridatramoId); + queryCorridaTramo.executeUpdate(); + } + } + } + + private Date calcularHusoHorVeranoLlegada(Date fechorsalida, Date fechorllegada, Date fechorsalidaH, int tiempoOrigen, int tiempoDestino) { + Calendar horLlegada = null; + + // Si los tiempos son distintos, hube cambio de huso horario/horario de verano + + long elapsedMinutes = DateUtil.getElapsedMinutos(fechorsalida, fechorllegada); + + horLlegada = Calendar.getInstance(); + horLlegada.setTime(fechorsalidaH); + horLlegada.add(Calendar.MINUTE, (int) elapsedMinutes); + + if (tiempoOrigen != tiempoDestino) { + horLlegada.add(Calendar.HOUR, difHuso(tiempoOrigen, tiempoDestino)); + + } + + return (horLlegada == null) ? null : horLlegada.getTime(); + } + + private int difHuso(int a, int b) { + int mult = 0; + + if ((a < b) && (b <= 0)) { + mult = -1; + } else if ((a < b) && (a >= 0)) { + mult = -1; + } else if (a > b) { + mult = -1; + } else { + mult = 1; + } + + return ((Math.abs(a) - Math.abs(b)) * mult); + } + + @Override + public List buscarPorEstado(final Estado estado, final Date dataInicial, Integer corridaId) { + StringBuilder hql = new StringBuilder(); + + hql.append(" select "); + hql.append(" distinct new com.rjconsultores.ventaboletos.entidad.Corrida").append("("); + hql.append(" ct.corrida.id.corridaId, "); + hql.append(" ct.corrida.id.feccorrida").append(")"); + hql.append(" from CorridaTramo ct "); + hql.append(" left join ct.origem.ciudad.estado eo "); + hql.append(" left join ct.destino.ciudad.estado ed "); + hql.append(" where ct.corrida.activo = :isActivo "); + hql.append(" and ct.corrida.id.feccorrida >= :feccorrida "); + hql.append(" and ( eo.estadoId = :estadoId "); + hql.append(" or ed.estadoId = :estadoId )"); + if (corridaId != null) { + hql.append(" and ct.corrida.id.corridaId = :corridaId )"); + } + hql.append(" group by "); + hql.append(" ct.corrida.id.corridaId, "); + hql.append(" ct.corrida.id.feccorrida "); + + Query query = getSession().createQuery(hql.toString()); + query.setInteger("isActivo", ActivoUtil.ATIVO); + query.setDate("feccorrida", dataInicial); + query.setInteger("estadoId", estado.getEstadoId()); + + if (corridaId != null) { + query.setInteger("corridaId", corridaId); + } + + return query.list(); + } + + @Override + public List buscarPorEstado(final Estado estado, final Date dataInicial) { + return buscarPorEstado(estado, dataInicial, null); + } + + private List buscarTramosCorrida(final Corrida corrida) { + StringBuilder hql = new StringBuilder(); + + hql.append(" select "); + hql.append(" ct.corridatramoId, "); + hql.append(" ct.numsecuencia,"); + hql.append(" ct.fechorSalidaOriginal,"); + hql.append(" ct.fechorsalida,"); + hql.append(" ct.fechorllegada,"); + hql.append(" nvl(estadoO.tiempoHorHuso, 0) as tiempoHorHusoOrigem,"); + hql.append(" nvl( case when "); + hql.append(" ct.fechorSalidaOriginal between "); + hql.append(" estadoO.fecInicioHorVerano "); + hql.append(" and estadoO.fecFinoHorVerano "); + hql.append(" then (estadoO.tiempoHorVerano)"); + hql.append(" else 0 end, 0) as tiempoHorVeranoOrigem,"); + hql.append(" nvl(estadoD.tiempoHorHuso, 0) as tiempoHorHusoDestino,"); + hql.append(" nvl( case when "); + hql.append(" ct.fechorSalidaOriginal between "); + hql.append(" estadoD.fecInicioHorVerano "); + hql.append(" and estadoD.fecFinoHorVerano "); + hql.append(" then (estadoD.tiempoHorVerano)"); + hql.append(" else 0 end, 0) as tiempoHorVeranoDestino,"); + hql.append(" ct.tiempoEstancia "); + hql.append(" from CorridaTramo ct "); + hql.append(" inner join ct.origem origem "); + hql.append(" inner join origem.ciudad ciudadO "); + hql.append(" inner join ciudadO.estado estadoO "); + hql.append(" inner join ct.destino destino "); + hql.append(" inner join destino.ciudad ciudadD "); + hql.append(" inner join ciudadD.estado estadoD "); + + hql.append(" where ct.corrida.activo = :isActivo "); + hql.append(" and ct.activo = :isActivo "); + hql.append(" and ct.corrida.id.corridaId = :corridaId "); + hql.append(" and ct.corrida.id.feccorrida = :feccorrida "); + hql.append(" order by "); + hql.append(" ct.numsecuencia "); + + Query query = getSession().createQuery(hql.toString()); + query.setInteger("isActivo", ActivoUtil.ATIVO); + query.setDate("feccorrida", corrida.getId().getFeccorrida()); + query.setInteger("corridaId", corrida.getId().getCorridaId()); + + return query.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaTramoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaTramoHibernateDAO.java new file mode 100644 index 000000000..1cebe1112 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaTramoHibernateDAO.java @@ -0,0 +1,64 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CorridaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.utilerias.ActivoUtil; + +import java.math.BigDecimal; +import org.hibernate.Query; + +@Repository("corridaTramoDAO") +public class CorridaTramoHibernateDAO extends GenericHibernateDAO implements CorridaTramoDAO { + + @Autowired + public CorridaTramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTramoTarjetaEmitida() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.isNotNull("fechortarjetaviaje")); + c.add(Restrictions.isNull("indmanttarjeta")); + c.add(Restrictions.eq("numsecuencia", (short) 1)); + + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + + return c.list(); + } + + public List buscarTarjetaMesmaCorrida(CorridaTramo ct) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("corrida", ct.getCorrida())); + + return c.list(); + } + + public BigDecimal buscarSumTarjetaMesmaCorrida(CorridaTramo ct) { + + String hql = " select sum(t.kmReal) from CorridaTramo ct, Tramo t " + + " where ct.tramo.tramoId = t.tramoId and ct.activo = 1 " + + " and ct.corrida.id.corridaId = :id " + + " and ct.corrida.id.feccorrida = :data " + + " group by ct.corrida.id.corridaId,ct.corrida.id.feccorrida "; + + Query sq = getSession().createQuery(hql); + sq.setParameter("id", ct.getCorrida().getId().getCorridaId()); + sq.setDate("data", ct.getCorrida().getId().getFeccorrida()); + + BigDecimal km = (BigDecimal) sq.uniqueResult(); + + return km; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaBeneficiarioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaBeneficiarioHibernateDAO.java new file mode 100644 index 000000000..75245e218 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaBeneficiarioHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CortesiaBeneficiarioDAO; +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; +import java.io.Serializable; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("cortesiaBeneficiarioDAO") +public class CortesiaBeneficiarioHibernateDAO extends GenericHibernateDAO + implements CortesiaBeneficiarioDAO { + + @Autowired + public CortesiaBeneficiarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaDireccionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaDireccionHibernateDAO.java new file mode 100644 index 000000000..a2f28fe3d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaDireccionHibernateDAO.java @@ -0,0 +1,115 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CortesiaDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; + +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("cortesiaDireccionDAO") +public class CortesiaDireccionHibernateDAO extends GenericHibernateDAO + implements CortesiaDireccionDAO { + + @Autowired + public CortesiaDireccionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(Marca marca, ClaseServicio claseServicio, + Date fecInicio, Date fecFinal) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (fecInicio != null) { + c.add(Restrictions.eq("fecInicioV", fecInicio)); + } + + if (fecFinal != null) { + c.add(Restrictions.eq("fecFinV", fecFinal)); + } + + return c.list(); + } + + public List buscar(CortesiaDireccion cortesiaDireccion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + +// if (cortesiaDireccion.getFecInicioV() != null) { +// c.add(Restrictions.eq("fecInicioV", cortesiaDireccion.getFecInicioV())); +// } +// +// if (cortesiaDireccion.getFecFinV() != null) { +// c.add(Restrictions.eq("fecFinV", cortesiaDireccion.getFecFinV())); +// } + + if (cortesiaDireccion.getClaseServicio() != null) { + c.add(Restrictions.eq("claseServicio", cortesiaDireccion.getClaseServicio())); + } + + if (cortesiaDireccion.getMarca() != null) { + c.add(Restrictions.eq("marca", cortesiaDireccion.getMarca())); + } + + if (cortesiaDireccion.getTipocortesiaDescuento() != null) { + c.add(Restrictions.eq("tipocortesiaDescuento", + cortesiaDireccion.getTipocortesiaDescuento())); + } + + return c.list(); + } + + public List buscarFolio(CortesiaDireccion cortesiaDireccion) { + + Integer folioInicio = cortesiaDireccion.getNumFolioInicio(); + Integer folioFim = cortesiaDireccion.getNumFolioFin(); + + String hql = "select pv from CortesiaDireccion pv " + + " where pv.activo = 1 " + + " and tipocortesiaDescuento = " + cortesiaDireccion.getTipocortesiaDescuento().getTipocortesiadescuentoId() + + " and marca = " + cortesiaDireccion.getMarca().getMarcaId() + + " and claseServicio = " + cortesiaDireccion.getClaseServicio().getClaseservicioId() + + " and (((( " + folioInicio + " BETWEEN numFolioInicio AND numFolioFin ) " + + " OR " + folioFim + " BETWEEN numFolioInicio AND numFolioFin)) " + + " OR ((numFolioInicio BETWEEN " + folioInicio + " AND " + folioFim + ") " + + " OR (numFolioFin BETWEEN " + folioInicio + " AND " + folioFim + "))) "; + + Query sq = getSession().createQuery(hql); + + return sq.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaHibernateDAO.java new file mode 100644 index 000000000..e36705460 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaHibernateDAO.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CortesiaDAO; +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import com.rjconsultores.ventaboletos.entidad.Empleado; + +/** + * + * @author Shiro + */ +@Repository("cortesiaDAO") +public class CortesiaHibernateDAO extends GenericHibernateDAO + implements CortesiaDAO { + + @Autowired + public CortesiaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(Empleado empleado) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + if (empleado != null) { + c.add(Restrictions.eq("empleado", empleado)); + } + return c.list(); + } + + public Cortesia buscar(Cortesia cortesia) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + if (cortesia != null) { + c.add(Restrictions.eq("empleado", cortesia)); + } + return (Cortesia) c.uniqueResult(); + } + + public List buscarDplicidad(Cortesia cortesia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empleado", cortesia.getEmpleado())); + c.add(Restrictions.eq("marca", cortesia.getMarca())); + c.add(Restrictions.eq("claseServicio", cortesia.getClaseServicio())); + c.add(Restrictions.eq("origem", cortesia.getOrigem())); + c.add(Restrictions.eq("destino", cortesia.getDestino())); + c.add(Restrictions.eq("fecinicio", cortesia.getFecinicio())); + c.add(Restrictions.eq("fecfinal", cortesia.getFecfinal())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponConvenioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponConvenioHibernateDAO.java new file mode 100644 index 000000000..30dd0ad29 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponConvenioHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CuponConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; + +/** + * + * @author Shiro + */ +@Repository("cuponConvenioDAO") +public class CuponConvenioHibernateDAO extends GenericHibernateDAO + implements CuponConvenioDAO { + + @Autowired + public CuponConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(TipoConvenio tipoConvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (tipoConvenio != null) { + c.add(Restrictions.eq("tipoConvenio", tipoConvenio)); + } + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponSecretariaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponSecretariaHibernateDAO.java new file mode 100644 index 000000000..b3ed0965a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponSecretariaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CuponSecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("cuponSecretariaDAO") +public class CuponSecretariaHibernateDAO extends GenericHibernateDAO + implements CuponSecretariaDAO { + + @Autowired + public CuponSecretariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CursoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CursoHibernateDAO.java new file mode 100644 index 000000000..ba7b3b1b5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/CursoHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CursoDAO; +import com.rjconsultores.ventaboletos.entidad.Curso; + +@Repository("cursoDAO") +public class CursoHibernateDAO extends GenericHibernateDAO + implements CursoDAO { + + @Autowired + public CursoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nomcurso")); + + return c.list(); + } + + public List buscar(String nomcurso){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nomcurso", nomcurso)); + c.addOrder(Order.asc("nomcurso")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DepositoBancarioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DepositoBancarioHibernateDAO.java new file mode 100644 index 000000000..7143a1043 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DepositoBancarioHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.DepositoBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("depositoBancarioDAO") +public class DepositoBancarioHibernateDAO extends GenericHibernateDAO + implements DepositoBancarioDAO { + + @Autowired + public DepositoBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DescontoComissaoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DescontoComissaoHibernateDAO.java new file mode 100644 index 000000000..4ac1cd179 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DescontoComissaoHibernateDAO.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.DescontoComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; + +@Repository("descontoComissaoDAO") +public class DescontoComissaoHibernateDAO extends GenericHibernateDAO implements DescontoComissaoDAO { + + @Autowired + public DescontoComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaDescontoComissao(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo) { + + StringBuilder sql = new StringBuilder(); + sql.append("from DescontoComissao dc "); + sql.append("where activo = 1 "); + sql.append(" and dc.puntoVenta.puntoventaId = :puntoventaId "); + sql.append(" and dc.empresa.empresaId = :empresaId "); + sql.append(" and dc.datainicial >= :datainicial "); + sql.append(" and (dc.datafinal <= :datafinal or dc.datafinal is null)"); + + Query query = getSession().createQuery(sql.toString()); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + query.setTimestamp("datainicial", inicioPeriodo); + query.setTimestamp("datafinal", fimPeriodo); + + return query.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DetAbastoBoletoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DetAbastoBoletoHibernateDAO.java new file mode 100644 index 000000000..c2cc70ce5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DetAbastoBoletoHibernateDAO.java @@ -0,0 +1,131 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; + +@Repository("detAbastoBoletoDAO") +public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO + implements DetAbastoBoletoDAO { + + @Autowired + public DetAbastoBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public Long getSecuencia() { + + StringBuffer sql = new StringBuffer(); + sql.append(" select vtabol.nummovimiento_seq.nextval from dual "); + + Query query = getSession().createSQLQuery(sql.toString()); + + BigDecimal secuencia = (BigDecimal) query.uniqueResult(); + return secuencia.longValue(); + + } + + @Override + public List buscaDetAbastoBoletos(AbastoBoleto abastoBoleto) { + + List detAbastoBoletos = findByCriteria(Restrictions.eq("abastoBoleto", abastoBoleto)); + return detAbastoBoletos; + } + + @Override + public List buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) { + + StringBuilder queryString = new StringBuilder("from DetAbastoBoleto det where ") + .append(" det.abastoBoleto.estacion.estacionId = :origem") + .append(" and det.numseriepreimpresa = :numseriepreimpresa") + .append(" and (det.numfolioinicial >= :numfolioinicial and det.numfoliofinal <= :numfoliofinal) ") + .append(" order by det.detabastoboletoId"); + + Query query = getSession().createQuery(queryString.toString()); + query.setInteger("origem", origem.getEstacionId()); + query.setString("numseriepreimpresa", numseriepreimpresa); + query.setString("numfolioinicial", numfolioinicial); + query.setString("numfoliofinal", numfoliofinal); + + List detAbastoBoletos = query.list(); + + return detAbastoBoletos; + } + + @Transactional + public void desativaDetAbastos(List detAbastoBoletos) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for (DetAbastoBoleto det : detAbastoBoletos) { + det.setActivo(Boolean.FALSE); + session.update(det); + + if (++count % 20 == 0) { + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + + } + + @Override + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa) { + + StringBuilder qs = new StringBuilder(); + qs.append(" from DetAbastoBoleto det "); + qs.append(" where det.activo = 1 "); + qs.append(" and det.statusoperacion = 1 "); + qs.append(" and det.abastoBoleto.estacion.estacionId = :estacion "); + qs.append(" and det.numseriepreimpresa = :numseriepreimpresa "); + + Query query = getSession().createQuery(qs.toString()); + query.setInteger("estacion", estacion.getEstacionId()); + query.setString("numseriepreimpresa", numseriepreimpresa); + + List detAbastoBoletos = query.list(); + + return detAbastoBoletos; + } + + @Override + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf aidf){ + StringBuilder qs = new StringBuilder(); + + qs.append(" select detabastoboleto_id from det_abasto_boleto dat where numseriepreimpresa like ( "); + qs.append(" select (case when ( select (coalesce "); + qs.append(" ( "); + qs.append(" (select trim((select to_char( (select aidf_id from aidf where aidf_id = :aidf_id), '000' ) from dual )) from dual) , "); + qs.append(" '-_-_' "); + qs.append(" ) "); + qs.append(" ) from dual) = '-_-_' then '' else concat ((select trim((select to_char( (select aidf_id from aidf where aidf_id = :aidf_id), '000' ) from dual )) from dual) , '%' ) end ) from dual "); + qs.append(" "); + qs.append(" ) and dat.activo = 1 "); + + Query query = getSession().createSQLQuery(qs.toString()); + query.setLong("aidf_id", aidf.getAidfId()); + query.setLong("aidf_id", aidf.getAidfId()); + + return query.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DetDiagramaAutobusHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DetDiagramaAutobusHibernateDAO.java new file mode 100644 index 000000000..a83ff0e1a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DetDiagramaAutobusHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.DetDiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; + +/** + * + * @author Administrador + */ +@Repository("detDiagramaAutobusDAO") +public class DetDiagramaAutobusHibernateDAO extends GenericHibernateDAO implements DetDiagramaAutobusDAO { + + @Autowired + public DetDiagramaAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("diagramaAutobus.diagramaautobusId", Short.valueOf(diagramaAutobusId.toString()))); + c.add(Restrictions.eq("asiento", numAsiento)); + + return (DetDiagramaAutobus) c.uniqueResult(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DiagramaAutobusHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DiagramaAutobusHibernateDAO.java new file mode 100644 index 000000000..fb289ab28 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DiagramaAutobusHibernateDAO.java @@ -0,0 +1,110 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.DiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; + +/** + * + * @author Administrador + */ +@Repository("diagramaAutobusDAO") +public class DiagramaAutobusHibernateDAO extends GenericHibernateDAO + implements DiagramaAutobusDAO { + + private static final Logger log = LoggerFactory.getLogger(DiagramaAutobusHibernateDAO.class); + + @Autowired + public DiagramaAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descDiagrama")); + + return c.list(); + } + + public List buscar(String descDiagrama, Short maxparados, + Short cantasientos) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cantasientos", cantasientos)); + c.add(Restrictions.eq("maxparados", maxparados)); + c.add(Restrictions.eq("descDiagrama", descDiagrama)); + + return c.list(); + } + + public List buscar(String descDiagrama) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descDiagrama", descDiagrama)); + + return c.list(); + } + + @Override + public DiagramaAutobus suscribir(DiagramaAutobus entity) { + try { + this.getHibernateTemplate().save(entity); + getHibernateTemplate().flush(); + updateAsientosVendibles(entity); + + return entity; + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + @Override + public DiagramaAutobus actualizacion(DiagramaAutobus entity) { + entity = getHibernateTemplate().merge(entity); + getHibernateTemplate().flush(); + updateAsientosVendibles(entity); + return entity; + } + + private void updateAsientosVendibles(DiagramaAutobus entity) { + try{ + StringBuilder qry = new StringBuilder(); + qry.append("UPDATE diagrama_autobus "); + qry.append("SET CANTASIENTOSVENDIBLES = (SELECT Count(DD.detdiagramaautobus_id) "); + qry.append(" FROM det_diagrama_autobus DD "); + qry.append(" WHERE "); + qry.append(" DD.diagramaautobus_id = :diagramaautobus_id "); + qry.append(" AND DD.vendible = 1 "); + qry.append(" AND DD.activo = 1) "); + qry.append(" WHERE diagramaautobus_id = :diagramaautobus_id "); + + Query query = getSession().createSQLQuery(qry.toString()); + query.setShort("diagramaautobus_id", entity.getDiagramaautobusId()); + query.executeUpdate(); + } catch (final Exception ex) { + throw new RuntimeException("Erro ao atualizar qtd de assentos disponíveis",ex); + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DivisionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DivisionHibernateDAO.java new file mode 100644 index 000000000..8d9ef3167 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/DivisionHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.DivisionDAO; +import com.rjconsultores.ventaboletos.entidad.Division; + + +@Repository("divisionDAO") +public class DivisionHibernateDAO extends GenericHibernateDAO +implements DivisionDAO { + + @Autowired + public DivisionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpleadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpleadoHibernateDAO.java new file mode 100644 index 000000000..325173292 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpleadoHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import java.io.Serializable; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("empleadoDAO") +public class EmpleadoHibernateDAO extends GenericHibernateDAO + implements EmpleadoDAO { + + @Autowired + public EmpleadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisaClave(String empleadoClave) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("cveEmpleado", empleadoClave)); + + return c.list(); + } + + @Override + public List pesquisaEmpresa(Integer empresaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresa.empresaId", empresaId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaContaBancariaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaContaBancariaHibernateDAO.java new file mode 100644 index 000000000..949340afc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaContaBancariaHibernateDAO.java @@ -0,0 +1,27 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaContaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; + +@Repository("empresaContaBancariaDAO") +public class EmpresaContaBancariaHibernateDAO extends GenericHibernateDAO implements EmpresaContaBancariaDAO { + + @Autowired + public EmpresaContaBancariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public EmpresaContaBancaria suscribir(EmpresaContaBancaria entity) throws RuntimeException { + + entity = super.suscribir(entity); + + getSession().flush(); + return entity; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEquivalenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..2981ad4c2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEquivalenciaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EmpresaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("empresaEquivalenciaDAO") +public class EmpresaEquivalenciaHibernateDAO + extends GenericHibernateDAO + implements EmpresaEquivalenciaDAO { + + @Autowired + public EmpresaEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Empresa empresa, ComisionistaExterno comisionistaExterno) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(EmpresaEquivalencia empresaEquivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("equivalenciaId", empresaEquivalencia.getEquivalenciaId())); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java new file mode 100644 index 000000000..7c5bae481 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java @@ -0,0 +1,253 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.sql.DataSource; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Administrador + */ +@Repository("empresaDAO") +public class EmpresaHibernateDAO extends GenericHibernateDAO implements EmpresaDAO { + + @Autowired + private DataSource dataSource; + + @Autowired + public EmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ne("empresaId", -1)); + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + public List buscar(String nombempresa, Boolean indExterna, Short indTipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombempresa", nombempresa)); + c.add(Restrictions.eq("indExterna", indExterna)); + c.add(Restrictions.eq("indTipo", indTipo)); + c.add(Restrictions.ne("empresaId", -1)); + + return c.list(); + } + + public List buscarTodosExceto(List empresa, Integer... idEmpresa) { + if (idEmpresa == null || idEmpresa.length == 0) { + return empresa; + } + + List empresaList = new ArrayList(); + List lsEmpresa = Arrays.asList(idEmpresa); + for (Empresa e : empresa) { + if (!lsEmpresa.contains(e.getEmpresaId())) { + empresaList.add(e); + } + } + + return empresaList; + + } + + public List obtenerIndExternoFalse() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indExterna", Boolean.FALSE)); + c.add(Restrictions.ne("empresaId", -1)); + + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + public List obtenerIndTipo2() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indTipo", new Short("2"))); + + // Nao Buscar Empresa todas + c.add(Restrictions.ne("empresaId", -1)); + + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta) { + StringBuilder sb = new StringBuilder(); + + sb.append(" select em "); + sb.append(" from Empresa em "); + sb.append(" where em.activo = 1 "); + sb.append(" and em.empresaId not in ( "); + sb.append(" select pc.empresaId.empresaId from PtovtaComissao pc "); + sb.append(" where pc.activo = 1 and pc.puntoventaId.puntoventaId = :puntoventaId "); + sb.append(" )"); + sb.append(" and em.empresaId != -1 "); + sb.append(" order by em.nombempresa"); + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("puntoventaId", puntoVenta.getPuntoventaId()); + + List lsEmpresa = query.list(); + + return lsEmpresa; + + } + + @Override + public List buscaInscricoesEstaduais(Empresa empresa) { + + Criteria c = getSession().createCriteria(InscricaoEstadual.class); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual) { + + Session session = getSessionFactory().getCurrentSession(); + session.saveOrUpdate(inscricaoEstadual); + session.flush(); + } + + @Override + public List buscaLike(String nombempresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("nombempresa", nombempresa, MatchMode.START)); + c.add(Restrictions.ne("empresaId", -1)); + + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + @Override + public Empresa suscribir(Empresa entity) throws RuntimeException { + + entity = super.suscribir(entity); + + getSession().flush(); + + gerarSeqNumFolioSistema(entity.getEmpresaId()); + + return entity; + } + + private void gerarSeqNumFolioSistema(Integer idEmpresa) throws RuntimeException { + try { + Connection conn = dataSource.getConnection(); + if (!conn.createStatement().executeQuery("select SEQUENCE_NAME from DBA_SEQUENCES where SEQUENCE_NAME like 'FOLIO_SISTEMA_" + idEmpresa + "_SEQ%'").next()) { + String[] sequences = { "AC", "AL", "AM", "AP", "BA", "CE", "DF", "ES", "GO", "MA", "MG", "MS", "MT", "PA", "PB", "PE", "PI", "PR", "RJ", "RN", "RO", "RR", "RS", "SC", "SE", "SP", "TO" }; + + for (String sequence : sequences) { + conn.createStatement().execute("CREATE SEQUENCE VTABOL.FOLIO_SISTEMA_" + (sequence == "" ? sequence : (sequence + "_") + idEmpresa + "_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE")); + } + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodosIncluindoEmpresaTodas() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + @Override + @Transactional + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria) { + getSession().save(comEmpCategoria); + return comEmpCategoria; + } + + @Override + @Transactional + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria) { + getSession().merge(comEmpCategoria); + } + + @Override + @Transactional + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago) { + getSession().save(comEmpFormapago); + return comEmpFormapago; + } + + @Override + @Transactional + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago) { + getSession().merge(comEmpFormapago); + } + + @Override + @Transactional + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + getSession().save(comEmpTipoEventoExtra); + return comEmpTipoEventoExtra; + } + + @Override + @Transactional + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + getSession().merge(comEmpTipoEventoExtra); + } + + @Override + public ComEmpConferencia suscribir(ComEmpConferencia comEmpConferencia) { + getSession().save(comEmpConferencia); + return comEmpConferencia; + } + + @Override + public ComEmpConferencia actualizacion(ComEmpConferencia comEmpConferencia) { + getSession().merge(comEmpConferencia); + return comEmpConferencia; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java new file mode 100644 index 000000000..e52c1eb26 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaImpostoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Repository("empresaImpostoDAO") +public class EmpresaImpostoHibernateDAO extends GenericHibernateDAO + implements EmpresaImpostoDAO { + + @Autowired + public EmpresaImpostoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarEmpresaImposto(Integer empresaId) { + + StringBuilder hql = new StringBuilder(); + hql.append(" from EmpresaImposto ei "); + hql.append(" where ei.activo = 1 "); + hql.append(" AND ei.empresa.empresaId = :empresaId "); + + Query query = getSession().createQuery(hql.toString()); + query.setInteger("empresaId", empresaId); + + return query.list(); + } + + @Override + public List buscarByEmpresa(Empresa empresa) { + return buscarEmpresaImposto(empresa.getEmpresaId()); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EnderecoApanheHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EnderecoApanheHibernateDAO.java new file mode 100644 index 000000000..f85872734 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EnderecoApanheHibernateDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EnderecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; + +@Repository("enderecoApanheDAO") +public class EnderecoApanheHibernateDAO extends GenericHibernateDAO implements EnderecoApanheDAO { + + @Autowired + public EnderecoApanheHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Date datapacote, String numoperacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if(datapacote != null) { + c.add(Restrictions.eq("hotel.datapacote", datapacote)); + } + + if(StringUtils.isNotBlank(numoperacion)) { + c.add(Restrictions.eq("hotel.numoperacion", numoperacion)); + } + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EscolaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EscolaHibernateDAO.java new file mode 100644 index 000000000..d3da54f64 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EscolaHibernateDAO.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EscolaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; + +@Repository("escolaDAO") +public class EscolaHibernateDAO extends GenericHibernateDAO + implements EscolaDAO { + + @Autowired + public EscolaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombescola")); + + return c.list(); + } + + @Override + public List buscar(String nombescola, Ciudad ciudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombescola", nombescola)); + c.add(Restrictions.eq("ciudad", ciudad)); + c.addOrder(Order.asc("nombescola")); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAgrupacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAgrupacionHibernateDAO.java new file mode 100644 index 000000000..c0d44b705 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAgrupacionHibernateDAO.java @@ -0,0 +1,86 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EsquemaAgrupacionDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; + +/** + * + * @author RJ Consultores + */ +@Repository("esquemaAgrupacionDAO") +public class EsquemaAgrupacionHibernateDAO extends GenericHibernateDAO implements EsquemaAgrupacionDAO { + + @Autowired + public EsquemaAgrupacionHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public EsquemaAgrupacion suscribir(final EsquemaAgrupacion entity) { + + String sql = "SELECT VTABOL.ESQUEMA_AGRUPACION_SEQ.NEXTVAL FROM DUAL"; + Object o = this.getSession().createSQLQuery(sql).uniqueResult(); + entity.setEsquemaagrupacionId(Integer.valueOf(o.toString())); + + EsquemaAgrupacion esquemaAgrupacion = super.suscribir(entity); + this.getSession().flush(); + return esquemaAgrupacion; + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(EsquemaAgrupacion esquemaAgrupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("esquemaAgrupacion", esquemaAgrupacion)); + return c.list(); + } + + public EsquemaAgrupacion obtenerByEsquemaAgrupacion( + Integer ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("numagrupacion", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (EsquemaAgrupacion) c.uniqueResult(); + } + + @Override + public boolean buscarNumAgrupacion(Integer numAgrupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("numagrupacion", numAgrupacion)); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAsientoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAsientoHibernateDAO.java new file mode 100644 index 000000000..5a41a4274 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAsientoHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EsquemaAsientoDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("esquemaAsientoHibernateDAO") +public class EsquemaAsientoHibernateDAO extends GenericHibernateDAO implements EsquemaAsientoDAO { + + @Autowired + public EsquemaAsientoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", esquemaCorrida)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", esquemaCorrida)); + c.add(Restrictions.eq("numasiento", asiento)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + EsquemaAsiento ea = new EsquemaAsiento(); + + List lsAsientos = c.list(); + + if (!lsAsientos.isEmpty()) { + ea = lsAsientos.get(0); + } + + return ea; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaHibernateDAO.java new file mode 100644 index 000000000..0207f215d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaHibernateDAO.java @@ -0,0 +1,204 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; + +/** + * + * @author Rafius + */ +@Repository("esquemaCorridaDAO") +public class EsquemaCorridaHibernateDAO extends GenericHibernateDAO implements EsquemaCorridaDAO { + + @Autowired + public EsquemaCorridaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorEmpresaCorrida(Empresa empresa){ + StringBuilder sb = new StringBuilder(); + sb.append("from EsquemaCorrida ec where ec.empresa.empresaId= :empresaId and activo = 1" ); + + Query qry = getSession().createQuery(sb.toString()); + qry.setInteger("empresaId", empresa.getEmpresaId()); + + return qry.list(); + } + + public List buscarPorEsquemaOperacional( + EsquemaOperacional eo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("esquemaOperacional", eo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public EsquemaCorrida obtenerByEsquemaCorrida( + Integer ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("numCorrida", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + List result = c.list(); + if(!result.isEmpty()){ + return (EsquemaCorrida) result.get(NumberUtils.INTEGER_ZERO); + } + return null; + } + + public List buscar(Marca marca, RolOperativo rolOperativo, + Ruta ruta, ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("rolOperativo", rolOperativo)); + + return c.list(); + } + + public boolean esHijoRebote(EsquemaCorrida esquemaCorrida) { + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("esquemaCorridaRebote", esquemaCorrida)); + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + @Override + public List buscaDentroVigencia(Date dataGeracao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaOperacional"); + cEsquemaOperacional.add(Restrictions.le("fecniciovigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.isNull("cantDiasGeneracion")); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaOperacional"); + cEsquemaOperacional.add(Restrictions.le("fecniciovigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaTramoList"); + cEsquemaOperacional.add(Restrictions.eq("tramo", tramo)); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + } + + public List existe(Ruta ruta, Integer paradaId) { + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cEsquemaTramo = c.createCriteria("esquemaTramoList"); + cEsquemaTramo.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cTramo = cEsquemaTramo.createCriteria("tramo"); + + Disjunction or = Restrictions.disjunction(); + or.add(Restrictions.eq("origem.paradaId", paradaId)); + or.add(Restrictions.eq("destino.paradaId", paradaId)); + + cTramo.add(or); + + c.setProjection(Projections.property("esquemacorridaId")); + + return c.list(); + } + + @Override + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + Disjunction or = Restrictions.disjunction(); + + or.add(Restrictions.or(Restrictions.eq("numCorridaPisoExtra", numCorridaPisoExtra), Restrictions.eq("numCorrida", numCorrida))); + or.add(Restrictions.eq("numCorrida", numCorridaPisoExtra)); + + c.add(or); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + } + + @Override + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataGeracao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.isNotNull("cantDiasGeneracion")); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaOperacional"); + cEsquemaOperacional.add(Restrictions.le("fecniciovigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaOperacionalHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaOperacionalHibernateDAO.java new file mode 100644 index 000000000..ab3332515 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaOperacionalHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EsquemaOperacionalDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("esquemaOperacional") +public class EsquemaOperacionalHibernateDAO extends GenericHibernateDAO + implements EsquemaOperacionalDAO { + + @Autowired + public EsquemaOperacionalHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.le("fecniciovigencia", dataGeracao)); + c.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.le("fecniciovigencia", dataDe)); + c.add(Restrictions.ge("fecfinvigencia", dataAte)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaTramoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaTramoHibernateDAO.java new file mode 100644 index 000000000..2cda22797 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaTramoHibernateDAO.java @@ -0,0 +1,57 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EsquemaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("esquemaTramoDAO") +public class EsquemaTramoHibernateDAO extends GenericHibernateDAO + implements EsquemaTramoDAO { + + @Autowired + public EsquemaTramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numsecuencia")); + + return c.list(); + } + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", esquemaCorrida)); + //c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numsecuencia")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java new file mode 100644 index 000000000..384aa32a1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java @@ -0,0 +1,177 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EstacionDAO; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +@Repository("estacionDAO") +public class EstacionHibernateDAO extends GenericHibernateDAO implements EstacionDAO { + + @Autowired + public EstacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descestacion")); + + return c.list(); + } + + public List buscar(String descEstacion, String descMac, Long nunCaja, PuntoVenta pv) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descestacion", descEstacion)); + c.add(Restrictions.eq("descmac", descMac)); + c.add(Restrictions.eq("numcaja", nunCaja)); + c.add(Restrictions.eq("puntoVenta", pv)); + + return c.list(); + } + + public List buscar(String descMac) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmac", descMac)); + + return c.list(); + } + + @Override + public List buscar(Long numCaja, PuntoVenta puntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numcaja", numCaja)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + + return c.list(); + } + + public List buscarEstaciones(PuntoVenta puntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.addOrder(Order.asc("numcaja")); + c.addOrder(Order.asc("descestacion")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + @Override + public List buscarPuntosVentaEstacionPorUsuario(Usuario usuario) { + Criteria buscaPuntoVentasUsuario = getSession().createCriteria(getPersistentClass()) + .setProjection(Projections.distinct(Property.forName("puntoVenta"))) + .add(Restrictions.eq("activo", Boolean.TRUE)) + .add(Restrictions.eq("usuarioId", usuario.getUsuarioId())); + + return buscaPuntoVentasUsuario.list(); + } + + public Boolean temEstoque(PuntoVenta puntoVenta, Estacion estacion) { + + StringBuilder sb = new StringBuilder(); + sb.append("select dab.numseriepreimpresa as serie, "); + sb.append(" dab.numfolioinicial as folioinicial, "); + sb.append(" dab.numfoliofinal as foliofinal, "); + sb.append(" pv.nombpuntoventa as descpuntoventa, "); + sb.append(" e.numcaja as numcaja, "); + sb.append(" e.descestacion as descestacion, "); + sb.append(" fp.foliopreimpreso as folioatual, "); + sb.append(" e.estacion_id as estacionid, "); + sb.append(" ab.articulo_id as articuloid, "); + sb.append(" a.descarticulo as tipo, "); + sb.append(" em.nombempresa as nombempresa, "); + sb.append(" em.empresa_id as empresaid "); + sb.append("from det_abasto_boleto dab "); + sb.append(" inner join abasto_boleto ab "); + sb.append(" on dab.abastoboleto_id = ab.abastoboleto_id "); + sb.append(" inner join punto_venta pv "); + sb.append(" on ab.puntoventa_id = pv.puntoventa_id "); + sb.append(" inner join estacion e "); + sb.append(" on ab.estacion_id = e.estacion_id "); + sb.append(" inner join folio_preimpreso fp "); + sb.append(" on fp.estacion_id = ab.estacion_id "); + sb.append(" and fp.empresa_id = ab.empresa_id "); + sb.append(" and ( fp.numeserie = dab.numseriepreimpresa "); + sb.append(" or ( fp.numeserie is null "); + sb.append(" and dab.numseriepreimpresa is null ) ) "); + sb.append(" left join articulo a "); + sb.append(" on a.articulo_id = ab.articulo_id "); + sb.append(" left join empresa em "); + sb.append(" on em.empresa_id = ab.empresa_id "); + sb.append("where dab.statusoperacion = 1 "); + sb.append(" and fp.activo = 1 "); + sb.append(" and dab.activo = 1 "); + sb.append(" and ab.puntoventa_id = :puntoventaId "); + sb.append(" and e.estacion_id = :estacionId "); + sb.append("union "); + sb.append("select dab.numseriepreimpresa as serie, "); + sb.append(" dab.numfolioinicial as folioinicial, "); + sb.append(" dab.numfoliofinal as foliofinal, "); + sb.append(" pv.nombpuntoventa as descpuntoventa, "); + sb.append(" e.numcaja as numcaja, "); + sb.append(" e.descestacion as descestacion, "); + sb.append(" dab.numfolioinicial as folioatual, "); + sb.append(" e.estacion_id as estacionid, "); + sb.append(" ab.articulo_id as articuloid, "); + sb.append(" a.descarticulo as tipo, "); + sb.append(" em.nombempresa as nombempresa, "); + sb.append(" em.empresa_id as empresaid "); + sb.append("from det_abasto_boleto dab "); + sb.append(" inner join abasto_boleto ab "); + sb.append(" on dab.abastoboleto_id = ab.abastoboleto_id "); + sb.append(" inner join punto_venta pv "); + sb.append(" on ab.puntoventa_id = pv.puntoventa_id "); + sb.append(" inner join estacion e "); + sb.append(" on ab.estacion_id = e.estacion_id "); + sb.append(" left join articulo a "); + sb.append(" on a.articulo_id = ab.articulo_id "); + sb.append(" left join empresa em "); + sb.append(" on em.empresa_id = ab.empresa_id "); + sb.append("where dab.statusoperacion = 0 "); + sb.append(" and dab.activo = 1 "); + sb.append(" and ab.puntoventa_id = :puntoventaId "); + sb.append(" and e.estacion_id = :estacionId "); + + SQLQuery query = getSession().createSQLQuery(sb.toString()); + query.setParameter("puntoventaId", puntoVenta.getPuntoventaId()); + query.setParameter("estacionId", estacion.getEstacionId()); + + List list = query.list(); + if (list.size() > 0) + return true; + else + return false; + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java new file mode 100644 index 000000000..2b75143a8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EstadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author MCosso + */ +@Repository("estadoDAO") +public class EstadoHibernateDAO extends GenericHibernateDAO + implements EstadoDAO { + + @Autowired + public EstadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombestado")); + + return c.list(); + } + + public List buscar(String nombestado, Pais pais) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombestado", nombestado)); + c.add(Restrictions.eq("pais", pais)); + + return c.list(); + } + + public List buscarNotInEmpresaImposto(Empresa empresa) { + StringBuilder sb = new StringBuilder(); + + sb.append(" select es "); + sb.append(" from Estado es "); + sb.append(" where es.activo = 1 "); + sb.append(" and es.estadoId not in ( "); + sb.append(" select ei.estado.estadoId from EmpresaImposto ei "); + sb.append(" where ei.activo = 1 and ei.empresa.empresaId =:empresaId "); + sb.append(" )"); + sb.append(" order by es.nombestado"); + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("empresaId", empresa.getEmpresaId()); + + List lsEstado = query.list(); + + return lsEstado; + } + + @Override + public List buscarCveEstado(String cveEstado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("cveestado", cveEstado)); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EventoExtraHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EventoExtraHibernateDAO.java new file mode 100644 index 000000000..77d27e5c4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/EventoExtraHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +@Repository("eventoExtraDAO") +public class EventoExtraHibernateDAO extends + GenericHibernateDAO implements EventoExtraDAO { + + @Autowired + public EventoExtraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("tipoeventoextraId", tipoEventoExtra.getTipoeventoextraId())); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java new file mode 100644 index 000000000..3c9867885 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Hibernate; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ExcepcionPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; + +@Repository("excepcionPeajeDAO") +public class ExcepcionPeajeHibernateDAO extends GenericHibernateDAO +implements ExcepcionPeajeDAO { + + @Autowired + public ExcepcionPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(String descconvenio, String cveconvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descconvenio", descconvenio)); + c.add(Restrictions.eq("cveconvenio", cveconvenio)); + + c.addOrder(Order.asc("descconvenio")); + + return c.list(); + } + + public List obtenerTodos() { + Session session = getSession(); + session.enableFilter("ativo"); + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + List list = (List)c.list(); + for (ExcepcionPeaje excepcionPeaje : list) { + if(!Hibernate.isInitialized(excepcionPeaje.getLsExcepcionPeajeVigencia())){ + Hibernate.initialize(excepcionPeaje.getLsExcepcionPeajeVigencia()); + } + } + return list; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionRedondoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionRedondoHibernateDAO.java new file mode 100644 index 000000000..fd178be63 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionRedondoHibernateDAO.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ExcepcionRedondoDAO; +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("excepcionRedondoDAO") +public class ExcepcionRedondoHibernateDAO extends GenericHibernateDAO implements ExcepcionRedondoDAO { + + @Autowired + public ExcepcionRedondoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("indtipo")); + + return c.list(); + } + + public List buscar(String indTipo, Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("indtipo", indTipo)); + + c.addOrder(Order.asc("indtipo")); + + return c.list(); + } + + @Override + public List buscar(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamgeralHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamgeralHibernateDAO.java new file mode 100644 index 000000000..8a7af369b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamgeralHibernateDAO.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamgeralDAO; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("fechamentoParamgeralDAO") +public class FechamentoParamgeralHibernateDAO extends GenericHibernateDAO implements FechamentoParamgeralDAO { + + + @Autowired + public FechamentoParamgeralHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.in("emp.empresaId", empresasId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresaId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.eq("emp.empresaId", empresaId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public void borrar(FechamentoParamgeral entity) { + entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entity.setFecmodif(Calendar.getInstance().getTime()); + entity.setActivo(Boolean.FALSE); + actualizacion(entity); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamptovtaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamptovtaHibernateDAO.java new file mode 100644 index 000000000..57b6e1e76 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamptovtaHibernateDAO.java @@ -0,0 +1,75 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("fechamentoParamptovtaDAO") +public class FechamentoParamptovtaHibernateDAO extends GenericHibernateDAO implements FechamentoParamptovtaDAO { + + + @Autowired + public FechamentoParamptovtaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.in("emp.empresaId", empresasId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresaId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.eq("emp.empresaId", empresaId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public void borrar(FechamentoParamptovta entity) { + entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entity.setFecmodif(Calendar.getInstance().getTime()); + entity.setActivo(Boolean.FALSE); + actualizacion(entity); + } + + @Override + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.add(Restrictions.eq("puntoventa", puntoventa)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + List params = query.list(); + + return params; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FeriadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FeriadoHibernateDAO.java new file mode 100644 index 000000000..f7ec04fe4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FeriadoHibernateDAO.java @@ -0,0 +1,74 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FeriadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; + +@Repository("feriadoDAO") +public class FeriadoHibernateDAO extends GenericHibernateDAO implements FeriadoDAO { + + @Autowired + public FeriadoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(Date descferiado) { + String hql = " select new com.rjconsultores.ventaboletos.entidad.Feriado(feriado.feriadoId, feriado.fecferiado,feriado.descferiado) from Feriado feriado" + + " where feriado.activo = 1 and feriado.fecferiado =:data"; + + Query sq = getSession().createQuery(hql); + sq.setParameter("data", descferiado); + List lsFeriado = sq.list(); + return lsFeriado; + } + + @Override + public boolean ehFeriado(Date fecFeriado, Empresa empresa, Estado estadoOrigem) { + Criteria c = makeCriteria(); + + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("fecferiado", fecFeriado)); + c.add(Restrictions.or(Restrictions.eq("estado", estadoOrigem), Restrictions.isNull("estado"))); + c.add(Restrictions.or(Restrictions.eq("empresa", empresa), Restrictions.isNull("empresa"))); + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.uniqueResult()) > 0; + } + + @Override + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("fecferiado", data)); + c.add(Restrictions.eq("estado", estado)); + c.add(Restrictions.eq("empresa", empresa)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalAliquotaEmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalAliquotaEmpresaHibernateDAO.java new file mode 100644 index 000000000..f0d971b91 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalAliquotaEmpresaHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FiscalAliquotaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; + +@Repository("fiscalAliquotaEmpresaDAO") +public class FiscalAliquotaEmpresaHibernateDAO extends GenericHibernateDAO + implements FiscalAliquotaEmpresaDAO { + + @Autowired + public FiscalAliquotaEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java new file mode 100644 index 000000000..4ab71f167 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java @@ -0,0 +1,1164 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FiscalDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; + +@Repository("fiscalDAO") +public class FiscalHibernateDAO implements FiscalDAO { + + public static final String DATE_FORMAT_FISCAL = "yyyyMMdd"; + + public FiscalHibernateDAO() { + } + + @Override + public List buscaDatosFiscaisECFManual(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException { + PreparedStatement stmt = null; + ResultSet rset = null; + + StringBuilder sql = new StringBuilder(); + sql.append("select r4.numserie20 as numImpressora, "); + sql.append(" coalesce(r4.coo, b.numfoliopreimpreso) as coo, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" b.marca_id as empresaId, "); + sql.append(" e.nombempresa as empresa, "); + sql.append(" to_char(b.fechorventa, 'yyyyMMdd') as dataEmissao, "); + sql.append(" b.preciopagado as valorTotal, "); + sql.append(" co.codibge as origenId, "); + sql.append(" eo.cveestado as origenUf, "); + sql.append(" cd.codibge as destinoId, "); + sql.append(" ed.cveestado as destinoUf, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" b.preciopagado as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" b.numseriepreimpresa as serie, "); + sql.append(" eio.icms as icms, "); + sql.append(" eio.porctributo as porctributo, "); + sql.append(" eo.estado_id as estadoIdOrigen, "); + sql.append(" ed.estado_id as estadoIdDestino, "); + sql.append(" subserie as subSerie, "); + sql.append(" docfiscal as aidf, "); + sql.append(" fi.numserie as numpdv,"); + sql.append(" fi.modelo as modeloImpressora,"); + sql.append(" r4.usuario_id as numCaixa,"); + sql.append(" case b.importetaxaembarque when 0 then null else b.importetaxaembarque "); + sql.append(" end as importetaxaembarque, "); + sql.append(" case b.importepedagio when 0 then null else b.importepedagio "); + sql.append(" end as importepedagio, "); + sql.append(" case b.importeoutros when 0 then null else b.importeoutros "); + sql.append(" end as importeoutros, "); + sql.append(" case b.importeseguro when 0 then null else b.importeseguro "); + sql.append(" end as importeseguro, "); + sql.append(" case when b.indstatusboleto = 'V' or b.motivocancelacion_id is null THEN 'N' ELSE 'C' END status, "); + sql.append(" cs.descclase as claseServicio "); + sql.append("from boleto b "); + sql.append(" left join fiscal_r4 r4 on b.boleto_id = r4.boleto_id "); + sql.append(" left outer join fiscal_r5 r5 on r4.numserie20 = r5.numserie20 "); + sql.append(" and r4.coo = r5.coo "); + sql.append(" left outer join fiscal_impressora fi on fi.numserie20 = r4.numserie20 "); + sql.append(" inner join empresa e on e.empresa_id = b.marca_id "); + sql.append(" left join alias_servico ase ON ase.origen_id = b.origen_id "); + sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" left join parada o on coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id "); + sql.append(" left join ciudad co on o.ciudad_id = co.ciudad_id "); + sql.append(" left join estado eo on co.estado_id = eo.estado_id "); + sql.append(" left join empresa_imposto eio on eo.estado_id = eio.estado_id "); + sql.append(" and eio.activo = 1 "); + sql.append(" and b.marca_id = eio.empresa_id "); + sql.append(" left join parada d on coalesce(ase.aliasdestino_id, b.destino_id) = d.parada_id "); + sql.append(" left join ciudad cd on d.ciudad_id = cd.ciudad_id "); + sql.append(" left join estado ed on cd.estado_id = ed.estado_id "); + sql.append(" left join aidf a on a.serie = b.numseriepreimpresa "); + sql.append(" and eo.estado_id = a.estado_id "); + sql.append(" and a.empresa_id = e.empresa_id "); + sql.append(" inner join clase_servicio cs ON cs.claseservicio_id = b.claseservicio_id "); + sql.append("WHERE b.fechorventa BETWEEN ? AND ? "); + sql.append(" AND b.marca_id = ? "); + sql.append(" AND b.tipoventa_id = 3 "); + sql.append(" AND (b.preciopagado > 0 OR b.importetaxaembarque > 0 OR b.importepedagio > 0) "); + sql.append("GROUP BY r4.numserie20, "); + sql.append(" COALESCE(r4.coo, b.numfoliopreimpreso), "); + sql.append(" b.boleto_id, "); + sql.append(" b.marca_id, "); + sql.append(" e.nombempresa, "); + sql.append(" TO_CHAR(b.fechorventa, 'yyyyMMdd'), "); + sql.append(" b.preciopagado, "); + sql.append(" co.codibge, "); + sql.append(" cd.codibge, "); + sql.append(" r5.totparcial, "); + sql.append(" b.preciopagado, "); + sql.append(" r5.tipopassagem, "); + sql.append(" r5.numitem, "); + sql.append(" r5.codproduto, "); + sql.append(" b.numseriepreimpresa, "); + sql.append(" eio.icms, "); + sql.append(" eio.porctributo, "); + sql.append(" eo.estado_id, "); + sql.append(" ed.estado_id, "); + sql.append(" subserie, "); + sql.append(" docfiscal, "); + sql.append(" b.importetaxaembarque, "); + sql.append(" b.importepedagio, "); + sql.append(" b.importeoutros, "); + sql.append(" b.importeseguro, "); + sql.append(" fi.numserie, "); + sql.append(" fi.modelo, "); + sql.append(" r4.usuario_id, "); + sql.append(" eo.cveestado, "); + sql.append(" ed.cveestado, "); + sql.append(" b.motivocancelacion_id, "); + sql.append(" b.indstatusboleto, "); + sql.append(" cs.descclase "); + sql.append("ORDER BY dataEmissao, coo, modeloImpressora "); + + List listManuais = new ArrayList(); + + stmt = connection.prepareStatement(sql.toString()); + stmt.setFetchSize(100); + stmt.setTimestamp(1, new java.sql.Timestamp(inicio.getTime())); + stmt.setTimestamp(2, new java.sql.Timestamp(fim.getTime())); + + if (empresaId != null) { + stmt.setInt(3, empresaId); + } + + rset = stmt.executeQuery(); + while (rset.next()) { + + ImportacionManualFiscalVO item = new ImportacionManualFiscalVO(); + + item.setNumImpressora(rset.getString("numImpressora")); + item.setCoo(rset.getString("coo")); + item.setBoletoId(rset.getLong("boletoId")); + item.setEmpresaId(rset.getInt("empresaId")); + item.setDataEmissao(rset.getString("dataEmissao")); + item.setValorTotal(rset.getBigDecimal("valorTotal")); + item.setNumItem(rset.getString("numItem")); + item.setCodProduto(rset.getString("codProduto")); + item.setNumpdv(rset.getString("numpdv")); + item.setRepTributado(rset.getString("repTributado")); + item.setTipoPassagem(rset.getString("tipoPassagem")); + item.setValorItem(rset.getBigDecimal("valorItem")); + item.setOrigenId(rset.getInt("origenId")); + item.setOrigenUf(rset.getString("origenUf")); + item.setDestinoId(rset.getInt("destinoId")); + item.setDestinoUf(rset.getString("destinoUf")); + item.setModeloImpressora(rset.getString("modeloImpressora")); + item.setNumCaixa(rset.getString("numCaixa")); + item.setStatus(rset.getString("status")); + item.setSerie(rset.getString("serie")); + item.setIcms(rset.getBigDecimal("icms")); + item.setPorctributo(rset.getBigDecimal("porctributo")); + item.setEstadoIdOrigen(rset.getInt("estadoIdOrigen")); + item.setEstadoIdDestino(rset.getInt("estadoIdDestino")); + item.setImportetaxaembarque(rset.getBigDecimal("importetaxaembarque")); + item.setImportepedagio(rset.getBigDecimal("importepedagio")); + item.setImporteoutros(rset.getBigDecimal("importeoutros")); + item.setImporteseguro(rset.getBigDecimal("importeseguro")); + item.setSubSerie(rset.getString("subSerie")); + item.setAidf(rset.getString("aidf")); + item.setClaseServicio(rset.getString("claseServicio")); + + listManuais.add(item); + } + + return listManuais; + + } + + private String sqlFiscaisReducaoZPendencia() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r2.datamov AS datamov, "); + sql.append(" r2.numreducoes AS numreducoes, "); + sql.append(" r2.crz AS crz, "); + sql.append(" r2.numserie20 AS numserie20, "); + sql.append(" r2.coo AS coo, "); + sql.append(" r2.cooinicial AS cooinicial, "); + sql.append(" r2.coofinal AS coofinal, "); + sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, "); + sql.append(" r2.datareducao AS datareducao, "); + sql.append(" r2.horareducao AS horareducao, "); + sql.append(" r3.totparcial AS aliquota, "); + sql.append(" r3.valoracumulado AS imposto, "); + sql.append(" ifi.numserie AS numpdv, "); + sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,"); + sql.append(" r2.totgeral AS gtFinal, "); + sql.append(" anterior.totgeral AS gtInicial, "); + sql.append(" CASE WHEN r3.totparcial = 'Can-T' THEN 'CANCELADO' "); + sql.append(" WHEN r3.totparcial = 'DT' THEN 'DESCONTO' ELSE '' END AS status "); + sql.append("FROM fiscal_r2 r2 "); + sql.append(" inner join fiscal_impressora ifi "); + sql.append(" ON ifi.numserie20 = r2.numserie20 "); + sql.append(" inner join fiscal_r3 r3 "); + sql.append(" ON r3.crz = r2.crz "); + sql.append(" AND r2.numserie20 = r3.numserie20 "); + sql.append(" AND r3.datamov = r2.datamov "); + sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id "); + sql.append(" inner join fiscal_t2 t2 "); + sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id "); + sql.append(" inner join empresa e ON (TRANSLATE(t2.cnpj, ' / - . ', ' ') = (TRANSLATE(e.cnpj, ' / - . ', ' ')) ) or "); + sql.append(" (TRANSLATE(t2.cnpj, ' / - . ', ' ') in "); + sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )), "); + sql.append(" (SELECT numserie20, crz, totgeral "); + sql.append(" FROM fiscal_r2) anterior "); + sql.append("WHERE r2.datamov BETWEEN ? AND ? "); + sql.append(" AND r2.activo = 1 "); + sql.append(" AND e.empresa_id = ? "); + sql.append(" AND r3.totparcial IN ("); + sql.append("'" + SituacaoTributaria.CANCELADO.getValue() + "'").append(", "); + sql.append("'" + SituacaoTributaria.DESCONTO.getValue() + "'").append(")"); + sql.append(" AND anterior.numserie20 = r2.numserie20 "); + sql.append(" AND anterior.crz = r2.crz - 1 "); + sql.append(" AND (SELECT MAX(fiscalr4_id) FROM fiscal_r4 r4 WHERE r4.numserie20 = r2.numserie20 "); + sql.append(" AND r4.datamov = r2.datamov) IS NOT NULL "); + sql.append("GROUP BY r2.datamov, "); + sql.append(" r2.numreducoes, "); + sql.append(" r2.crz, "); + sql.append(" r2.numserie20, "); + sql.append(" r2.coo, "); + sql.append(" r2.cooinicial, "); + sql.append(" r2.coofinal, "); + sql.append(" r2.vendabrutadiaria, "); + sql.append(" r2.datareducao, "); + sql.append(" r2.horareducao, "); + sql.append(" r3.totparcial, "); + sql.append(" r3.valoracumulado, "); + sql.append(" ifi.numserie, "); + sql.append(" t2.cnpj, "); + sql.append(" r2.totgeral, "); + sql.append(" anterior.totgeral "); + sql.append("ORDER BY r2.datamov, "); + sql.append(" numserie20, "); + sql.append(" crz, "); + sql.append(" r2.numreducoes, "); + sql.append(" r3.totparcial desc "); + return sql.toString(); + } + + private String sqlFiscaisReducaoZPendenciaInconcistencias() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r2.datamov AS datamov, "); + sql.append(" r2.numreducoes AS numreducoes, "); + sql.append(" r2.crz AS crz, "); + sql.append(" r2.numserie20 AS numserie20, "); + sql.append(" r2.coo AS coo, "); + sql.append(" r2.cooinicial AS cooinicial, "); + sql.append(" r2.coofinal AS coofinal, "); + sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, "); + sql.append(" r2.datareducao AS datareducao, "); + sql.append(" r2.horareducao AS horareducao, "); + sql.append(" r3.totparcial AS aliquota, "); + sql.append(" r3.valoracumulado AS imposto, "); + sql.append(" ifi.numserie AS numpdv, "); + sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,"); + sql.append(" r2.totgeral AS gtFinal, "); + sql.append(" anterior.totgeral AS gtInicial, "); + sql.append(" 'INCONSISTENTE' AS status "); + sql.append("FROM fiscal_r2 r2 "); + sql.append(" inner join fiscal_impressora ifi "); + sql.append(" ON ifi.numserie20 = r2.numserie20 "); + sql.append(" inner join fiscal_r3 r3 "); + sql.append(" ON r3.crz = r2.crz "); + sql.append(" AND r2.numserie20 = r3.numserie20 "); + sql.append(" AND r3.datamov = r2.datamov "); + sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id "); + sql.append(" inner join fiscal_t2 t2 "); + sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id "); + sql.append(" inner join empresa e ON (TRANSLATE(t2.cnpj, ' / - . ', ' ') = (TRANSLATE(e.cnpj, ' / - . ', ' ')) ) or "); + sql.append(" (TRANSLATE(t2.cnpj, ' / - . ', ' ') in "); + sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )), "); + sql.append(" (SELECT numserie20, crz, totgeral "); + sql.append(" FROM fiscal_r2) anterior "); + sql.append("WHERE r2.datamov BETWEEN ? AND ? "); + sql.append(" AND r2.activo = 1 "); + sql.append(" AND e.empresa_id = ? "); + sql.append(" AND r3.totparcial not in ("); + sql.append("'" + SituacaoTributaria.NAO_FISCAL.getValue() + "'").append(")"); + sql.append(" AND anterior.numserie20 = r2.numserie20 "); + sql.append(" AND anterior.crz = r2.crz - 1 "); + sql.append(" AND (SELECT MAX(fiscalr4_id) FROM fiscal_r4 r4 WHERE r4.numserie20 = r2.numserie20 "); + sql.append(" AND r4.datamov = r2.datamov) IS NULL "); + sql.append("GROUP BY r2.datamov, "); + sql.append(" r2.numreducoes, "); + sql.append(" r2.crz, "); + sql.append(" r2.numserie20, "); + sql.append(" r2.coo, "); + sql.append(" r2.cooinicial, "); + sql.append(" r2.coofinal, "); + sql.append(" r2.vendabrutadiaria, "); + sql.append(" r2.datareducao, "); + sql.append(" r2.horareducao, "); + sql.append(" r3.totparcial, "); + sql.append(" r3.valoracumulado, "); + sql.append(" ifi.numserie, "); + sql.append(" t2.cnpj, "); + sql.append(" r2.totgeral, "); + sql.append(" anterior.totgeral "); + sql.append("ORDER BY r2.datamov, "); + sql.append(" numserie20, "); + sql.append(" crz, "); + sql.append(" r2.numreducoes, "); + sql.append(" r3.totparcial desc "); + return sql.toString(); + } + + private String sqlFiscaisReducaoZ() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r2.datamov AS datamov, "); + sql.append(" r2.numreducoes AS numreducoes, "); + sql.append(" r2.crz AS crz, "); + sql.append(" r2.numserie20 AS numserie20, "); + sql.append(" r2.coo AS coo, "); + sql.append(" r2.cooinicial AS cooinicial, "); + sql.append(" r2.coofinal AS coofinal, "); + sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, "); + sql.append(" r2.datareducao AS datareducao, "); + sql.append(" r2.horareducao AS horareducao, "); + sql.append(" r3.totparcial AS aliquota, "); + sql.append(" r3.valoracumulado AS imposto, "); + sql.append(" ifi.numserie AS numpdv, "); + sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,"); + sql.append(" r2.totgeral AS gtFinal, "); + sql.append(" anterior.totgeral AS gtInicial, "); + sql.append(" 'NORMAL' AS status "); + sql.append("FROM fiscal_r2 r2 "); + sql.append(" inner join fiscal_impressora ifi "); + sql.append(" ON ifi.numserie20 = r2.numserie20 "); + sql.append(" inner join fiscal_r3 r3 "); + sql.append(" ON r3.crz = r2.crz "); + sql.append(" AND r2.numserie20 = r3.numserie20 "); + sql.append(" AND r3.datamov = r2.datamov "); + sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id "); + sql.append(" inner join fiscal_t2 t2 "); + sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id "); + sql.append(" inner join empresa e ON (TRANSLATE(t2.cnpj, ' / - . ', ' ') = (TRANSLATE(e.cnpj, ' / - . ', ' ')) ) or "); + sql.append(" (TRANSLATE(t2.cnpj, ' / - . ', ' ') in "); + sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )), "); + sql.append(" (SELECT numserie20, crz, totgeral "); + sql.append(" FROM fiscal_r2) anterior "); + sql.append("WHERE r2.datamov BETWEEN ? AND ? "); + sql.append(" AND r2.activo = 1 "); + sql.append(" AND e.empresa_id = ? "); + sql.append(" AND r3.totparcial not in ("); + sql.append("'" + SituacaoTributaria.NAO_FISCAL.getValue() + "'").append(")"); + sql.append(" AND anterior.numserie20 = r2.numserie20 "); + sql.append(" AND anterior.crz = r2.crz - 1 "); + sql.append(" AND r2.vendabrutadiaria > 0 "); + sql.append("GROUP BY r2.datamov, "); + sql.append(" r2.numreducoes, "); + sql.append(" r2.crz, "); + sql.append(" r2.numserie20, "); + sql.append(" r2.coo, "); + sql.append(" r2.cooinicial, "); + sql.append(" r2.coofinal, "); + sql.append(" r2.vendabrutadiaria, "); + sql.append(" r2.datareducao, "); + sql.append(" r2.horareducao, "); + sql.append(" r3.totparcial, "); + sql.append(" r3.valoracumulado, "); + sql.append(" ifi.numserie, "); + sql.append(" t2.cnpj, "); + sql.append(" r2.totgeral, "); + sql.append(" anterior.totgeral "); + sql.append("ORDER BY r2.datamov, "); + sql.append(" numserie20, "); + sql.append(" crz, "); + sql.append(" r2.numreducoes, "); + // TODO: No ambiente de produção a ordenação so vem correta quando declarado para vir como desc + // contrario aos outros servidores que deve ser asc + sql.append(" r3.totparcial desc "); + return sql.toString(); + } + + @Override + public List buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, boolean isPendencias, Connection connection) throws SQLException { + if (isPendencias) { + List list = new ArrayList(); + list.addAll(montarItensReducaoZ(inicio, fim, empresaId, sqlFiscaisReducaoZPendencia(), connection)); + list.addAll(montarItensReducaoZ(inicio, fim, empresaId, sqlFiscaisReducaoZPendenciaInconcistencias(), connection)); + return list; + + } else { + return montarItensReducaoZ(inicio, fim, empresaId, sqlFiscaisReducaoZ(), connection); + } + } + + private List montarItensReducaoZ(Date inicio, Date fim, Integer empresaId, String sql, Connection connection) throws SQLException { + + List listRedZ = new ArrayList(); + PreparedStatement stmt = connection.prepareStatement(sql); + stmt.setFetchSize(100); + stmt.setInt(1, empresaId); + stmt.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + stmt.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + stmt.setInt(4, empresaId); + + ResultSet rset = stmt.executeQuery(); + while (rset.next()) { + + ImportacionFiscalReducaoZVO item = new ImportacionFiscalReducaoZVO(); + item.setDatamov(rset.getString("datamov")); + item.setNumreducoes(rset.getString("numreducoes")); + item.setCrz(rset.getString("crz")); + item.setNumserie20(rset.getString("numserie20")); + item.setCoo(rset.getString("coo")); + item.setCooinicial(rset.getString("cooinicial")); + item.setCoofinal(rset.getString("coofinal")); + item.setVendabrutadiaria(rset.getBigDecimal("vendabrutadiaria")); + item.setDatareducao(rset.getString("datareducao")); + item.setHorareducao(rset.getString("horareducao")); + item.setAliquota(rset.getString("aliquota")); + item.setImposto(rset.getBigDecimal("imposto")); + item.setNumpdv(rset.getString("numpdv")); + item.setCnpj(rset.getString("cnpj")); + item.setGtFinal(rset.getBigDecimal("gtFinal")); + item.setGtInicial(rset.getBigDecimal("gtInicial")); + item.setStatus(rset.getString("status")); + listRedZ.add(item); + } + + return listRedZ; + } + + private String sqlFiscaisECFCancelados() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" to_char(be.fechorventa,'yyyymmdd') as dataCancelamento, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" b.marca_id as empresaId, "); + sql.append(" co.codibge as origenId, "); + sql.append(" eo.cveestado as origenUf, "); + sql.append(" cd.codibge as destinoId, "); + sql.append(" ed.cveestado as destinoUf, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" 'C' as status, "); + sql.append(" b.motivocancelacion_id as motivocancelacion, "); + sql.append(" ee.impingreso as valorMulta, "); + sql.append(" cs.descclase as claseServicio, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf "); + sql.append(" FROM fiscal_r4 r4 "); + sql.append(" LEFT JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" INNER JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append(" INNER JOIN boleto be ON b.boleto_id = be.boletooriginal_id "); + sql.append(" INNER JOIN clase_servicio cs ON cs.claseservicio_id = b.claseservicio_id "); + sql.append(" LEFT JOIN evento_extra ee on ee.boleto_id = b.boleto_id and ee.tipoeventoextra_id in (42) "); + sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = b.origen_id "); + sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id "); + sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id "); + sql.append(" INNER JOIN estado eo ON eo.estado_id = co.estado_id "); + sql.append(" INNER JOIN parada d ON coalesce(ase.aliasdestino_id, b.destino_id) = d.parada_id "); + sql.append(" INNER JOIN ciudad cd ON d.ciudad_id = cd.ciudad_id "); + sql.append(" INNER JOIN estado ed ON ed.estado_id = cd.estado_id "); + sql.append(" WHERE be.fechorventa BETWEEN ? AND ? "); + sql.append(" AND be.marca_id = ? "); + sql.append(" AND b.motivocancelacion_id IN (31,32,10) "); + sql.append(" AND be.indstatusboleto = 'C' "); + sql.append(" AND r4.indcancelamento = 'N' "); + sql.append(" GROUP BY r4.numserie20, "); + sql.append(" r4.coo, "); + sql.append(" to_char(be.fechorventa,'yyyymmdd'), "); + sql.append(" r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, "); + sql.append(" r4.imptotalliquido, "); + sql.append(" b.boleto_id, "); + sql.append(" b.marca_id, "); + sql.append(" co.codibge, "); + sql.append(" cd.codibge, "); + sql.append(" fi.numcnpj, "); + sql.append(" fi.numserie, "); + sql.append(" r5.impdesconto, "); + sql.append(" r5.totparcial, "); + sql.append(" r5.imptotalliquido, "); + sql.append(" r5.tipopassagem, "); + sql.append(" r5.numitem, "); + sql.append(" r5.codproduto, "); + sql.append(" fi.modelo, "); + sql.append(" r4.usuario_id, "); + sql.append(" eo.cveestado, "); + sql.append(" ed.cveestado, "); + sql.append(" b.motivocancelacion_id, "); + sql.append(" ee.impingreso, "); + sql.append(" b.preciopagado, "); + sql.append(" b.importetaxaembarque, "); + sql.append(" b.importepedagio, "); + sql.append(" b.importeseguro, "); + sql.append(" cs.descclase, "); + sql.append(" fi.numcnpj "); + sql.append(" ORDER BY r4.datamov, "); + sql.append(" r4.numserie20, "); + sql.append(" r4.coo, "); + sql.append(" r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECF() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" b.marca_id as empresaId, "); + sql.append(" co.codibge as origenId, "); + sql.append(" eo.cveestado as origenUf, "); + sql.append(" cd.codibge as destinoId, "); + sql.append(" ed.cveestado as destinoUf, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" cs.descclase as claseServicio, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" ei.icms as impostoEstado, "); + sql.append(" 'N' as status, "); + sql.append(" r4.indcancelamento as indcancelamento "); + sql.append(" FROM fiscal_r4 r4 "); + sql.append(" LEFT JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" LEFT JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append(" INNER JOIN clase_servicio cs ON cs.claseservicio_id = b.claseservicio_id "); + sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = b.origen_id "); + sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id "); + sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id "); + sql.append(" INNER JOIN estado eo ON eo.estado_id = co.estado_id "); + sql.append(" LEFT JOIN empresa_imposto ei ON ei.estado_id = eo.estado_id AND b.marca_id = ei.empresa_id "); + sql.append(" INNER JOIN parada d ON coalesce(ase.aliasdestino_id, b.destino_id) = d.parada_id "); + sql.append(" INNER JOIN ciudad cd ON d.ciudad_id = cd.ciudad_id "); + sql.append(" INNER JOIN estado ed ON ed.estado_id = cd.estado_id "); + sql.append(" WHERE r4.datamov BETWEEN ? AND ? "); + sql.append(" AND b.marca_id = ? "); + sql.append(" AND (r4.indcancelamento = 'N' OR (r4.indcancelamento = 'S' AND "); + sql.append(" (SELECT r3.numserie20 FROM fiscal_r3 r3 "); + sql.append(" WHERE r3.numserie20 = r4.numserie20 AND r3.datamov = r4.datamov "); + sql.append(" AND r3.totparcial = 'Can-T') IS NULL) ) "); + sql.append(" GROUP BY r4.numserie20, "); + sql.append(" r4.coo, "); + sql.append(" r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, "); + sql.append(" r4.imptotalliquido, "); + sql.append(" b.boleto_id, "); + sql.append(" b.marca_id, "); + sql.append(" co.codibge, "); + sql.append(" cd.codibge, "); + sql.append(" fi.numcnpj, "); + sql.append(" fi.numserie, "); + sql.append(" r5.impdesconto, "); + sql.append(" r5.totparcial, "); + sql.append(" r5.imptotalliquido, "); + sql.append(" r5.tipopassagem, "); + sql.append(" r5.numitem, "); + sql.append(" r5.codproduto, "); + sql.append(" fi.modelo, "); + sql.append(" r4.usuario_id, "); + sql.append(" eo.cveestado, "); + sql.append(" ed.cveestado, "); + sql.append(" b.preciopagado, "); + sql.append(" b.importetaxaembarque, "); + sql.append(" b.importepedagio, "); + sql.append(" b.importeseguro, "); + sql.append(" cs.descclase, "); + sql.append(" fi.numcnpj, "); + sql.append(" ei.icms, "); + sql.append(" r4.indcancelamento "); + sql.append(" ORDER BY r4.datamov, "); + sql.append(" r4.numserie20, "); + sql.append(" r4.coo, "); + sql.append(" r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasDesconto() { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" r5.impdesconto as desconto, "); + sql.append(" 'DESCONTO' as status"); + sql.append(" FROM fiscal_r4 r4 "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" LEFT JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" WHERE r4.datamov BETWEEN ? AND ? "); + sql.append(" AND b.marca_id = ? "); + sql.append(" AND r5.impdesconto <> 0 "); + sql.append(" GROUP BY r4.numserie20, r4.coo, r4.datamov, r4.cpfcnpjcliente, "); + sql.append(" r4.imptotalliquido, fi.numcnpj, fi.numserie, r5.impdesconto, "); + sql.append(" r5.totparcial, r5.imptotalliquido, r5.tipopassagem, "); + sql.append(" r5.numitem, r5.codproduto, fi.modelo, r4.usuario_id "); + sql.append(" ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasCancelado() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" b.marca_id as empresaId, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" r4.indcancelamento, "); + sql.append(" 'CANCELADO' as status "); + sql.append("FROM fiscal_r4 r4 "); + sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" INNER JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append("WHERE r4.datamov BETWEEN ? AND ? "); + sql.append(" AND b.marca_id = ? "); + sql.append(" AND r4.indcancelamento = 'S' "); + sql.append(" AND (SELECT r3.numserie20 FROM fiscal_r3 r3 where r3.numserie20 = r4.numserie20"); + sql.append(" AND r3.datamov = r4.datamov AND r3.totparcial IN ('Can-T')) IS NOT NULL "); + sql.append("GROUP BY r4.numserie20, r4.coo, r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, r4.imptotalliquido, "); + sql.append(" b.boleto_id, b.marca_id, fi.numcnpj, "); + sql.append(" fi.numserie, r5.impdesconto, r5.totparcial, "); + sql.append(" r5.imptotalliquido, r5.tipopassagem, r5.numitem, "); + sql.append(" r5.codproduto, fi.modelo, r4.usuario_id, "); + sql.append(" b.preciopagado, b.importetaxaembarque, b.importepedagio, "); + sql.append(" b.importeseguro, fi.numcnpj, r4.indcancelamento, r4.indcancelamento "); + sql.append("ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasGratuidade() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" b.marca_id as empresaId, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" r4.indcancelamento, "); + sql.append(" 'GRATUIDADE' as status "); + sql.append("FROM fiscal_r4 r4 "); + sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" INNER JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append("WHERE r4.datamov BETWEEN ? AND ? "); + sql.append(" AND b.marca_id = ? "); + sql.append(" AND r5.imptotalliquido = 1 "); + sql.append(" AND b.preciopagado = 0 "); + sql.append("GROUP BY r4.numserie20, r4.coo, r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, r4.imptotalliquido, "); + sql.append(" b.boleto_id, b.marca_id, fi.numcnpj, "); + sql.append(" fi.numserie, r5.impdesconto, r5.totparcial, "); + sql.append(" r5.imptotalliquido, r5.tipopassagem, r5.numitem, "); + sql.append(" r5.codproduto, fi.modelo, r4.usuario_id, "); + sql.append(" b.preciopagado, b.importetaxaembarque, b.importepedagio, "); + sql.append(" b.importeseguro, fi.numcnpj, r4.indcancelamento, r4.indcancelamento "); + sql.append("ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasInconsistente() { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" b.marca_id as empresaId, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" r4.indcancelamento, "); + sql.append(" 'INCONSISTENTE' as status "); + sql.append("FROM fiscal_r4 r4 "); + sql.append(" LEFT JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" LEFT JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append("WHERE r4.datamov BETWEEN ? AND ? "); + sql.append(" AND b.marca_id = ? "); + sql.append(" AND r4.indcancelamento = 'S' "); + sql.append(" AND (SELECT MAX(r3.numserie20) FROM fiscal_r3 r3 where r3.numserie20 = r4.numserie20"); + sql.append(" AND r3.datamov = r4.datamov AND r3.totparcial IN ('Can-T', 'DT')) IS NULL "); + sql.append("GROUP BY r4.numserie20, r4.coo, r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, r4.imptotalliquido, "); + sql.append(" b.boleto_id, b.marca_id, fi.numcnpj, "); + sql.append(" fi.numserie, r5.impdesconto, r5.totparcial, "); + sql.append(" r5.imptotalliquido, r5.tipopassagem, r5.numitem, "); + sql.append(" r5.codproduto, fi.modelo, r4.usuario_id, "); + sql.append(" b.preciopagado, b.importetaxaembarque, b.importepedagio, "); + sql.append(" b.importeseguro, fi.numcnpj, r4.indcancelamento, r4.indcancelamento "); + sql.append("ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + @Override + public List buscaDatosFiscaisECF(Date inicio, Date fim, Integer empresaId, boolean isNormal, boolean isCancelados, boolean isPendencias, Connection connection) throws SQLException { + + if (isNormal) { + return montarItensECF(inicio, fim, empresaId, connection, sqlFiscaisECF(), false); + + } else if (isCancelados) { + return montarItensECF(inicio, fim, empresaId, connection, sqlFiscaisECFCancelados(), true); + + } else if (isPendencias) { + + List list = new ArrayList(); + list.addAll(montarItensECF(inicio, fim, empresaId, connection, sqlFiscaisECFPendenciasCancelado(), false)); + list.addAll(montarItensECF(inicio, fim, empresaId, connection, sqlFiscaisECFPendenciasDesconto(), false)); + list.addAll(montarItensECF(inicio, fim, empresaId, connection, sqlFiscaisECFPendenciasInconsistente(), false)); + list.addAll(montarItensECF(inicio, fim, empresaId, connection, sqlFiscaisECFPendenciasGratuidade(), false)); + return list; + + } + return null; + } + + private List montarItensECF(Date inicio, Date fim, Integer empresaId, Connection connection, String sql, boolean isDate) throws SQLException { + + PreparedStatement stmt = connection.prepareStatement(sql); + stmt.setFetchSize(100); + if (isDate) { + stmt.setTimestamp(1, new java.sql.Timestamp(DateUtil.inicioFecha(inicio).getTime())); + stmt.setTimestamp(2, new java.sql.Timestamp(DateUtil.fimFecha(fim).getTime())); + } else { + stmt.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + stmt.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + } + stmt.setInt(3, empresaId); + + List list = new ArrayList(); + ImportacionFiscalVO fiscal = null; + String codProduto = null; + + List columns = new ArrayList(); + ResultSetMetaData rsMetaData = stmt.getMetaData(); + for (int i = 1; i <= rsMetaData.getColumnCount(); i++) { + columns.add(rsMetaData.getColumnName(i).toLowerCase()); + } + + ResultSet rset = stmt.executeQuery(); + while (rset.next()) { + + ItemFiscalVO item = new ItemFiscalVO(); + item.setNumImpressora(columns.contains("numimpressora") ? rset.getString("numImpressora") : null); + item.setCoo(columns.contains("coo") ? rset.getString("coo") : null); + item.setBoletoId(columns.contains("boletoid") ? rset.getLong("boletoId") : null); + item.setEmpresaId(columns.contains("empresaid") ? rset.getInt("empresaId") : null); + item.setDataEmissao(columns.contains("dataemissao") ? rset.getString("dataEmissao") : null); + item.setCnpjCliente(columns.contains("cnpjcliente") ? rset.getString("cnpjCliente") : null); + item.setCnpjImpressora(columns.contains("cnpjimpressora") ? rset.getString("cnpjImpressora") : null); + item.setOrigenId(columns.contains("origenid") ? rset.getInt("origenId") : null); + item.setOrigenUf(columns.contains("origenuf") ? rset.getString("origenUf") : null); + item.setDestinoId(columns.contains("destinoid") ? rset.getInt("destinoId") : null); + item.setDestinoUf(columns.contains("destinouf") ? rset.getString("destinoUf") : null); + item.setNumpdv(columns.contains("numpdv") ? rset.getString("numpdv") : null); + item.setNumItem(columns.contains("numitem") ? rset.getString("numItem") : null); + item.setCodProduto(columns.contains("codproduto") ? rset.getString("codProduto") : null); + item.setRepTributado(columns.contains("reptributado") ? rset.getString("repTributado") : null); + item.setTipoPassagem(columns.contains("tipopassagem") ? rset.getString("tipoPassagem") : null); + item.setModeloImpressora(columns.contains("modeloimpressora") ? rset.getString("modeloImpressora") : null); + item.setNumCaixa(columns.contains("numcaixa") ? rset.getString("numCaixa") : null); + item.setStatus(columns.contains("status") ? rset.getString("status") : null); + item.setClaseServicio(columns.contains("claseservicio") ? rset.getString("claseServicio") : null); + item.setMotivocancelacion(columns.contains("motivocancelacion") ? rset.getInt("motivocancelacion") : null); + item.setValorMulta(columns.contains("valormulta") ? rset.getBigDecimal("valorMulta") : null); + item.setImpostoEstado(columns.contains("impostoestado") ? rset.getBigDecimal("impostoEstado") : null); + item.setDesconto(columns.contains("desconto") ? rset.getBigDecimal("desconto") : null); + item.setIndcancelamento(columns.contains("indcancelamento") ? rset.getString("indcancelamento") : null); + + // TODO: Estes atributos foram criados, por motivo de divergencia no valorTotal com o valor unitario na tabela FISCAL_R5 + item.setValorTarifa(columns.contains("importetarifa") ? rset.getBigDecimal("importetarifa") : null); + item.setValorPedagio(columns.contains("importepedagio") ? rset.getBigDecimal("importepedagio") : null); + item.setValorEmbarque(columns.contains("importetaxaembarque") ? rset.getBigDecimal("importetaxaembarque") : null); + item.setValorSeguro(columns.contains("importeseguro") ? rset.getBigDecimal("importeseguro") : null); + + ImportacionFiscalVO novoFiscal = item; + + codProduto = item.getCodProduto(); + if (codProduto != null) { + codProduto = codProduto.toString().replace("-", "").replace("TA", "").replace("TX", "").replace("PE", "").replace("SE", ""); + } else { + String boleto = item.getBoletoId().toString(); + codProduto = boleto.substring(boleto.length() - 8) + "F" + boleto.substring(boleto.length() - 2); + } + + if (fiscal == null) { + fiscal = item; + } else if (!novoFiscal.equals(fiscal)) { + List itensFiscais = validaItensFiscais(fiscal, codProduto); + fiscal.setItensFiscais(itensFiscais); + list.add(fiscal); + fiscal = item; + } + + fiscal.getItensFiscais().add(item); + + } + + if (fiscal != null) { + List itensFiscais = validaItensFiscais(fiscal, codProduto); + fiscal.setItensFiscais(itensFiscais); + list.add(fiscal); + } + + return list; + } + + private boolean validaValorExiste(BigDecimal valor) { + if (valor == null) { + return Boolean.FALSE; + } else if (valor.equals(BigDecimal.ZERO)) { + return Boolean.FALSE; + } else { + return Boolean.TRUE; + } + } + + private List validaItensFiscais(ImportacionFiscalVO fiscal, String codProduto) { + + boolean temTarifa = validaValorExiste(fiscal.getValorTarifa()); + boolean temPedagio = validaValorExiste(fiscal.getValorPedagio()); + boolean temEmbarque = validaValorExiste(fiscal.getValorEmbarque()); + boolean temSeguro = validaValorExiste(fiscal.getValorSeguro()); + + boolean tarifaCriada = false; + boolean pedagioCriada = false; + boolean embarqueCriada = false; + boolean seguroCriada = false; + + boolean inconsistencia = false; + + List itensFiscais = new ArrayList(); + for (ItemFiscalVO item : fiscal.getItensFiscais()) { + + String codigoProduto = item.getCodProduto(); + if (codigoProduto != null) { + if (codigoProduto.indexOf("TA") >= 0) + tarifaCriada = true; + + if (codigoProduto.indexOf("TX") >= 0) + embarqueCriada = true; + + if (codigoProduto.indexOf("PE") >= 0) + pedagioCriada = true; + + if (codigoProduto.indexOf("SE") >= 0) + seguroCriada = true; + } else { + inconsistencia = true; + break; + } + + itensFiscais.add(item); + } + + int numeroItem = 1; + if (temTarifa && !tarifaCriada) { + ItemFiscalVO novoTarifa = new ItemFiscalVO(fiscal); + novoTarifa.setCodProduto(codProduto + "-TA"); + novoTarifa.setTipoPassagem("E"); + novoTarifa.setValorItem(fiscal.getValorTarifa()); + novoTarifa.setRepTributado("N1"); + novoTarifa.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoTarifa.setInconsistencia(inconsistencia); + itensFiscais.add(novoTarifa); + } + + if (temEmbarque && !embarqueCriada) { + ItemFiscalVO novoEmbarque = new ItemFiscalVO(fiscal); + novoEmbarque.setCodProduto(codProduto + "-TX"); + novoEmbarque.setTipoPassagem("E"); + novoEmbarque.setValorItem(fiscal.getValorEmbarque()); + novoEmbarque.setRepTributado("N1"); + novoEmbarque.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoEmbarque.setInconsistencia(inconsistencia); + itensFiscais.add(novoEmbarque); + } + + if (temPedagio && !pedagioCriada) { + ItemFiscalVO novoPedagio = new ItemFiscalVO(fiscal); + novoPedagio.setCodProduto(codProduto + "-PE"); + novoPedagio.setTipoPassagem("E"); + novoPedagio.setValorItem(fiscal.getValorPedagio()); + novoPedagio.setRepTributado("N1"); + novoPedagio.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoPedagio.setInconsistencia(inconsistencia); + itensFiscais.add(novoPedagio); + } + + if (temSeguro && !seguroCriada) { + ItemFiscalVO novoSeguro = new ItemFiscalVO(fiscal); + novoSeguro.setCodProduto(codProduto + "-SE"); + novoSeguro.setTipoPassagem("E"); + novoSeguro.setValorItem(fiscal.getValorSeguro()); + novoSeguro.setRepTributado("N1"); + novoSeguro.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoSeguro.setInconsistencia(inconsistencia); + itensFiscais.add(novoSeguro); + } + + return itensFiscais; + } + + private int gerarRegistroP2(List lsEsquemaCorrida, Date dataDe, Date dataAte) { + Integer[] idsCorrida = getIdsCorrida(lsEsquemaCorrida); + + StringBuilder sb = new StringBuilder(""); + sb.append(" INSERT INTO FISCAL_P2 (CODPRODUTO,descricao,valorunitario_ta,valorunitario_tx,valorunitario_pe,valorunitario_ot,valorunitario_se,empresa_id,estado_origem,estado_aliascorrida,estado_aliasgeral) "); + sb.append(" "); + sb.append(" select DISTINCT "); + sb.append(" CODPRODUTO(t.origen_id , t.destino_id , rc.ruta_id) AS CODPRODUTO, "); + sb.append(" t.desctramo as descricao, "); + sb.append(" tr.precio as valorunitario_ta, "); + sb.append(" tr.importetaxaembarque as valorunitario_tx, "); + sb.append(" tr.importepedagio as valorunitario_pe, "); + sb.append(" tr.importeoutros as valorunitario_ot, "); + sb.append(" tr.importeseguro as valorunitario_se, "); + sb.append(" c.empresacorrida_id as empresa_id, "); + sb.append(" co.estado_id as estado_origem, "); + sb.append(" cas1.estado_id as estado_aliascorrida, "); + sb.append(" cas2.estado_id as estado_aliasgeral "); + sb.append(" "); + sb.append(" from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join corrida c on c.ruta_id = rc.ruta_id "); + sb.append(" inner join corrida_tramo cto on cto.corrida_id = c.corrida_id and cto.feccorrida = c.feccorrida and t.origen_id = cto.origen_id "); + sb.append(" inner join corrida_tramo ctd on ctd.corrida_id = c.corrida_id and ctd.feccorrida = c.feccorrida and t.destino_id = ctd.destino_id "); + sb.append(" inner join tarifa tr on tr.ruta_id = rc.ruta_id and tr.origen_id = t.origen_id and tr.destino_id = t.destino_id "); + sb.append(" inner join vigencia_tarifa vt on vt.vigenciatarifa_id = tr.vigenciatarifa_id "); + sb.append(" inner join ciudad co on co.ciudad_id = po.ciudad_id "); + sb.append(" left join alias_servico as1 on as1.corrida_id = as1.corrida_id and as1.origen_id = t.origen_id and as1.destino_id = t.destino_id and as1.ruta_id = rc.ruta_id "); + sb.append(" left join parada pas1 on pas1.parada_id = as1.aliasorigen_id "); + sb.append(" left join ciudad cas1 on cas1.ciudad_id = pas1.ciudad_id "); + sb.append(" left join alias_servico as2 on as2.corrida_id is null and as2.origen_id = t.origen_id and as2.destino_id = t.destino_id and as2.ruta_id = rc.ruta_id "); + sb.append(" left join parada pas2 on pas2.parada_id = as2.aliasorigen_id "); + sb.append(" left join ciudad cas2 on cas2.ciudad_id = pas2.ciudad_id "); + sb.append(" where "); + sb.append(" rc.activo = 1 "); + sb.append(" and cto.activo = 1 "); + sb.append(" and ctd.activo = 1 "); + sb.append(" and tr.activo = 1 "); + sb.append(" and cto.fechorsalida between vt.feciniciovigencia and vt.fecfinvigencia "); + sb.append(" and c.feccorrida between :datIni and :datFim "); + sb.append(" and c.corrida_id in (:corridaId) "); + sb.append(" and ROWNUM < 2 "); + + // FIXME - Implementar a inserção na base de dados. Atenção para checar se tem q ficar em transação ou não + // Query query = getSession().createSQLQuery(sb.toString()); + // query.setParameterList("corridaId", idsCorrida); + // query.setDate("datIni", new java.sql.Date(dataDe.getTime())); + // query.setDate("datFim", new java.sql.Date(dataAte.getTime())); + + // return query.executeUpdate(); + + return 0; + } + + private Integer[] getIdsCorrida(List lsEsquemaCorrida) { + Integer[] idsCorrida = new Integer[lsEsquemaCorrida.size()]; + int i = 0; + for (EsquemaCorrida ec : lsEsquemaCorrida) { + idsCorrida[i] = ec.getNumCorrida(); + i++; + } + return idsCorrida; + } + + private int gerarRegistroF2(List lsEsquemaCorrida, Date dataDe, Date dataAte) { + StringBuilder sb = new StringBuilder(""); + sb.append(" INSERT INTO FISCAL_F2 (cnpj, codigo_local_emissao,identificacao_linha, descricao_linha, data_partida, hora_partida, codigo_tipo_viagem) "); + sb.append(" select distinct oc.cnpj, t.origen_id as codigo_local_emissao, r.prefixo as identificacao_linha, r.descruta as descricao_linha, to_char(cto.fechorsalida, 'YYYYMMdd') as data_partida, to_char(cto.fechorsalida, 'hh24miss') as hora_partida, (case nvl(c.tiposervicio_id, 0) when 2 then '01' else '00' end) as codigo_tipo_viagem "); + sb.append(" from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join orgao_concedente oc on oc.orgaoconcedente_id = r.orgaoconcedente_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join corrida c on c.ruta_id = rc.ruta_id "); + sb.append(" inner join corrida_tramo cto on cto.corrida_id = c.corrida_id and cto.feccorrida = c.feccorrida and t.origen_id = cto.origen_id "); + sb.append(" inner join corrida_tramo ctd on ctd.corrida_id = c.corrida_id and ctd.feccorrida = c.feccorrida and t.destino_id = ctd.destino_id "); + sb.append(" inner join tarifa tr on tr.ruta_id = rc.ruta_id and tr.origen_id = t.origen_id and tr.destino_id = t.destino_id "); + sb.append(" inner join vigencia_tarifa vt on vt.vigenciatarifa_id = tr.vigenciatarifa_id "); + sb.append(" inner join punto_venta pv on pv.empresa_id = c.empresacorrida_id "); + sb.append(" where "); + sb.append(" rc.activo = 1 "); + sb.append(" and cto.activo = 1 "); + sb.append(" and ctd.activo = 1 "); + sb.append(" and cto.fechorsalida between vt.feciniciovigencia and vt.fecfinvigencia "); + sb.append(" and c.feccorrida between :datIni and :datFim "); + sb.append(" and c.corrida_id in (:corridaId) "); + sb.append(" and ROWNUM < 2 "); + + Integer[] idsCorrida = getIdsCorrida(lsEsquemaCorrida); + // FIXME - Implementar a inserção na base de dados. Atenção para checar se tem q ficar em transação ou não + // Query query = getSession().createSQLQuery(sb.toString()); + // query.setParameterList("corridaId", idsCorrida); + // query.setDate("datIni", new java.sql.Date(dataDe.getTime())); + // query.setDate("datFim", new java.sql.Date(dataAte.getTime())); + // + // return query.executeUpdate(); + + return 0; + } + + @Override + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte) { + int gerarRegistroP2 = this.gerarRegistroP2(lsEsquemaCorrida, dataDe, dataAte); + int gerarRegistroF2 = this.gerarRegistroF2(lsEsquemaCorrida, dataDe, dataAte); + return gerarRegistroP2 + gerarRegistroF2; + } + + @Override + public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException { + PreparedStatement stmt = null; + ResultSet rset = null; + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT TEE.TIPOEVENTOEXTRA_ID AS TIPOEVENTOEXTRAID, TEE.DESCTIPOEVENTO AS DESCTIPOEVENTO, ") + .append(" TRUNC(CD.FECHORVTA) AS FECHORVTA, SUM(CD.PRECIO) AS TOTAL ") + .append("FROM TIPO_EVENTO_EXTRA TEE ") + .append("LEFT JOIN EVENTO_EXTRA EE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ") + .append("LEFT JOIN CAJA_DIVERSOS CD ON EE.EVENTOEXTRA_ID = CD.EVENTOEXTRA_ID ") + .append("WHERE TEE.ACTIVO = 1 ") + .append("AND EE.EMPRESA_ID = ? ") + .append("AND TRUNC(CD.FECHORVTA) BETWEEN ? AND ? ") + .append("GROUP BY TEE.TIPOEVENTOEXTRA_ID, TEE.DESCTIPOEVENTO, TRUNC(CD.FECHORVTA) ") + .append("ORDER BY TRUNC(CD.FECHORVTA), TEE.DESCTIPOEVENTO "); + + stmt = connection.prepareStatement(sQuery.toString()); + stmt.setInt(1, empresaId); + stmt.setDate(2, new java.sql.Date(inicio.getTime())); + stmt.setDate(3, new java.sql.Date(fim.getTime())); + + rset = stmt.executeQuery(); + List importacionNaoFiscalVOs = new ArrayList(); + while (rset.next()) { + ImportacionNaoFiscalVO importacionNaoFiscal = new ImportacionNaoFiscalVO(); + importacionNaoFiscal.setTipoeventoextraId(rset.getInt("TIPOEVENTOEXTRAID")); + importacionNaoFiscal.setDesctipoevento(rset.getString("DESCTIPOEVENTO")); + importacionNaoFiscal.setFechorvta(rset.getDate("FECHORVTA")); + importacionNaoFiscal.setTotal(rset.getBigDecimal("TOTAL")); + + importacionNaoFiscalVOs.add(importacionNaoFiscal); + } + + return importacionNaoFiscalVOs; + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraHibernateDAO.java new file mode 100644 index 000000000..b1e6458e6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraHibernateDAO.java @@ -0,0 +1,223 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FiscalImpressoraDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; +import com.rjconsultores.ventaboletos.entidad.FormaPago; + +@Repository("fiscalImpressoraDAO") +public class FiscalImpressoraHibernateDAO extends GenericHibernateDAO implements FiscalImpressoraDAO { + + @Autowired + public FiscalImpressoraHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId) { + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FiscalTotnaofiscalEmpresa e"); + impostoHql.append(" where e.activo = 1 and e.empresa.id = :empresaEcfId"); + + Query qry = getSession().createQuery(impostoHql.toString()); + qry.setParameter("empresaEcfId", empresaEcfId); + + List list = qry.list(); + + return list; + } + + public List buscarFormaPagoEmpresa(Integer empresaEcfId) { + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FiscalFormapagoEmpresa e"); + impostoHql.append(" where e.activo = 1 and e.empresa.id = :empresaEcfId"); + + Query qry = getSession().createQuery(impostoHql.toString()); + qry.setParameter("empresaEcfId", empresaEcfId); + + List list = qry.list(); + + return list; + } + + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId) { + + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FiscalRelgerencialEmpresa e"); + impostoHql.append(" where e.activo = 1 and e.empresa.id = :empresaEcfId"); + + Query qry = getSession().createQuery(impostoHql.toString()); + qry.setParameter("empresaEcfId", empresaEcfId); + + List list = qry.list(); + + return list; + } + + public List buscarFormaPagoAplicacaoImpfiscal() { + + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FormaPago e"); + impostoHql.append(" where e.activo = 1 and e.impfiscal = 1"); + + Query qry = getSession().createQuery(impostoHql.toString()); + List list = qry.list(); + + return list; + } + + + @Override + public List obtenerTodosTotnaofiscalEmpresa() { + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + return criteria.list(); + } + + @Override + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id) { + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("fiscalformapagoempresaId", id)); + + return (FiscalTotnaofiscalEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa,String tipoTotalizador){ + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tipototalizador", tipoTotalizador)); + + return (FiscalTotnaofiscalEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa,String tipoTotalizador,String descEcf){ + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tipototalizador", tipoTotalizador)); + criteria.add(Restrictions.eq("descricao", descEcf)); + + return (FiscalTotnaofiscalEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalTotnaofiscalEmpresa suscribirTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) { + getSession().save(entidad); + getSession().flush(); + return entidad ; + } + @Override + public FiscalTotnaofiscalEmpresa actualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) { + getSession().merge(entidad); + return entidad ; + } + + @Override + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) { + getSession().merge(entidad); + getSession().flush(); + } + + + @Override + public List obtenerTodosFormapagoEmpresa() { + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + return criteria.list(); + } + + @Override + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id) { + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("fiscalformapagoempresaId", id)); + + return (FiscalFormapagoEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalFormapagoEmpresa suscribirFormapagoEmpresa(FiscalFormapagoEmpresa entidad) { + getSession().save(entidad); + getSession().flush(); + return entidad ; + } + + @Override + public FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa,String tipoformapago){ + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tipoformapago", tipoformapago)); + + return (FiscalFormapagoEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa,String tipoformapago,String descEcf){ + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("descricao", descEcf)); + criteria.add(Restrictions.eq("tipoformapago", tipoformapago)); + + return (FiscalFormapagoEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalFormapagoEmpresa actualizacionFormapagoEmpresa(FiscalFormapagoEmpresa entidad) { + getSession().merge(entidad); + getSession().flush(); + return entidad; + } + + + @Override + public List obtenerTodosRelgerencialEmpresa() { + Criteria criteria = getSession().createCriteria(FiscalRelgerencialEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + return criteria.list(); + } + + @Override + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id) { + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("fiscalformapagoempresaId", id)); + + return (FiscalRelgerencialEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + getSession().save(entidad); + getSession().flush(); + return entidad ; + } + + @Override + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + getSession().merge(entidad); + getSession().flush(); + return entidad; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FolioPreimpresoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FolioPreimpresoHibernateDAO.java new file mode 100644 index 000000000..3345f1ccf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FolioPreimpresoHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FolioPreimpresoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; + +@Repository("folioPreimpresoDAO") +public class FolioPreimpresoHibernateDAO extends GenericHibernateDAO implements FolioPreimpresoDAO { + + @Autowired + public FolioPreimpresoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa) { + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM FolioPreimpreso fp "); + hql.append(" WHERE fp.estacion.estacionId = :estacionId "); + hql.append(" AND fp.empresa.empresaId = :empresaId "); + hql.append(" AND fp.activo = :activo "); + hql.append(" ORDER BY fecmodif DESC "); + + Query query = getSession().createQuery(hql.toString()); + query.setParameter("activo", Boolean.TRUE); + query.setParameter("estacionId", estacion.getEstacionId()); + query.setParameter("empresaId", empresa.getEmpresaId()); + + query.setMaxResults(NumberUtils.INTEGER_ONE); + + return (FolioPreimpreso) query.uniqueResult(); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoDetHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoDetHibernateDAO.java new file mode 100644 index 000000000..3805d25a1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoDetHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDetDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("formaPagoDetDAO") +public class FormaPagoDetHibernateDAO extends GenericHibernateDAO + implements FormaPagoDetDAO { + + @Autowired + public FormaPagoDetHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoHibernateDAO.java new file mode 100644 index 000000000..6e69e0146 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoHibernateDAO.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("formaPagoDAO") +public class FormaPagoHibernateDAO extends GenericHibernateDAO + implements FormaPagoDAO { + + @Autowired + public FormaPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descpago")); + + return c.list(); + } + + public List buscarPorDescricao(String descpago) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descpago", descpago)); + + return c.list(); + } + + public List buscarTodosExceto(Integer... idFormaPago) { + Criteria c = this.makeCriteria(); + for (Integer id : idFormaPago) { + c.add(Restrictions.ne("formapagoId", id.shortValue())); + } + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descpago")); + return c.list(); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FuncionSistemaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FuncionSistemaHibernateDAO.java new file mode 100644 index 000000000..c899169a1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/FuncionSistemaHibernateDAO.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.FuncionSistemaDAO; +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("funcionSistemaDAO") +public class FuncionSistemaHibernateDAO extends GenericHibernateDAO + implements FuncionSistemaDAO { + + @Autowired + public FuncionSistemaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.not(Restrictions.eq("descruta", "COM.RJCONSULTORES.ADMINISTRACION.GUI.CONFIGURACIONECCOMERCIALES.MENU.CONFIGURACIONGENERAL"))); + c.addOrder(Order.asc("nombfuncion")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java new file mode 100644 index 000000000..e5f32d082 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java @@ -0,0 +1,107 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +import com.rjconsultores.ventaboletos.dao.GenericDAO; +import java.io.Serializable; +import java.lang.reflect.ParameterizedType; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +/** + * + * @author gleimar + */ +public class GenericHibernateDAO extends HibernateDaoSupport implements GenericDAO { + + @SuppressWarnings("unchecked") + public GenericHibernateDAO() { + this.persistentClass = (Class) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + } + + // Classe que será persistida. + private Class persistentClass; + + public Class getPersistentClass() { + return this.persistentClass; + } + + @Override + public void borrar(T entity) { + try { + this.getHibernateTemplate().delete(entity); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + @SuppressWarnings("unchecked") + @Override + public T obtenerID(ID id) { + try { + return (T) this.getHibernateTemplate().get(getPersistentClass(), id); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + @Override + public List obtenerTodos() { + try { + return this.getHibernateTemplate().loadAll(getPersistentClass()); + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + @Override + public T suscribir(T entity) { + try { + this.getHibernateTemplate().save(entity); + return entity; + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + protected List findByCriteria(Criterion... criterion) { + try { + Criteria crit = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(getPersistentClass()); + for (Criterion c : criterion) { + crit.add(c); + } + return crit.list(); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + protected Criteria makeCriteria() { + return this.getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(getPersistentClass()); + } + + public T actualizacion(T entity) { + return getHibernateTemplate().merge(entity); + } + + public Long count(String campo, Object o) { + Criteria c = this.makeCriteria(); + + c.add(Restrictions.eq(campo, o)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCategoriaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCategoriaHibernateDAO.java new file mode 100644 index 000000000..d0464b336 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCategoriaHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.GrupoCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; + +@Repository("grupoCategoriaDAO") +public class GrupoCategoriaHibernateDAO extends GenericHibernateDAO + implements GrupoCategoriaDAO { + + @Autowired + public GrupoCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscar(String descricao) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descGrupo", descricao)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCortesiasHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCortesiasHibernateDAO.java new file mode 100644 index 000000000..51ebee4ec --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCortesiasHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.GrupoCortesiasDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("grupoCortesiaDAO") +public class GrupoCortesiasHibernateDAO extends GenericHibernateDAO + implements GrupoCortesiasDAO { + + @Autowired + public GrupoCortesiasHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descgrupo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descgrupo", descgrupo)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoRutaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoRutaHibernateDAO.java new file mode 100644 index 000000000..c200f68cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoRutaHibernateDAO.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.GrupoRutaDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Repository("grupoRutaDAO") +public class GrupoRutaHibernateDAO extends GenericHibernateDAO + implements GrupoRutaDAO { + + @Autowired + public GrupoRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorNome(String descgrupo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descgrupo", descgrupo)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/HibernateFix.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/HibernateFix.java new file mode 100644 index 000000000..503160679 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/HibernateFix.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +public class HibernateFix { + /** + * Usado para garantizar que las dos versiones del hibernate 3.6 y 3.2 realicen de forma correcta el count + * @param list + * @return + */ + public static Long count(List list) { + + Object resultado = list.iterator().next(); + + return count(resultado); + } + /** + * Usado para garantizar que las dos versiones del hibernate 3.6 y 3.2 realicen de forma correcta el count + * @param list + * @return + */ + public static Long count(Object resultado) { + Long cant = 0l; + + if (resultado instanceof Integer) { + cant = Long.valueOf(((Integer) resultado).longValue()); + } else if (resultado instanceof BigDecimal){ + cant= ((BigDecimal)resultado).longValue(); + } else { + cant = (Long) resultado; + } + return cant; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java new file mode 100644 index 000000000..0b0b34a1d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.HotelDAO; +import com.rjconsultores.ventaboletos.entidad.Hotel; + +@Repository("hotelDAO") +public class HotelHibernateDAO extends GenericHibernateDAO implements HotelDAO { + + @Autowired + public HotelHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String deschotel) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("deschotel", deschotel)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeCategoriaVentaDAOImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeCategoriaVentaDAOImpl.java new file mode 100644 index 000000000..9d2fc77fe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeCategoriaVentaDAOImpl.java @@ -0,0 +1,112 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformeCategoriaVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informeCategoriaVentaDAO") +public class InformeCategoriaVentaDAOImpl implements InformeCategoriaVentaDAO { + + private static final Logger log = Logger.getLogger(InformeCategoriaVentaDAOImpl.class); + + private String getSql(PuntoVenta puntoVenta, Ruta ruta, Parada origen, + Parada destino, Empresa empresa, Integer numServicio, Date dataInicio, + Date dataFinal) { + StringBuilder where = new StringBuilder(); + where.append(" WHERE 1 = 1 "); + + if (puntoVenta != null) { + where.append(" AND pu.puntoventa_id = ").append(puntoVenta.getPuntoventaId()); + } + + if (ruta != null) { + where.append(" AND ru.ruta_id = ").append(ruta.getRutaId()); + } + + if (origen != null) { + where.append(" AND bo.origen_id = ").append(origen.getParadaId()); + } + + if (destino != null) { + where.append(" AND bo.destino_id = ").append(destino.getParadaId()); + } + + if (empresa != null) { + where.append(" AND bo.empresacorrida_id = ").append(empresa.getEmpresaId()); + } + + if (numServicio != null) { + where.append(" AND bo.corrida_id = ").append(numServicio); + } + + if (dataInicio != null) { + where.append(" AND bo.feccorrida >= ? "); + } + + if (dataFinal != null) { + where.append(" AND bo.feccorrida <= ? "); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT bo.corrida_id, bo.feccorrida, pao.descparada origen, pad.descparada destino, "); + sql.append(" ca.desccategoria, COUNT(*) qtde, SUM(bo.preciopagado) valor, ru.descruta, "); + sql.append(" pu.nombpuntoventa "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN categoria ca ON ca.categoria_id = bo.categoria_id "); + sql.append(" INNER JOIN parada pao ON pao.parada_id = bo.origen_id "); + sql.append(" INNER JOIN parada pad ON pad.parada_id = bo.destino_id "); + sql.append(" INNER JOIN corrida co ON co.corrida_id = bo.corrida_id "); + sql.append(" INNER JOIN ruta ru ON ru.ruta_id = co.ruta_id "); + sql.append(" INNER JOIN punto_venta pu ON pu.puntoventa_id = bo.puntoventa_id "); + sql.append(where); + sql.append(" GROUP BY bo.corrida_id, pao.descparada, pad.descparada, "); + sql.append(" ca.desccategoria, bo.feccorrida, ru.descruta, pu.nombpuntoventa "); + sql.append(" ORDER BY ca.desccategoria "); + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + Ruta ruta = (Ruta) parameters.get("ruta"); + PuntoVenta puntoVenta = (PuntoVenta) parameters.get("puntoVenta"); + Empresa empresa = (Empresa) parameters.get("empresa"); + Parada origen = (Parada) parameters.get("origen"); + Parada destino = (Parada) parameters.get("destino"); + Integer numServicio = (Integer) parameters.get("numServicio"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + String sql = getSql(puntoVenta, ruta, origen, destino, empresa, + numServicio, dataInicio, dataFinal); + + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformePasajeroServicioDAOImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformePasajeroServicioDAOImpl.java new file mode 100644 index 000000000..b6a37a640 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformePasajeroServicioDAOImpl.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformePasajeroServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informePasajeroServicioDAO") +public class InformePasajeroServicioDAOImpl implements InformePasajeroServicioDAO { + + private static final Logger log = Logger.getLogger(InformePasajeroServicioDAOImpl.class); + + private String getSql(Empresa empresa, Marca marca, Integer numServicio, + Date dataInicio, Date dataFinal) { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT nombpasajero, feccorrida, corrida_id, boleto_id, preciopagado, "); + sql.append(" cs.descclase, pao.descparada origen, pad.descparada destino, "); + sql.append(" fechorventa, pv.nombpuntoventa, ma.descmarca, bo.usuario_id, "); + sql.append(" em.nombempresa "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN parada pao ON pao.parada_id = bo.origen_id "); + sql.append(" INNER JOIN parada pad ON pad.parada_id = bo.destino_id "); + sql.append(" INNER JOIN clase_servicio cs ON cs.claseservicio_id = bo.claseservicio_id "); + sql.append(" INNER JOIN punto_venta pv ON pv.puntoventa_id = bo.puntoventa_id "); + sql.append(" INNER JOIN marca ma on ma.marca_id = bo.marca_id "); + sql.append(" INNER JOIN empresa em ON em.empresa_id = bo.empresacorrida_id"); + sql.append(" WHERE 1=1 "); + + if (empresa != null) { + sql.append(" AND bo.empresacorrida_id = ").append(empresa.getEmpresaId()); + } + + if (marca != null) { + sql.append(" AND bo.marca_id = ").append(marca.getMarcaId()); + } + + if (numServicio != null) { + sql.append(" AND corrida_id = ").append(numServicio); + } + + if (dataInicio != null) { + sql.append(" AND bo.fechorventa >= ? "); + } + + if (dataFinal != null) { + sql.append(" AND bo.fechorventa <= ? "); + } + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + Empresa empresa = (Empresa) parameters.get("empresa"); + Marca marca = (Marca) parameters.get("marca"); + Integer numServicio = (Integer) parameters.get("numServicio"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + + String sql = getSql(empresa, marca, numServicio, dataInicio, dataFinal); + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeServicioDiarioDAOImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeServicioDiarioDAOImpl.java new file mode 100644 index 000000000..e62e5d167 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeServicioDiarioDAOImpl.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformeServicioDiarioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informeServicioDiarioDAO") +public class InformeServicioDiarioDAOImpl implements InformeServicioDiarioDAO { + + private static final Logger log = Logger.getLogger(InformeServicioDiarioDAOImpl.class); + + private String getSql(Empresa empresa, Integer numServicio, Date dataInicio, + Date dataFinal) { + StringBuilder where = new StringBuilder(); + where.append(" WHERE 1 = 1 "); + + if (empresa != null) { + where.append(" AND co.empresacorrida_id = ").append(empresa.getEmpresaId()); + } + + if (numServicio != null) { + where.append(" AND co.corrida_id = ").append(numServicio); + } + + if (dataInicio != null) { + where.append(" AND co.feccorrida >= ? "); + } + + if (dataFinal != null) { + where.append(" AND co.feccorrida <= ? "); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT co.corrida_id servico, co.fechorsalida, SUM(tr.cantkmreal) km, "); + sql.append(" COUNT(co.corrida_id) qtdeservico, SUM(bo.preciopagado) receita, "); + sql.append(" ( SUM(bo.preciopagado) / SUM(tr.cantkmreal) ) rkm, em.nombempresa, "); + sql.append(" ru.descruta "); + sql.append(" FROM corrida co "); + sql.append(" INNER JOIN empresa em ON em.empresa_id = co.empresacorrida_id "); + sql.append(" INNER JOIN ruta ru ON ru.ruta_id = co.ruta_id "); + sql.append(" INNER JOIN ruta_secuencia rs ON rs.ruta_id = ru.ruta_id "); + sql.append(" INNER JOIN tramo tr ON tr.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN boleto bo ON bo.corrida_id = co.corrida_id "); + sql.append(where); + sql.append(" GROUP BY co.corrida_id, co.fechorsalida, em.nombempresa, ru.descruta "); + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + Empresa empresa = (Empresa) parameters.get("empresa"); + Integer numServicio = (Integer) parameters.get("numServicio"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + String sql = getSql(empresa, numServicio, dataInicio, dataFinal); + + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeVentasPuntoVentaDAOImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeVentasPuntoVentaDAOImpl.java new file mode 100644 index 000000000..1c87fc79b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeVentasPuntoVentaDAOImpl.java @@ -0,0 +1,90 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformeVentasPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informeVentasPuntoVentaDAO") +public class InformeVentasPuntoVentaDAOImpl implements InformeVentasPuntoVentaDAO { + + private static final Logger log = Logger.getLogger(InformeVentasPuntoVentaDAOImpl.class); + + private String getSql(PuntoVenta puntoVenta, Date dataInicio, Date dataFinal) { + + StringBuilder where = new StringBuilder(); + + if (dataInicio != null) { + where.append(" AND bo.fechorventa >= ? "); + } + + if (dataFinal != null) { + where.append(" AND bo.fechorventa <= ? "); + } + + if (puntoVenta != null) { + where.append(" AND pu.puntoventa_id = ").append(puntoVenta.getPuntoventaId()); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT vendidos.puntoventa_id, vendidos.nombpuntoventa, "); + sql.append(" vendidos.qtde_total AS qtde_total_vendidos, "); + sql.append(" vendidos.valor_total AS valor_total_vendidos, "); + sql.append(" cancelado.qtde_total AS qtde_total_cancelado, "); + sql.append(" cancelado.valor_total as valor_total_cancelado "); + sql.append(" FROM (SELECT pu.puntoventa_id, pu.nombpuntoventa, "); + sql.append(" COUNT(*) qtde_total, "); + sql.append(" SUM(bo.preciopagado) valor_total "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN punto_venta pu ON pu.puntoventa_id = bo.puntoventa_id "); + sql.append(" WHERE bo.motivocancelacion_id IS NOT NULL ").append(where); + sql.append(" GROUP BY pu.puntoventa_id, pu.nombpuntoventa) cancelado "); + sql.append(" INNER JOIN (SELECT pu.puntoventa_id, pu.nombpuntoventa, "); + sql.append(" COUNT(*) qtde_total, "); + sql.append(" SUM(bo.preciopagado) valor_total "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN punto_venta pu ON pu.puntoventa_id = bo.puntoventa_id "); + sql.append(" WHERE bo.motivocancelacion_id IS NULL ").append(where); + sql.append(" GROUP BY pu.puntoventa_id, pu.nombpuntoventa) vendidos "); + sql.append(" ON cancelado.puntoventa_id = vendidos.puntoventa_id "); + sql.append(" ORDER BY nombpuntoventa "); + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + PuntoVenta puntoVenta = (PuntoVenta) parameters.get("puntoVenta"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + + String sql = getSql(puntoVenta, dataInicio, dataFinal); + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + stmt.setDate(3, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(4, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InstiFinanceiraHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InstiFinanceiraHibernateDAO.java new file mode 100644 index 000000000..a9cbb19f0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/InstiFinanceiraHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.InstiFinanceiraDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +@Repository("ptovtaBancoDAO") +public class InstiFinanceiraHibernateDAO extends GenericHibernateDAO + implements InstiFinanceiraDAO { + + @Autowired + public InstiFinanceiraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nome")); + return c.list(); + } + + public List buscar(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nome", nome)); + return c.list(); + } + + @Override + public List buscarContasBancariasPorIdEmpresa(Integer empresaId) { + + Criteria c = getSession().createCriteria(EmpresaContaBancaria.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa.empresaId", empresaId)); + + List empresasContaBancarias = (List) c.list(); + return empresasContaBancarias; + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemAdicionalHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemAdicionalHibernateDAO.java new file mode 100644 index 000000000..47ad84de6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemAdicionalHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ItemAdicionalDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +@Repository("itemAdicionalDAO") +public class ItemAdicionalHibernateDAO extends GenericHibernateDAO implements ItemAdicionalDAO { + + @Autowired + public ItemAdicionalHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descitemadicional")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaItemAdicionalPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select pi.itemAdicional "); + sb.append(" from PacoteItem pi "); + sb.append(" where pi.pacote.pacoteId = :pacoteId "); + sb.append(" and pi.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemDescontoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemDescontoHibernateDAO.java new file mode 100644 index 000000000..bec469943 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemDescontoHibernateDAO.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ItemDescontoDAO; +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; + +@Repository("itemDescontoDAO") +public class ItemDescontoHibernateDAO extends GenericHibernateDAO implements ItemDescontoDAO { + + @Autowired + public ItemDescontoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List buscarPorNome(String nomitemdesconto) { + StringBuilder sb = new StringBuilder(); + sb.append(" select id ") + .append(" from ItemDesconto id ") + .append(" where id.activo = 1 "); + + if(StringUtils.isNotBlank(nomitemdesconto)) { + sb.append("and id.nomitemdesconto = :nomitemdesconto "); + } + + Query query = getSession().createQuery(sb.toString()); + + if(StringUtils.isNotBlank(nomitemdesconto)) { + query.setString("nomitemdesconto", nomitemdesconto); + } + + return query.list(); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java new file mode 100644 index 000000000..6ab67b944 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MarcaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + +@Repository("marcaAutobusDAO") +public class MarcaAutobusHibernateDAO extends GenericHibernateDAO +implements MarcaAutobusDAO { + + @Autowired + public MarcaAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaClaseServicioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaClaseServicioHibernateDAO.java new file mode 100644 index 000000000..1fe9182b6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaClaseServicioHibernateDAO.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MarcaClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("marcaClaseServicioDAO") +public class MarcaClaseServicioHibernateDAO + extends GenericHibernateDAO + implements MarcaClaseServicioDAO { + + @Autowired + public MarcaClaseServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(ClaseServicio clase) { + + StringBuilder hql = new StringBuilder(); + hql.append(" select mc.marcaClaseservicioPK.marca "); + hql.append(" from MarcaClaseServicio mc "); + hql.append(" where mc.activo = 1 and mc.marcaClaseservicioPK.marca.activo=1 "); + hql.append(" and mc.marcaClaseservicioPK.claseservicio.claseservicioId = " + clase.getClaseservicioId()); + + Query q = getSession().createQuery(hql.toString()); + + return q.list(); + } + + @Override + public List buscarPorEmpresasPermitidas(ClaseServicio clase, List idsEmpresa) { + + StringBuilder hql = new StringBuilder(); + hql.append(" select mc.marcaClaseservicioPK.marca "); + hql.append(" from MarcaClaseServicio mc "); + hql.append(" where mc.activo = 1 and mc.marcaClaseservicioPK.marca.activo=1 "); + hql.append(" and mc.marcaClaseservicioPK.claseservicio.claseservicioId = :idClase"); + hql.append(" and mc.marcaClaseservicioPK.marca.empresa.empresaId IN (:idsEmpresa)"); + + Query q = getSession().createQuery(hql.toString()); + q.setParameter("idClase", clase.getClaseservicioId()); + q.setParameterList("idsEmpresa", idsEmpresa); + + return q.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaHibernateDAO.java new file mode 100644 index 000000000..2dff54a51 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaHibernateDAO.java @@ -0,0 +1,102 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Transformer; +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +@Repository("marcaDAO") +public class MarcaHibernateDAO extends GenericHibernateDAO + implements MarcaDAO { + + @Autowired + public MarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmarca")); + + return c.list(); + + } + + public List buscarPorNome(String nomeMarca) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmarca", nomeMarca)); + + return c.list(); + } + + public List buscarTodosExceto(Usuario usuario, Integer... idMarca) { + String hql = " select new com.rjconsultores.ventaboletos.entidad.Marca(marca.marcaId, marca.descmarca) from Marca marca, UsuarioEmpresa ue" + + " where marca.empresa = ue.empresa and ue.usuarioLog = :usuarioId "; + + hql = hql + " and marca.marcaId not in ( " + StringUtils.join(idMarca, ",") + ")"; + + Query sq = getSession().createQuery(hql); + sq.setParameter("usuarioId", usuario); + List lsMarca = sq.list(); + return lsMarca; + + } + + @Override + public List buscarDescricaoIdMarca() { + String hql = " select new com.rjconsultores.ventaboletos.entidad.Marca(m.marcaId, m.descmarca) from Marca m where m.marcaId <> -1 "; + Query sq = getSession().createQuery(hql); + List lsMarca = sq.list(); + return lsMarca; + } + + public List buscarMarcaPorEmpresa(List empresa) { + if ((empresa == null) || (empresa.isEmpty())) { + return Collections.emptyList(); + } + Collection idsEmpresa = CollectionUtils.transformedCollection(empresa, new Transformer() { + + @Override + public Object transform(Object input) { + return ((Empresa) input).getEmpresaId(); + } + }); + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.in("empresa", idsEmpresa)); + c.setFetchMode("logotipomarca", FetchMode.DEFAULT); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MercadoCompetidoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MercadoCompetidoHibernateDAO.java new file mode 100644 index 000000000..968e289e8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MercadoCompetidoHibernateDAO.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MercadoCompetidoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("mercadoCompetidoDAO") +public class MercadoCompetidoHibernateDAO + extends GenericHibernateDAO + implements MercadoCompetidoDAO { + + @Autowired + public MercadoCompetidoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean existe(ClaseServicio claseServicio, Parada origem, + Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + + c.setProjection(Projections.rowCount()); + + return (HibernateFix.count(c.list()) > 0) ; + } + + public List buscar(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MerchantBancarioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MerchantBancarioHibernateDAO.java new file mode 100644 index 000000000..0612c810e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MerchantBancarioHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MerchantBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("merchantBancarioDAO") +public class MerchantBancarioHibernateDAO extends GenericHibernateDAO + implements MerchantBancarioDAO { + + @Autowired + public MerchantBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MonedaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MonedaHibernateDAO.java new file mode 100644 index 000000000..2371096cc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MonedaHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MonedaDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("monedaDAO") +public class MonedaHibernateDAO extends GenericHibernateDAO + implements MonedaDAO { + + @Autowired + public MonedaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmoneda")); + + return c.list(); + } + + public List buscar(String descmoneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmoneda", descmoneda)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelacionHibernateDAO.java new file mode 100644 index 000000000..2b1e7e2fe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelacionHibernateDAO.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("motivoCancelacionDAO") +public class MotivoCancelacionHibernateDAO extends GenericHibernateDAO + implements MotivoCancelacionDAO { + + @Autowired + public MotivoCancelacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List buscar(String descmotivo, String tipomotivo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmotivo", descmotivo)); + c.add(Restrictions.eq("tipomotivo", tipomotivo)); + + return c.list(); + } + + public List obtenerTodosTipoMotivoB() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipomotivo", "B")); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("motivocancelacionId", motivos)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoReimpresionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoReimpresionHibernateDAO.java new file mode 100644 index 000000000..b08c35878 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoReimpresionHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivoReimpresionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("motivoReimpresionDAO") +public class MotivoReimpresionHibernateDAO extends GenericHibernateDAO + implements MotivoReimpresionDAO { + + @Autowired + public MotivoReimpresionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List buscar(String descmotivo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmotivo", descmotivo)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoViajeHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoViajeHibernateDAO.java new file mode 100644 index 000000000..21fa984ca --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoViajeHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivoViajeDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("motivoViajeDAO") +public class MotivoViajeHibernateDAO extends GenericHibernateDAO + implements MotivoViajeDAO { + + @Autowired + public MotivoViajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivocancelacionEquivalenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivocancelacionEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..2f0ff8b46 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivocancelacionEquivalenciaHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivocancelacionEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("motivocancelacionEquivalenciaDAO") +public class MotivocancelacionEquivalenciaHibernateDAO extends GenericHibernateDAO + implements MotivocancelacionEquivalenciaDAO { + + @Autowired + public MotivocancelacionEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(ComisionistaExterno comisionistaExterno, MotivoCancelacion motivoCancelacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + c.add(Restrictions.eq("motivoCancelacion", motivoCancelacion)); + + return c.list(); + } + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("equivalenciaId", motivoCancelacionEquivalencia.getEquivalenciaId())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/NodoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/NodoHibernateDAO.java new file mode 100644 index 000000000..4b356e325 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/NodoHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.NodoDAO; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("nodoDAO") +public class NodoHibernateDAO extends GenericHibernateDAO + implements NodoDAO { + + @Autowired + public NodoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descnodo")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDParamHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDParamHibernateDAO.java new file mode 100644 index 000000000..560b92a64 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDParamHibernateDAO.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OCDParamDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.ControleEstoqueMigracao; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; + +@Repository("ocdParamDAO") +public class OCDParamHibernateDAO extends GenericHibernateDAO implements OCDParamDAO { + + @Autowired + public OCDParamHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + List params = findByCriteria(Restrictions.eq("activo", Boolean.TRUE)); + return params; + } + + @Override + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa) { + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (OCDParam)c.uniqueResult(); + } + + @Override + public List buscaOCDParams(Empresa empresa) { + List params = findByCriteria(Restrictions.eq("empresa", empresa), Restrictions.eq("activo", Boolean.TRUE)); + return params; + } + + @Override + public OCDParam suscribirActualizar(OCDParam entidad){ + try { + if (entidad.getOcdparamId() != null){ + this.getHibernateTemplate().merge(entidad); + } else { + this.getHibernateTemplate().save(entidad); + } + return entidad; + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoCancelacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoCancelacionHibernateDAO.java new file mode 100644 index 000000000..c01bdc3ea --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoCancelacionHibernateDAO.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OrgaoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +@Repository("orgaoCancelacionDAO") +public class OrgaoCancelacionHibernateDAO extends GenericHibernateDAO implements OrgaoCancelacionDAO { + + @Autowired + public OrgaoCancelacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descOrgao")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodosIds() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.property("orgaoCancelacionId")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.like("orgao", orgaoConcedente)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoConcedenteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoConcedenteHibernateDAO.java new file mode 100644 index 000000000..c6b97754a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoConcedenteHibernateDAO.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +@Repository("orgaoConcedenteDAO") +public class OrgaoConcedenteHibernateDAO extends GenericHibernateDAO implements OrgaoConcedenteDAO { + + @Autowired + public OrgaoConcedenteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descOrgao")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodosIds() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.property("orgaoConcedenteId")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscar(String desc) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.like("descOrgao", desc)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoTramoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoTramoHibernateDAO.java new file mode 100644 index 000000000..abb317fa5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoTramoHibernateDAO.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; + +@Repository("orgaoTramoDAO") +public class OrgaoTramoHibernateDAO extends GenericHibernateDAO implements OrgaoTramoDAO { + + @Autowired + public OrgaoTramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Integer claseServicioId) { + Criteria c = makeCriteria(); + Criteria cTramo = c.createCriteria("tramo"); + cTramo.add(Restrictions.eq("origem.paradaId", origenId)); + cTramo.add(Restrictions.eq("destino.paradaId", destinoId)); + cTramo.add(Restrictions.eq("via.viaId", viaId)); + cTramo.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("orgaoConcedente.orgaoConcedenteId", orgaoConcedenteId)); + c.add(Restrictions.eq("claseServicio.claseservicioId", claseServicioId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setFetchMode("tramo", FetchMode.SELECT); + + List list = c.list(); + + if (list.size() > 1) { + throw new RuntimeException("Erro ao consultar os dados do coeficiente por trecho. Retornou mais de um resultado"); + } + + if (!list.isEmpty()) { + return list.get(0); + } + + return null; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteConvenioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteConvenioHibernateDAO.java new file mode 100644 index 000000000..b552055e6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteConvenioHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; + +@Repository("pacoteConvenioDAO") +public class PacoteConvenioHibernateDAO extends GenericHibernateDAO implements PacoteConvenioDAO { + + @Autowired + public PacoteConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscar(String nomconvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nomconvenio", nomconvenio)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteDescontoBilheteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteDescontoBilheteHibernateDAO.java new file mode 100644 index 000000000..a7061d0a6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteDescontoBilheteHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteDescontoBilheteDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; + +@Repository("pacoteDescontoBilheteDAO") +public class PacoteDescontoBilheteHibernateDAO extends GenericHibernateDAO implements PacoteDescontoBilheteDAO { + + private static Logger log = LoggerFactory.getLogger(PacoteDescontoBilheteHibernateDAO.class); + + @Autowired + public PacoteDescontoBilheteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos(Integer pacoteId) { + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteDescontoBilhete pdb "); + sb.append(" where pdb.pacote.pacoteId = :pacoteId "); + sb.append(" and pdb.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacoteId); + + return query.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteHibernateDAO.java new file mode 100644 index 000000000..8ab767f21 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteHibernateDAO.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +@Repository("pacoteDAO") +public class PacoteHibernateDAO extends GenericHibernateDAO implements PacoteDAO { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(PacoteHibernateDAO.class); + + @Autowired + public PacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteItemHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteItemHibernateDAO.java new file mode 100644 index 000000000..d6def7222 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteItemHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteItemDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; + +@Repository("pacoteItemDAO") +public class PacoteItemHibernateDAO extends GenericHibernateDAO implements PacoteItemDAO { + + @Autowired + public PacoteItemHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteItem pi "); + sb.append(" where pi.pacote.pacoteId = :pacoteId "); + sb.append(" and pi.itemAdicional.itemadicionalId = :itemadicionalId "); + sb.append(" and pi.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + query.setInteger("itemadicionalId", item.getItemadicionalId()); + + return (PacoteItem) query.uniqueResult(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaItensPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteItem pi "); + sb.append(" where pi.pacote.pacoteId = :pacoteId "); + sb.append(" and pi.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteTarifaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteTarifaHibernateDAO.java new file mode 100644 index 000000000..aac48e171 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteTarifaHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +@Repository("pacoteTarifaDAO") +public class PacoteTarifaHibernateDAO extends GenericHibernateDAO implements PacoteTarifaDAO { + + @Autowired + public PacoteTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteTarifa pt "); + sb.append(" where pt.pacote.pacoteId = :pacoteId "); + sb.append(" and pt.tipoTarifaPacote.tipotarifapacoteId = :tipotarifapacoteId "); + sb.append(" and pt.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + query.setInteger("tipotarifapacoteId", tipoTarifaPacote.getTipotarifapacoteId()); + + return (PacoteTarifa) query.uniqueResult(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaTarifasPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteTarifa pt "); + sb.append(" where pt.pacote.pacoteId = :pacoteId "); + sb.append(" and pt.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PaisHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PaisHibernateDAO.java new file mode 100644 index 000000000..5ef92d6b0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PaisHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PaisDAO; +import com.rjconsultores.ventaboletos.entidad.Pais; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paisDAO") +public class PaisHibernateDAO extends GenericHibernateDAO + implements PaisDAO { + + @Autowired + public PaisHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombpais")); + + return c.list(); + } + + public List buscar(String nombpais) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombpais", nombpais)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaEquivalenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..5c076d04a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaEquivalenciaHibernateDAO.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParadaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("paradaEquivalenciaDAO") +public class ParadaEquivalenciaHibernateDAO + extends GenericHibernateDAO + implements ParadaEquivalenciaDAO { + + @Autowired + public ParadaEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Parada parada, + ComisionistaExterno comisionistaExterno, String equivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("parada", parada)); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + c.add(Restrictions.eq("equivalenciaId", equivalencia)); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarEquivalencia(String equivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("equivalenciaId", equivalencia)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java new file mode 100644 index 000000000..df610ed9c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java @@ -0,0 +1,123 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParadaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; + +/** + * + * @author Administrador + */ +@Repository("paradaDAO") +public class ParadaHibernateDAO extends GenericHibernateDAO implements ParadaDAO { + + @Autowired + public ParadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("descparada")); + + return c.list(); + } + + public List buscar(String descparada, String cveparada, Ciudad ciudad, TipoParada tipoParada, Nodo nodo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descparada", descparada)); + c.add(Restrictions.eq("cveparada", cveparada)); + c.add(Restrictions.eq("ciudad", ciudad)); + c.add(Restrictions.eq("tipoParada", tipoParada)); + c.add(Restrictions.eq("nodo", nodo)); + + return c.list(); + } + + public List buscar(String descparada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descparada", descparada)); + + return c.list(); + } + + public List buscarCVE(String cveparada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cveparada", cveparada)); + + return c.list(); + } + + public List buscaLike(String descparada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("descparada", descparada, MatchMode.START)); + + c.addOrder(Order.asc("descparada")); + + return c.list(); + } + + public Long count(TipoParada tipoParada) { + Criteria c = this.makeCriteria(); + + c.add(Restrictions.eq("tipoParada", tipoParada)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + + } + + @Override + public List buscar(Integer codAntt) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("codantt", codAntt)); + + return c.list(); + } + + @Override + public List obtenerOrigenPorRuta(Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.createAlias("tramoOrigemList", "tramo"); + c.createAlias("tramo.rutaCombinacionList", "rutaCombinacion"); + c.createAlias("rutaCombinacion.ruta", "ruta"); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ruta.rutaId", ruta.getRutaId())); + + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaMasivoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaMasivoHibernateDAO.java new file mode 100644 index 000000000..980ea657a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaMasivoHibernateDAO.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaMasivoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; + +/** + * + * @author Rafius + */ +@Repository("paramAcumulaMasivoDAO") +public class ParamAcumulaMasivoHibernateDAO extends GenericHibernateDAO + implements ParamAcumulaMasivoDAO { + + @Autowired + public ParamAcumulaMasivoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (emp != null) { + c.add(Restrictions.eq("empresa", emp)); + } + if (min != null) { + c.add(Restrictions.ge("minpuntootorga", min)); + } + if (max != null) { + c.add(Restrictions.le("maxpuntootorga", max)); + } + if (fecIni != null) { + c.add(Restrictions.ge("feciniciovigencia", fecIni)); + } + if (fecFim != null) { + c.add(Restrictions.le("fecfinvigencia", fecFim)); + } + + return c.list(); + } + + @Override + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo) { + Criteria c = this.getSession().createCriteria(ParamAcumulaMasivo.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfinvigencia", paramAcumulaMasivo.getFeciniciovigencia())); + c.add(Restrictions.le("feciniciovigencia", paramAcumulaMasivo.getFecfinvigencia())); + c.add(Restrictions.eq("empresa", paramAcumulaMasivo.getEmpresa())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaPuntoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaPuntoHibernateDAO.java new file mode 100644 index 000000000..270949863 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaPuntoHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paramAcumulaPuntoDAO") +public class ParamAcumulaPuntoHibernateDAO extends GenericHibernateDAO + implements ParamAcumulaPuntoDAO { + + @Autowired + public ParamAcumulaPuntoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + if (ini != null) { + c.add(Restrictions.ge("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.le("fecfinvigencia", fim)); + } + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamArticuloHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamArticuloHibernateDAO.java new file mode 100644 index 000000000..cabde53f8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamArticuloHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParamArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; + +@Repository("paramArticuloDAO") +public class ParamArticuloHibernateDAO extends + GenericHibernateDAO implements ParamArticuloDAO { + + @Autowired + public ParamArticuloHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + // c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCanjePuntoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCanjePuntoHibernateDAO.java new file mode 100644 index 000000000..3347d5dd7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCanjePuntoHibernateDAO.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamCanjePuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paramCanjePuntoDAO") +public class ParamCanjePuntoHibernateDAO extends GenericHibernateDAO + implements ParamCanjePuntoDAO { + + @Autowired + public ParamCanjePuntoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + if (ini != null) { + c.add(Restrictions.ge("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.le("fecfinvigencia", fim)); + } + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCompraPuntoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCompraPuntoHibernateDAO.java new file mode 100644 index 000000000..fe4818a95 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCompraPuntoHibernateDAO.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamCompraPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paramCompraPuntoDAO") +public class ParamCompraPuntoHibernateDAO extends GenericHibernateDAO + implements ParamCompraPuntoDAO { + + @Autowired + public ParamCompraPuntoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Date ini, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (ini != null) { + c.add(Restrictions.ge("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.le("fecfinvigencia", fim)); + } + + return c.list(); + + } + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (ini != null) { + c.add(Restrictions.eq("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.eq("fecfinvigencia", fim)); + } + + if (cantPuntos != null) { + c.add(Restrictions.eq("cantpunto", cantPuntos)); + } + + if (costoPunto != null) { + c.add(Restrictions.eq("valcostopunto", costoPunto)); + } + + return c.list(); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamConexionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamConexionHibernateDAO.java new file mode 100644 index 000000000..db64fbd08 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamConexionHibernateDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParamConexionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamConexion; + +@Repository("paramConexionDAO") +public class ParamConexionHibernateDAO extends GenericHibernateDAO implements ParamConexionDAO { + @Autowired + public ParamConexionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCostoTarjetaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCostoTarjetaHibernateDAO.java new file mode 100644 index 000000000..bbf14d191 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCostoTarjetaHibernateDAO.java @@ -0,0 +1,41 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParamCostoTarjetaDAO; +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; + +/** + * + * @author Rafius + */ +@Repository("paramCostoTarjetaDAO") +public class ParamCostoTarjetaHibernateDAO extends GenericHibernateDAO + implements ParamCostoTarjetaDAO { + + @Autowired + public ParamCostoTarjetaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(ParamCostoTarjeta paramCostoTarjeta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empresa", paramCostoTarjeta.getEmpresa())); + c.add(Restrictions.eq("valcostoinicial", paramCostoTarjeta.getValcostoinicial())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamRecoleccionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamRecoleccionHibernateDAO.java new file mode 100644 index 000000000..98e4fd463 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamRecoleccionHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamRecoleccionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("paramRecoleccionDAO") +public class ParamRecoleccionHibernateDAO extends GenericHibernateDAO + implements ParamRecoleccionDAO { + + @Autowired + public ParamRecoleccionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilFuncionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilFuncionHibernateDAO.java new file mode 100644 index 000000000..abd4e1b1b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilFuncionHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PerfilFuncionDAO; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("perfilFuncionDAO") +public class PerfilFuncionHibernateDAO extends GenericHibernateDAO + implements PerfilFuncionDAO { + + @Autowired + public PerfilFuncionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilHibernateDAO.java new file mode 100644 index 000000000..d42ecb573 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilHibernateDAO.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.vo.segurida.PerfilJerarquia; + +/** + * + * @author rodrigo + */ +@Repository("perfilDAO") +public class PerfilHibernateDAO extends GenericHibernateDAO + implements PerfilDAO { + + @Autowired + public PerfilHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaPerfilJerarquia(Perfil perfilUsuario) { + + PerfilJerarquia usuarioJerarquia = perfilUsuario.getIndJerarquia() == null ? PerfilJerarquia.NORMAL : PerfilJerarquia.buscar(perfilUsuario.getIndJerarquia()); + + StringBuilder sb = new StringBuilder(); + sb.append(" from Perfil p "); + sb.append(" where p.activo = 1 "); + + if (!usuarioJerarquia.equals(PerfilJerarquia.ADMIN)) { + if (!usuarioJerarquia.equals(PerfilJerarquia.NORMAL)) { + sb.append(" and (p.indJerarquia >= " + usuarioJerarquia.getValor() + " or p.indJerarquia <=" + PerfilJerarquia.NORMAL.getValor() + " or p.indJerarquia is null ) "); + } else { + sb.append(" and (p.indJerarquia is null or p.indJerarquia <=" + PerfilJerarquia.NORMAL.getValor() + " ) "); + } + } + sb.append(" order by p.descperfil "); + + Query query = getSession().createQuery(sb.toString()); + return query.list(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.not(Restrictions.eq("descperfil", "RJ"))); + c.addOrder(Order.asc("descperfil")); + + return c.list(); + } + + public List buscar(String dscPerfil) { + + return this.findByCriteria(Restrictions.eq("descperfil", dscPerfil.trim()), Restrictions.eq("activo", Boolean.TRUE)); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PeriodoVacacionalHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PeriodoVacacionalHibernateDAO.java new file mode 100644 index 000000000..a76679158 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PeriodoVacacionalHibernateDAO.java @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PeriodoVacacionalDAO; +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; + +/** + * + * @author Rafius + */ +@Repository("periodoVacacionalDAO") +public class PeriodoVacacionalHibernateDAO extends GenericHibernateDAO + implements PeriodoVacacionalDAO { + + @Autowired + public PeriodoVacacionalHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(Date dataInicio, Date dataFim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("fecinicio", dataInicio)); + c.add(Restrictions.eq("fecfinal", dataFim)); + + return c.list(); + } + + @Override + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional) { + + Criteria c = this.getSession().createCriteria(PeriodoVacacional.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfinal", periodoVacacional.getFecinicio())); + c.add(Restrictions.le("fecinicio", periodoVacacional.getFecfinal())); + + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PlazaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PlazaHibernateDAO.java new file mode 100644 index 000000000..6be8cf105 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PlazaHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PlazaDAO; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("plazaDAO") +public class PlazaHibernateDAO extends GenericHibernateDAO + implements PlazaDAO { + + @Autowired + public PlazaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombplaza")); + + return c.list(); + } + + public List buscar(String nombplaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombplaza", nombplaza)); + + return c.list(); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioVentajaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioVentajaHibernateDAO.java new file mode 100644 index 000000000..6a2463ef3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioVentajaHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PrecioVentajaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; + +/** + * + * @author Igor + */ +@Repository("precioVentajaDAO") +public class PrecioVentajaHibernateDAO extends GenericHibernateDAO + implements PrecioVentajaDAO { + + @Autowired + public PrecioVentajaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarPrecioVentaja(Integer origenId, Integer destinoId, Integer rutaId) { + StringBuilder sb = new StringBuilder(); + sb.append(" from PrecioVentaja "); + sb.append(" where activo = 1 "); + + if (origenId != null) { + sb.append(" and origenOriginalId = ").append(origenId); + } + if (destinoId != null) { + sb.append(" and destinoOriginalId = ").append(destinoId); + } + if (rutaId != null) { + sb.append(" and rutaOriginalId = ").append(rutaId); + } + + Query query = getSession().createQuery(sb.toString()); + List list = query.list(); + + return list; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java new file mode 100644 index 000000000..5def1d8eb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PrecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +@Repository("precoApanheDAO") +public class PrecoApanheHibernateDAO extends GenericHibernateDAO implements PrecoApanheDAO { + + @Autowired + public PrecoApanheHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscar(String deschotel, String desccolonia, String nombciudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if(StringUtils.isNotBlank(deschotel)) { + c.add(Restrictions.eq("hotel.deschotel", deschotel)); + } + + if(StringUtils.isNotBlank(desccolonia)) { + c.add(Restrictions.eq("colonia.desccolonia", desccolonia)); + } + + if(StringUtils.isNotBlank(nombciudad)) { + c.add(Restrictions.eq("ciudad.nombciudad", nombciudad)); + } + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAsientoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAsientoHibernateDAO.java new file mode 100644 index 000000000..7a11301d2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAsientoHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingAsientoDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingAsientoDAO") +public class PricingAsientoHibernateDAO extends GenericHibernateDAO + implements PricingAsientoDAO { + + @Autowired + public PricingAsientoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List obtenerPricingCategoria(Pricing pricing, Integer asiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("numeasiento", asiento.toString())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCategoriaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCategoriaHibernateDAO.java new file mode 100644 index 000000000..4ed618cc1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCategoriaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingCategoriaDAO") +public class PricingCategoriaHibernateDAO extends GenericHibernateDAO + implements PricingCategoriaDAO { + + @Autowired + public PricingCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("categoria", categoria)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClaseHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClaseHibernateDAO.java new file mode 100644 index 000000000..2c21c86a2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClaseHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingClaseDAO") +public class PricingClaseHibernateDAO extends GenericHibernateDAO + implements PricingClaseDAO { + + @Autowired + public PricingClaseHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClasseTarifariaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClasseTarifariaHibernateDAO.java new file mode 100644 index 000000000..b396e1bb3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClasseTarifariaHibernateDAO.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingClasseTarifariaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; + +@Repository("pricingClasseTarifariaDAO") +public class PricingClasseTarifariaHibernateDAO extends GenericHibernateDAO + implements PricingClasseTarifariaDAO { + + @Autowired + public PricingClasseTarifariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public Boolean validacionSigla(String sigla) { + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM PricingClasseTarifaria pct "); + hql.append(" WHERE pct.sigla = :sigla "); + hql.append(" AND pct.activo = :activo "); + + Query query = getSession().createQuery(hql.toString()); + query.setParameter("activo", Boolean.TRUE); + query.setParameter("sigla", sigla); + + if (query.list().isEmpty()) + return true; + else + return false; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCorridaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCorridaHibernateDAO.java new file mode 100644 index 000000000..fd2868e39 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCorridaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingCorridaDAO") +public class PricingCorridaHibernateDAO extends GenericHibernateDAO + implements PricingCorridaDAO { + + @Autowired + public PricingCorridaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("corridaCtrl", corrida)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingDiaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingDiaHibernateDAO.java new file mode 100644 index 000000000..d05e8e5b5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingDiaHibernateDAO.java @@ -0,0 +1,96 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingDiaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingDiaDAO") +public class PricingDiaHibernateDAO extends GenericHibernateDAO + implements PricingDiaDAO { + + private static Logger log = Logger.getLogger(PricingDiaHibernateDAO.class); + + @Autowired + public PricingDiaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List buscarTraslapa(PricingDia pricingDia) { + Date horarioinicio = pricingDia.getHorarioinicio(); + Date horariofin = pricingDia.getHorariofin(); + + SimpleDateFormat sf = new SimpleDateFormat("HHmm"); + + StringBuilder hql = new StringBuilder(); + hql.append("select pv from PricingDia pv "); + hql.append(" where pv.activo = 1 "); + hql.append(" and pricing.pricingId = ").append(pricingDia.getPricing().getPricingId()); + // hql.append(" and ( 1=1 or "); + // if (pricingDia.getIndlunes()) { + // hql.append(" pv.indlunes = ").append(pricingDia.getIndlunes()); + // } + // if (pricingDia.getIndmartes()) { + // hql.append(" or pv.indmartes = ").append(pricingDia.getIndmartes()); + // } + // if (pricingDia.getIndmiercoles()) { + // hql.append(" or pv.indmiercoles = ").append(pricingDia.getIndmiercoles()); + // } + // if (pricingDia.getIndjueves()) { + // hql.append(" or pv.indjueves = ").append(pricingDia.getIndjueves()); + // } + // if (pricingDia.getIndviernes()) { + // hql.append(" or pv.indviernes = ").append(pricingDia.getIndviernes()); + // } + // if (pricingDia.getIndsabado()) { + // hql.append(" or pv.indsabado = ").append(pricingDia.getIndsabado()); + // } + // if (pricingDia.getInddomingo()) { + // hql.append(" or pv.inddomingo = ").append(pricingDia.getInddomingo()); + // } + // hql.append(" ) "); + // hql.append(" and ((( to_char('").append(sf.format(horarioinicio)).append("') BETWEEN to_char(pv.horarioinicio, 'HH24MI') AND to_char(pv.horariofin, 'HH24MI') ) "); + // hql.append(" OR (to_char('").append(sf.format(horariofin)).append("') BETWEEN to_char(pv.horarioinicio, 'HH24MI') AND to_char(pv.horariofin, 'HH24MI'))) "); + // hql.append(" OR ((to_char(pv.horarioinicio, 'HH24MI') BETWEEN to_char('").append(sf.format(horarioinicio)).append("') AND to_char('").append(sf.format(horariofin)).append("') ) "); + // hql.append(" OR (to_char(pv.horariofin, 'HH24MI') BETWEEN to_char('").append(sf.format(horarioinicio)).append("') AND to_char('").append(sf.format(horariofin)).append("') ))) "); + + hql.append(" and pv.horariofin >= :horariofin "); + hql.append(" and pv.horarioinicio >= :horarioinicio "); + + log.info("Hora Ini: " + sf.format(horarioinicio)); + log.info("Hora Fin: " + sf.format(horariofin)); + log.info("SQL: " + hql.toString()); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("horariofin", horariofin); + sq.setParameter("horarioinicio", horarioinicio); + + return sq.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoHibernateDAO.java new file mode 100644 index 000000000..e95532c9f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoHibernateDAO.java @@ -0,0 +1,132 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingEspecificoDAO") +public class PricingEspecificoHibernateDAO extends GenericHibernateDAO + implements PricingEspecificoDAO { + + @Autowired + public PricingEspecificoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorNome(PricingEspecifico pricingEspecifico) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombPricing", pricingEspecifico.getNombPricing())); + + return c.list(); + } + + @Override + public List buscarPorNome(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombPricing", nome)); + + return c.list(); + } + + @Override + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal) { + + StringBuilder hql = new StringBuilder(); + hql.append("SELECT DISTINCT pe "); + hql.append("FROM PricingEspecifico pe "); + hql.append(" WHERE pe.activo = 1 "); + + if (!empresas.isEmpty()) { + hql.append(" AND pe.marca.empresa.empresaId IN ("); + for (Empresa e : empresas) { + hql.append(e.getEmpresaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!tipoClasses.isEmpty()) { + hql.append(" AND pe.claseServicio.claseservicioId IN ("); + for (ClaseServicio c : tipoClasses) { + hql.append(c.getClaseservicioId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!origens.isEmpty()) { + hql.append(" AND pe.parada.paradaId IN ("); + for (Parada o : origens) { + hql.append(o.getParadaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!destinos.isEmpty()) { + hql.append(" AND pe.parada1.paradaId IN ("); + for (Parada o : origens) { + hql.append(o.getParadaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (vigenciaInicial != null) { + hql.append(" AND YEAR(pe.fechorinicio) >= YEAR(:vigenciaInicial) "); + hql.append(" AND MONTH(pe.fechorinicio)>= MONTH(:vigenciaInicial) "); + hql.append(" AND DAY(pe.fechorinicio) >= DAY(:vigenciaInicial) "); + } + + if (vigenciaFinal != null) { + hql.append(" AND YEAR(pe.fechorfin) <= YEAR(:vigenciaFinal) "); + hql.append(" AND MONTH(pe.fechorfin) <= MONTH(:vigenciaFinal) "); + hql.append(" AND DAY(pe.fechorfin) <= DAY(:vigenciaFinal) "); + } + + Query query = getSession().createQuery(hql.toString()); + + if (vigenciaInicial != null) { + query.setDate("vigenciaInicial", vigenciaInicial); + } + if (vigenciaFinal != null) { + query.setDate("vigenciaFinal", vigenciaFinal); + } + + return query.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoOcupacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoOcupacionHibernateDAO.java new file mode 100644 index 000000000..4fb77ee0e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoOcupacionHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; + + +@Repository("pricingEspecificoOcupacionDAO") +public class PricingEspecificoOcupacionHibernateDAO extends GenericHibernateDAO implements PricingEspecificoOcupacionDAO { + + @Autowired + public PricingEspecificoOcupacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingFormapagoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingFormapagoHibernateDAO.java new file mode 100644 index 000000000..17e36bc40 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingFormapagoHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingFormapagoDAO; +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; + +@Repository("pricingFormapagoDAO") +public class PricingFormapagoHibernateDAO extends GenericHibernateDAO implements PricingFormapagoDAO { + + @Autowired + public PricingFormapagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingHibernateDAO.java new file mode 100644 index 000000000..68f24b763 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingHibernateDAO.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingDAO") +public class PricingHibernateDAO extends GenericHibernateDAO + implements PricingDAO { + + @Autowired + public PricingHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List buscar(String nombPricing, Empresa empresa, + Short cantboleto, Integer cantdiasanticipacion, + BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + c.add(Restrictions.eq("nombPricing", nombPricing)); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("cantboleto", cantboleto)); + c.add(Restrictions.eq("cantdiasanticipacion", cantdiasanticipacion)); + if (descuentoporcentaje != null) { + c.add(Restrictions.eq("descuentoporcentaje", descuentoporcentaje)); + } + if (descuentoporcredondo != null) { + c.add(Restrictions.eq("descuentoporcredondo", descuentoporcredondo)); + } + + return c.list(); + } + + public List buscarPorNombre(String nombPricing) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + c.add(Restrictions.eq("nombPricing", nombPricing)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingImporteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingImporteHibernateDAO.java new file mode 100644 index 000000000..7b980e97b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingImporteHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingImporteDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingImporteDAO") +public class PricingImporteHibernateDAO extends GenericHibernateDAO + implements PricingImporteDAO { + + @Autowired + public PricingImporteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricingImporte.getPricing())); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMarcaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMarcaHibernateDAO.java new file mode 100644 index 000000000..89759ffaa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMarcaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingMarcaDAO") +public class PricingMarcaHibernateDAO extends GenericHibernateDAO + implements PricingMarcaDAO { + + @Autowired + public PricingMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("marca", marca)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMercadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMercadoHibernateDAO.java new file mode 100644 index 000000000..5b6522272 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMercadoHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingMercadoDAO") +public class PricingMercadoHibernateDAO extends GenericHibernateDAO + implements PricingMercadoDAO { + + @Autowired + public PricingMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("origen", origen)); + c.add(Restrictions.eq("destino", destino)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java new file mode 100644 index 000000000..56f0c3092 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingOcupaAntecipaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; + +/** + * + * @author Rafius + */ +@Repository("pricingOcupacionDAO") +public class PricingOcupaAntecipaHibernateDAO extends GenericHibernateDAO + implements PricingOcupaAntecipaDAO { + + @Autowired + public PricingOcupaAntecipaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + return c.list(); + } + + @Override + public List buscarOcupaAntecipaPricing(Integer pricingId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing.pricingId", pricingId)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingPuntoVentaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..548307cd5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingPuntoVentaHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingPuntoVentaDAO") +public class PricingPuntoVentaHibernateDAO extends GenericHibernateDAO + implements PricingPuntoVentaDAO { + + @Autowired + public PricingPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingRutaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingRutaHibernateDAO.java new file mode 100644 index 000000000..e6bf77ab9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingRutaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingRutaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingRutaDAO") +public class PricingRutaHibernateDAO extends GenericHibernateDAO + implements PricingRutaDAO { + + @Autowired + public PricingRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("ruta", ruta)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoPtoVtaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoPtoVtaHibernateDAO.java new file mode 100644 index 000000000..4ef62278c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoPtoVtaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingTipoPtoVtaDAO") +public class PricingTipoPtoVtaHibernateDAO extends GenericHibernateDAO + implements PricingTipoPtoVtaDAO { + + @Autowired + public PricingTipoPtoVtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("tipoPtovta", tipoPuntoVenta)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoServicioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoServicioHibernateDAO.java new file mode 100644 index 000000000..2d75e7eb1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoServicioHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingTipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("pricingTipoServicioDAO") +public class PricingTipoServicioHibernateDAO extends GenericHibernateDAO + implements PricingTipoServicioDAO { + + @Autowired + public PricingTipoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("tipoServicio", tipoServicio)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingVigenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingVigenciaHibernateDAO.java new file mode 100644 index 000000000..315195b09 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingVigenciaHibernateDAO.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; + +/** + * + * @author Rafius + */ +@Repository("pricingVigenciaDAO") +public class PricingVigenciaHibernateDAO extends GenericHibernateDAO + implements PricingVigenciaDAO { + + @Autowired + public PricingVigenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + @Override + public List buscarPorVigencias(PricingVigencia pv) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + c.add(Restrictions.eq("pricing", pv.getPricing())); + + Date fecinicioventa = pv.getFecinicioventa(); + Date fecfinventa = pv.getFecfinventa(); + + c.add(Restrictions.or(Restrictions.between("fecinicioventa", fecinicioventa, fecfinventa), + (Restrictions.between("fecfinventa", fecinicioventa, fecfinventa)))); + + return c.list(); + } + + @Override + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, Date inicio, Date fim) { + Calendar fecInicio = Calendar.getInstance(); + fecInicio.setTime(inicio); + fecInicio.set(Calendar.MILLISECOND, 0); + fecInicio.set(Calendar.SECOND, 0); + + Calendar fecFin = Calendar.getInstance(); + fecFin.setTime(fim); + fecFin.set(Calendar.MILLISECOND, 0); + fecFin.set(Calendar.SECOND, 0); + + Criteria c = this.getSession().createCriteria(PricingVigencia.class); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.ge("fecfinviaje", fecInicio.getTime())); + c.add(Restrictions.le("fecinicioviaje", fecFin.getTime())); + c.add(Restrictions.eq("pricing", pricing)); + if (pricingVigencia.getPricingvigenciaId() != null) { + c.add(Restrictions.ne("pricingvigenciaId", pricingVigencia.getPricingvigenciaId())); + } + + return c.list().isEmpty(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdClaseServicioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdClaseServicioHibernateDAO.java new file mode 100644 index 000000000..6f7c023e4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdClaseServicioHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodClaseServicioDAO") +public class ProdClaseServicioHibernateDAO extends GenericHibernateDAO + implements ProdClaseServicioDAO { + + @Autowired + public ProdClaseServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdFormaPagoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdFormaPagoHibernateDAO.java new file mode 100644 index 000000000..df9354378 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdFormaPagoHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdFormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodFormaPagoDAO") +public class ProdFormaPagoHibernateDAO extends GenericHibernateDAO + implements ProdFormaPagoDAO { + + @Autowired + public ProdFormaPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMarcaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMarcaHibernateDAO.java new file mode 100644 index 000000000..df0d6101e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMarcaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodMarcaDAO") +public class ProdMarcaHibernateDAO extends GenericHibernateDAO + implements ProdMarcaDAO { + + @Autowired + public ProdMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMercadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMercadoHibernateDAO.java new file mode 100644 index 000000000..4a243c125 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMercadoHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodMercadoDAO") +public class ProdMercadoHibernateDAO extends GenericHibernateDAO + implements ProdMercadoDAO { + + @Autowired + public ProdMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPrecioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPrecioHibernateDAO.java new file mode 100644 index 000000000..0164e1cf9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPrecioHibernateDAO.java @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdPrecioDAO; +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("prodPrecioDAO") +public class ProdPrecioHibernateDAO extends GenericHibernateDAO + implements ProdPrecioDAO { + + @Autowired + public ProdPrecioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Marca marca, ProductoServicio productoservicio) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("productoservicio", productoservicio)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + return c.list(); + } + + public List buscar(Marca marca) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPuntoVentaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..b705c2a6b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPuntoVentaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodPuntoVentaDAO") +public class ProdPuntoVentaHibernateDAO extends GenericHibernateDAO + implements ProdPuntoVentaDAO { + + @Autowired + public ProdPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdRutaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdRutaHibernateDAO.java new file mode 100644 index 000000000..5f63a56c4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdRutaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdRuta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodRutaDAO") +public class ProdRutaHibernateDAO extends GenericHibernateDAO + implements ProdRutaDAO { + + @Autowired + public ProdRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdTipoptovtaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdTipoptovtaHibernateDAO.java new file mode 100644 index 000000000..054dcc695 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdTipoptovtaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodTipoptovtaDAO") +public class ProdTipoptovtaHibernateDAO extends GenericHibernateDAO + implements ProdTipoptovtaDAO { + + @Autowired + public ProdTipoptovtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdVigenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdVigenciaHibernateDAO.java new file mode 100644 index 000000000..11bb04c15 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdVigenciaHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodVigenciaDAO") +public class ProdVigenciaHibernateDAO extends GenericHibernateDAO + implements ProdVigenciaDAO { + + @Autowired + public ProdVigenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarTraslapa(ProdVigencia prodVigencia) { + Criteria c = this.getSession().createCriteria(ProdVigencia.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecvigenciafin", prodVigencia.getFecvigenciainicio())); + c.add(Restrictions.le("fecvigenciainicio", prodVigencia.getFecvigenciafin())); + c.add(Restrictions.eq("productoServicio", prodVigencia.getProductoServicio())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProductoServicioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProductoServicioHibernateDAO.java new file mode 100644 index 000000000..11e440cad --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ProductoServicioHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProductoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("productoServicioDAO") +public class ProductoServicioHibernateDAO extends GenericHibernateDAO + implements ProductoServicioDAO { + + @Autowired + public ProductoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtener(ProductoServicio ps) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descproductoservicio", ps.getDescproductoservicio())); + c.add(Restrictions.eq("empresa", ps.getEmpresa())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaCheckinHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaCheckinHibernateDAO.java new file mode 100644 index 000000000..5cc65eead --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaCheckinHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtoVtaCheckinDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; + +@Repository("ptoVtaCheckinDAO") +public class PtoVtaCheckinHibernateDAO extends GenericHibernateDAO + implements PtoVtaCheckinDAO { + + @Autowired + public PtoVtaCheckinHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("ptoVtaCheckinId")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ptoVtaCheckinId", id)); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaSeguroHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaSeguroHibernateDAO.java new file mode 100644 index 000000000..b3d91e063 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaSeguroHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtoVtaSeguroDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; + +@Repository("ptoVtaSeguroDAO") +public class PtoVtaSeguroHibernateDAO extends GenericHibernateDAO + implements PtoVtaSeguroDAO { + + @Autowired + public PtoVtaSeguroHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("ptoVtaSeguroId")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ptoVtaSeguroId", id)); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaUsuarioBancarioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaUsuarioBancarioHibernateDAO.java new file mode 100644 index 000000000..858509fbb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaUsuarioBancarioHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PtoVtaUsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("ptoVtaUsuarioBancarioDAO") +public class PtoVtaUsuarioBancarioHibernateDAO extends GenericHibernateDAO + implements PtoVtaUsuarioBancarioDAO { + + @Autowired + public PtoVtaUsuarioBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public void borrarFisico(PtoVtaUsuarioBancario pto2) { + String hql = " delete from PtoVtaUsuarioBancario " + + " where ptovtaUsuarioBancarioID = " + pto2.getPtovtaUsuarioBancarioID(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAgenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAgenciaHibernateDAO.java new file mode 100644 index 000000000..ccf8a90d5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAgenciaHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +@Repository("ptovtaAgenciaBancariaDAO") +public class PtovtaAgenciaHibernateDAO extends GenericHibernateDAO + implements PtovtaAgenciaDAO { + + @Autowired + public PtovtaAgenciaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numagencia")); + + return c.list(); + } + + public List buscar(String numagencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numagencia", numagencia)); + + + return c.list(); + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntecipacomissaoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntecipacomissaoHibernateDAO.java new file mode 100644 index 000000000..54d992f7d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntecipacomissaoHibernateDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaAntecipacomissaoDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; + +@Repository("ptovtaAntecipacomissaoDAO") +public class PtovtaAntecipacomissaoHibernateDAO extends GenericHibernateDAO + implements PtovtaAntecipacomissaoDAO { + + @Autowired + public PtovtaAntecipacomissaoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaCatIndHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaCatIndHibernateDAO.java new file mode 100644 index 000000000..63a0ae323 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaCatIndHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaCatIndDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; + +@Repository("ptovtaCatIndDAO") +public class PtovtaCatIndHibernateDAO extends GenericHibernateDAO + implements PtovtaCatIndDAO { + + @Autowired + public PtovtaCatIndHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaComissaoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaComissaoHibernateDAO.java new file mode 100644 index 000000000..659f5433b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaComissaoHibernateDAO.java @@ -0,0 +1,70 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("ptovtaComissaoDAO") +public class PtovtaComissaoHibernateDAO extends GenericHibernateDAO + implements PtovtaComissaoDAO { + + @Autowired + public PtovtaComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + return c.list(); + } + + public List buscarByPuntaVenta(PuntoVenta puntaVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoventaId", puntaVenta)); + + c.addOrder(Order.asc("empresaId")); + + return c.list(); + } + + @Override + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId) { + + StringBuilder sql = new StringBuilder(); + sql.append("from PtovtaComissao pc "); + sql.append("where pc.activo = 1 and pc.puntoventaId.puntoventaId = :puntoventaId "); + sql.append(" and pc.empresaId.empresaId = :empresaId "); + + Query query = getSession().createQuery(sql.toString()); + query.setInteger("puntoventaId", puntaVentaId); + query.setInteger("empresaId", empresaId); + query.setMaxResults(1); + + return (PtovtaComissao) query.uniqueResult(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaDiversosHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaDiversosHibernateDAO.java new file mode 100644 index 000000000..aaa53b1a6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaDiversosHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaDiversosDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; + + +@Repository("ptovtaDiversosDAO") +public class PtovtaDiversosHibernateDAO extends GenericHibernateDAO + implements PtovtaDiversosDAO { + + @Autowired + public PtovtaDiversosHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaBloqueadaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaBloqueadaHibernateDAO.java new file mode 100644 index 000000000..863df6fd8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaBloqueadaHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaDiversosDAO; +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaBloqueadaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; + +@Repository("ptovtaEmpresaBloqueadaDAO") +public class PtovtaEmpresaBloqueadaHibernateDAO extends GenericHibernateDAO + implements PtovtaEmpresaBloqueadaDAO { + + @Autowired + public PtovtaEmpresaBloqueadaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("ptovtaempbloqueadaId")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ptovtaempbloqueadaId", id)); + + + return c.list(); + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaHibernateDAO.java new file mode 100644 index 000000000..825b89b14 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("ptovtaEmpresaDAO") +public class PtovtaEmpresaHibernateDAO extends GenericHibernateDAO + implements PtovtaEmpresaDAO { + + @Autowired + public PtovtaEmpresaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(PtovtaEmpresa ptovtaEmpresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empresa", ptovtaEmpresa.getEmpresa())); + c.add(Restrictions.eq("puntoVenta", ptovtaEmpresa.getPuntoVenta())); + + return c.list(); + } + + public void borrarFisico(PtovtaEmpresa pto) { + String hql = " delete from PtovtaEmpresa " + + " where ptovtaempresaId = " + pto.getPtovtaempresaId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEstoqueHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEstoqueHibernateDAO.java new file mode 100644 index 000000000..6997af8a0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEstoqueHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaEstoqueDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; + + +@Repository("ptovtaEstoqueDAO") +public class PtovtaEstoqueHibernateDAO extends GenericHibernateDAO + implements PtovtaEstoqueDAO { + + @Autowired + public PtovtaEstoqueHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaHorarioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaHorarioHibernateDAO.java new file mode 100644 index 000000000..43d260e7f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaHorarioHibernateDAO.java @@ -0,0 +1,50 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PtovtaHorarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; + + +@Repository("ptovtaHorarioDAO") +public class PtovtaHorarioHibernateDAO extends GenericHibernateDAO + implements PtovtaHorarioDAO { + + @Autowired + public PtovtaHorarioHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java new file mode 100644 index 000000000..0c30b7253 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; + +@Repository("ptovtaTipoEstoqueDAO") +public class PtovtaTipoEstoqueHibernateDAO extends GenericHibernateDAO implements PtovtaTipoEstoqueDAO { + + @Autowired + public PtovtaTipoEstoqueHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public PtovtaTipoEstoque buscarTipoSuprimento() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_SUMINISTRO); + return tipo; + } + + @Override + public PtovtaTipoEstoque buscarTipoContabilidade() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_CONTABILIDAD); + return tipo; + } + + @Override + public PtovtaTipoEstoque buscarTipoNormal() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_NORMAL); + return tipo; + } + + private PtovtaTipoEstoque buscarTipo(int tipo) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ptovtatipoestId", tipo)); + + return (PtovtaTipoEstoque) c.uniqueResult(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTitularHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTitularHibernateDAO.java new file mode 100644 index 000000000..0a144dc9c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTitularHibernateDAO.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaTitularDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; + + + +@Repository("ptovtaTitularDAO") +public class PtovtaTitularHibernateDAO extends GenericHibernateDAO + implements PtovtaTitularDAO { + + @Autowired + public PtovtaTitularHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java new file mode 100644 index 000000000..8bff21384 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java @@ -0,0 +1,196 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +@Repository("puntoVentaDAO") +public class PuntoVentaHibernateDAO extends GenericHibernateDAO + implements PuntoVentaDAO { + + @Autowired + private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO; + + + @Autowired + public PuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("nombpuntoventa")); + + return c.list(); + } + +// public List buscaLike(String strEstacion) { +// Criteria c = getSession().createCriteria(getPersistentClass()); +// c.add(Restrictions.eq("activo", Boolean.TRUE)); +// c.add(Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START)); +// +// return c.list(); +// } + + public List buscaLike(String strEstacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + Criterion cr1 = Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START); + + Criterion crActivo = Restrictions.eq("activo", Boolean.TRUE); + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont}); + + Criterion pt2 = Restrictions.or(crActivo, suprCont); + + c.add(Restrictions.and(cr1, pt2)); + + return c.list(); + } + + + public List busca(String nomPuntoVenta, String numPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombpuntoventa", nomPuntoVenta)); + c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta)); + + return c.list(); + } + + public List buscaPuntoVenta(String numPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta)); + + return c.list(); + } + + public List buscaPuntoVentaParada(Parada parada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("parada", parada)); + + c.addOrder(Order.asc("nombpuntoventa")); + + return c.list(); + } + + @Override + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVentaPadre", puntoVenta)); + + return c.list(); + } + + @Override + public List buscarPuntosVentaMovimentacionBilhetes(List empresas) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + + Criterion crtPtovta = + Restrictions.and(Restrictions.eq("activo", Boolean.TRUE), Restrictions.in("empresa", empresas)); + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont}); + + c.add(Restrictions.or(suprCont, crtPtovta)); + + c.addOrder(Order.asc("nombpuntoventa")); + List puntosVenta = c.list(); + +// List puntosVenta = geraListaDummy(); + + return puntosVenta; + } + + public List buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ptovtaTipoEstoque", tipoEstoque)); + + List puntosVenta = c.list(); + + return puntosVenta; + } + + private List geraListaDummy(){ + + Criteria c = getSession().createCriteria(getPersistentClass()); + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont}); + + Criterion crtPtovta = Restrictions.in("puntoventaId", new Integer[]{1,2,3,786,1321,1722}); + + c.add(Restrictions.or(suprCont, crtPtovta)); + List puntosVenta = c.list(); + +// PuntoVenta pv1 = new PuntoVenta(Integer.valueOf(1)); +// pv1.setNombpuntoventa("pv1"); +// +// PuntoVenta pv2 = new PuntoVenta(Integer.valueOf(2)); +// pv2.setNombpuntoventa("pv2"); +// +// PuntoVenta pv3 = new PuntoVenta(Integer.valueOf(3)); +// pv3.setNombpuntoventa("pv3"); +// +// PuntoVenta pv4 = new PuntoVenta(Integer.valueOf(786)); +// pv4.setNombpuntoventa("pv4"); +// +// PuntoVenta pv5 = new PuntoVenta(Integer.valueOf(1321)); +// pv5.setNombpuntoventa("pv5"); +// +// PuntoVenta pv6 = new PuntoVenta(Integer.valueOf(1722)); +// pv6.setNombpuntoventa("SUPRIMENTO"); +// +// List puntosVenta = new ArrayList(); +// puntosVenta.add(pv6); +// puntosVenta.add(pv1); +// puntosVenta.add(pv2); +// puntosVenta.add(pv3); +// puntosVenta.add(pv4); +// puntosVenta.add(pv5); + + return puntosVenta; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoCtrlHibernateDAO.java new file mode 100644 index 000000000..1b474de64 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoCtrlHibernateDAO.java @@ -0,0 +1,106 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RedondeoCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("redondeoCtrlDAO") +public class RedondeoCtrlHibernateDAO extends GenericHibernateDAO + implements RedondeoCtrlDAO { + + private static Logger log = Logger.getLogger(RedondeoCtrlHibernateDAO.class); + + @Autowired + public RedondeoCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(RedondeoCtrl redondeoCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + List lsShort = new ArrayList(); + for (RedondeoMarca rm : redondeoCtrl.getRedondeoMarcaList()) { + lsShort.add(rm.getMarca().getMarcaId()); + } + c.createCriteria("redondeoMarcaList").add(Restrictions.in("marca.marcaId", lsShort)); + + return c.list(); + + } + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, Boolean indaplicapricing) { + + String ids = ""; + for (int i = 0; i < iDMarcas.length; i++) { + ids = ids.concat(iDMarcas[i].toString().concat(",")); + } + ids = ids.substring(0, ids.length() - 1); + + + StringBuilder hql = new StringBuilder("select rc from RedondeoCtrl rc "); + hql.append(" join rc.redondeoList r "); + hql.append(" join rc.redondeoMarcaList rm "); + hql.append(" where rc.activo = 1 and r.activo = 1 and rm.activo = 1 "); + if (indaplicadescuento && !indaplicapricing) { + hql.append(" and rc.indaplicadescuento = :aplicaDescuento "); + } else if (!indaplicadescuento && indaplicapricing) { + hql.append(" and rc.indaplicapricing = :aplicaPricing "); + } else if (indaplicadescuento && indaplicapricing) { + hql.append(" and rc.indaplicadescuento = :aplicaDescuento or rc.indaplicapricing = :aplicaPricing "); + } else if (!indaplicadescuento && !indaplicapricing) { + hql.append(" and rc.indaplicadescuento = :aplicaDescuento and rc.indaplicapricing = :aplicaPricing "); + } + hql.append(" and rm.marca.marcaId in (" + ids + ") and "); + hql.append(" (((:vlrIni BETWEEN r.valorinicial AND r.valorfinal) "); + hql.append(" OR (:vlrFin BETWEEN r.valorinicial AND r.valorfinal)) "); + hql.append(" OR ((r.valorinicial BETWEEN :vlrIni AND :vlrFin) "); + hql.append(" OR (r.valorfinal BETWEEN :vlrIni AND :vlrFin))) "); + + log.debug("Select: " + hql.toString()); + Query sq = getSession().createQuery(hql.toString()); + sq.setDouble("vlrIni", valorinicial.doubleValue()); + sq.setDouble("vlrFin", valorfinal.doubleValue()); + + if (indaplicadescuento && !indaplicapricing) { + sq.setBoolean("aplicaDescuento", indaplicadescuento); + } else if (!indaplicadescuento && indaplicapricing) { + sq.setBoolean("aplicaPricing", indaplicapricing); + } else { + sq.setBoolean("aplicaDescuento", indaplicadescuento); + sq.setBoolean("aplicaPricing", indaplicapricing); + } + + + return sq.list(); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoHibernateDAO.java new file mode 100644 index 000000000..5da3d67f2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoHibernateDAO.java @@ -0,0 +1,60 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RedondeoDAO; +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("redondeoDAO") +public class RedondeoHibernateDAO extends GenericHibernateDAO + implements RedondeoDAO { + + @Autowired + public RedondeoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("valorinicial", valorInicial)); + c.add(Restrictions.eq("valorfinal", valorFinal)); + c.add(Restrictions.eq("valorredondeo", valorRedondeo)); + + return c.list(); + } + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.ge("valorinicial", valorInicial)); + c.add(Restrictions.le("valorfinal", valorFinal)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoMarcaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoMarcaHibernateDAO.java new file mode 100644 index 000000000..c701ab081 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoMarcaHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RedondeoMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("redondeoMarcaDAO") +public class RedondeoMarcaHibernateDAO extends GenericHibernateDAO + implements RedondeoMarcaDAO { + + @Autowired + public RedondeoMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Marca marca) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("marca", marca)); + + return c.list(); + } + + public List obtenerTodasMarcas(Short[] iDMarcas) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.in("marca.marcaId", iDMarcas)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RequisicionBoletoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RequisicionBoletoHibernateDAO.java new file mode 100644 index 000000000..c294df34a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RequisicionBoletoHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RequisicionBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; + +@Repository("requisicionBoletoDAO") +public class RequisicionBoletoHibernateDAO extends GenericHibernateDAO + implements RequisicionBoletoDAO { + + @Autowired + public RequisicionBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCategoriaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCategoriaHibernateDAO.java new file mode 100644 index 000000000..74ad8a01f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCategoriaHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionCategoriaDAO") +public class ReservacionCategoriaHibernateDAO + extends GenericHibernateDAO + implements ReservacionCategoriaDAO { + + @Autowired + public ReservacionCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionClaseHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionClaseHibernateDAO.java new file mode 100644 index 000000000..9ab42bb61 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionClaseHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionClaseDAO") +public class ReservacionClaseHibernateDAO + extends GenericHibernateDAO + implements ReservacionClaseDAO { + + @Autowired + public ReservacionClaseHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCtrlHibernateDAO.java new file mode 100644 index 000000000..9eeb32dc0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCtrlHibernateDAO.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionCtrlDAO") +public class ReservacionCtrlHibernateDAO + extends GenericHibernateDAO + implements ReservacionCtrlDAO { + + @Autowired + public ReservacionCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(ReservacionCtrl reservacionCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descConfig", reservacionCtrl.getDescConfig())); + + return c.list(); + } + + @Override + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrlt) { + + Calendar fecinicio = Calendar.getInstance(); + fecinicio.setTime(reservacionCtrlt.getFecinicio()); + + Calendar fecfinal = Calendar.getInstance(); + fecfinal.setTime(reservacionCtrlt.getFecfinal()); + + + Criteria c = this.getSession().createCriteria(ReservacionCtrl.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfinal", fecinicio.getTime())); + c.add(Restrictions.le("fecinicio", fecfinal.getTime())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMarcaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMarcaHibernateDAO.java new file mode 100644 index 000000000..426c0a889 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMarcaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionMarcaDAO") +public class ReservacionMarcaHibernateDAO extends GenericHibernateDAO + implements ReservacionMarcaDAO { + + @Autowired + public ReservacionMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMercadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMercadoHibernateDAO.java new file mode 100644 index 000000000..0b552198b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMercadoHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionMercadoDAO") +public class ReservacionMercadoHibernateDAO + extends GenericHibernateDAO + implements ReservacionMercadoDAO { + + @Autowired + public ReservacionMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionPuntoVentaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..dc86be1bd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionPuntoVentaHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("reservacionPuntoVentaDAO") +public class ReservacionPuntoVentaHibernateDAO extends GenericHibernateDAO + implements ReservacionPuntoVentaDAO { + + @Autowired + public ReservacionPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RestriccionPagoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RestriccionPagoHibernateDAO.java new file mode 100644 index 000000000..2ab1394a7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RestriccionPagoHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("restriccionDAO") +public class RestriccionPagoHibernateDAO extends GenericHibernateDAO + implements RestriccionPagoDAO { + + @Autowired + public RestriccionPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descrestriccion")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RhPagoConductorHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RhPagoConductorHibernateDAO.java new file mode 100644 index 000000000..22d7f148b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RhPagoConductorHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RhPagoConductorDAO; +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("rhPagoConductorDAO") +public class RhPagoConductorHibernateDAO extends GenericHibernateDAO + implements RhPagoConductorDAO { + + @Autowired + public RhPagoConductorHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descrestriccion")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RolOperativoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RolOperativoHibernateDAO.java new file mode 100644 index 000000000..92364bf28 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RolOperativoHibernateDAO.java @@ -0,0 +1,59 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RolOperativoDAO; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("rolOperativoDAO") +public class RolOperativoHibernateDAO extends GenericHibernateDAO + implements RolOperativoDAO { + + @Autowired + public RolOperativoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(DiagramaAutobus diagrama, String rol) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (diagrama != null) { + c.add(Restrictions.eq("diagramaAutobus", diagrama)); + } + if (rol != null) { + c.add(Restrictions.eq("descroloperativo", rol)); + } + return c.list(); + } + + public List buscar(String descroloperativo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descroloperativo", descroloperativo)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCasetaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCasetaHibernateDAO.java new file mode 100644 index 000000000..ead0f0dc6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCasetaHibernateDAO.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaCasetaDAO; +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; + +@Repository("rutaCasetaDAO") +public class RutaCasetaHibernateDAO extends GenericHibernateDAO +implements RutaCasetaDAO { + + @Autowired + public RutaCasetaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id){ + this.getSession().createQuery("DELETE from RutaCaseta rc WHERE rc.rutaSecuencia.rutasecuenciaId = "+id+" ").executeUpdate(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java new file mode 100644 index 000000000..d9203b941 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java @@ -0,0 +1,813 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaVO; + +/** + * + * @author Rafius + */ +@Repository("rutaCombinacionDAO") +public class RutaCombinacionHibernateDAO extends GenericHibernateDAO implements RutaCombinacionDAO { + + private static Logger log = LoggerFactory.getLogger(RutaCombinacionHibernateDAO.class); + @Autowired + private TramoDAO tramoDAO; + + @Autowired + public RutaCombinacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public boolean busquedaRutaTramo(Ruta ruta, Tramo tramo, Boolean ativo) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + + if (ativo) { + c.add(Restrictions.eq("activo", Boolean.TRUE)); + } else { + c.add(Restrictions.eq("activo", Boolean.FALSE)); + } + + c.setProjection(Projections.rowCount()); + + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("tramo", tramo)); + + return HibernateFix.count(c.list()) > 0; + } + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino) { + + String hql = " select rc from RutaCombinacion rc, Tramo t " + + " where rc.tramo.tramoId = t.tramoId and rc.activo = 0 " + + " and rc.ruta.rutaId = " + ruta.getRutaId() + + " and t.origem.paradaId = " + trBuscaOrigemDestino.getOrigem().getParadaId() + + " and t.destino.paradaId = " + trBuscaOrigemDestino.getDestino().getParadaId(); + Query sq = getSession().createQuery(hql); + + RutaCombinacion rc = new RutaCombinacion(); + if (sq.list().size() > 0) { + rc = (RutaCombinacion) sq.list().get(sq.list().size() - 1); + } + + return rc; + } + + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria c2 = c.createCriteria("tramo"); + c2.add(Restrictions.eq("origem", origen)); + c2.add(Restrictions.eq("destino", destino)); + c2.add(Restrictions.eq("activo", Boolean.TRUE)); + + List list = c.list(); + + if (list.size() != 1) { + return null; + } + return list.get(0).getTramo(); + } + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + + Criteria c2 = c.createCriteria("tramo"); + c2.add(Restrictions.eq("origem", origem)); + c2.add(Restrictions.eq("destino", destino)); + c2.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (c.list().size() > 0) { + return (RutaCombinacion) c.list().get(0); + } + + return null; + + } + + public List obtenerPorRuta(Ruta ruta) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + + + } + + @Override + public List tramosFaltantes(Integer rutaId) { + Session session = getSession(); + List lsTramoFaltantes = new ArrayList(); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select t.origen_id, "); + sb.append(" rs.numsecuencia "); + sb.append(" from ruta_secuencia rs "); + sb.append(" inner join tramo t on t.tramo_id = rs.tramo_id "); + sb.append(" where rs.activo = 1 and "); + sb.append(" t.activo = 1 and "); + sb.append(" rs.ruta_id = :rutaId "); + sb.append(" union "); + sb.append(" select t.destino_id, "); + sb.append(" rs.numsecuencia "); + sb.append(" from ruta_secuencia rs "); + sb.append(" inner join tramo t on t.tramo_id = rs.tramo_id "); + sb.append(" where rs.activo = 1 and "); + sb.append(" t.activo = 1 and "); + sb.append(" rs.ruta_id = :rutaId and "); + sb.append(" rs.numsecuencia = "); + sb.append(" (select max(rs.numsecuencia) from "); + sb.append(" ruta_secuencia rs inner join tramo t on "); + sb.append(" t.tramo_id = rs.tramo_id where rs.activo = "); + sb.append(" 1 and t.activo = 1 and rs.ruta_id = :rutaId ) "); + sb.append(" order by 2 "); + + + SQLQuery sqlQuery = session.createSQLQuery(sb.toString()); + sqlQuery.setInteger("rutaId", rutaId); + + List lsParadas = sqlQuery.list(); + Integer origenId = null; + Integer destinoId = null; + for (int i = 0; i < lsParadas.size(); i++) { + origenId = ((BigDecimal) lsParadas.get(i)[0]).intValue(); + for (int j = i + 1; j < lsParadas.size(); j++) { + destinoId = ((BigDecimal) lsParadas.get(j)[0]).intValue(); + + log.debug(origenId + " - " + destinoId); + + sb = new StringBuilder(); + sb.append(" select count(*) "); + sb.append(" from ruta_combinacion rc "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" where "); + sb.append(" rc.ruta_id = :rutaId "); + sb.append(" and rc.activo = 1 "); + sb.append(" and t.activo = 1 "); + sb.append(" and t.origen_id = :origenId "); + sb.append(" and t.destino_id = :destinoId "); + + + SQLQuery sqlQueryExists = session.createSQLQuery(sb.toString()); + sqlQueryExists.setInteger("rutaId", rutaId); + sqlQueryExists.setInteger("origenId", origenId); + sqlQueryExists.setInteger("destinoId", destinoId); + + Long count = HibernateFix.count(sqlQueryExists.list()); + + if (count == 0) { + log.info("No existe combinacion " + origenId + " - " + destinoId); + + + Parada paradaOrigem = new Parada(); + paradaOrigem.setParadaId(origenId); + + Parada paradaDestino = new Parada(); + paradaDestino.setParadaId(destinoId); + + List list = tramoDAO.obtenerListPorOrigemDestino(paradaOrigem, paradaDestino); + + if (list.size() == 0) { + log.info("No existe tramo " + origenId + " - " + destinoId); + } else { + lsTramoFaltantes.add(list.get(0)); + } + + } + } + + } + + return lsTramoFaltantes; + } + + public int borrarCombinaciones(Ruta ruta) { + Query query = this.getSession().createQuery("UPDATE RutaCombinacion set activo = false, fecmodif = current_timestamp(), usuarioId= :usuario where ruta = :ruta"); + query.setParameter("ruta", ruta); + query.setParameter("usuario", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return query.executeUpdate(); + } + + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino) { + String sql = " select rc.rutacombinacionId from RutaCombinacion rc, Tramo t " + + " where rc.tramo.tramoId = t.tramoId and rc.activo = 0 " + + " and rc.ruta.rutaId = " + ruta.getRutaId() + + " and t.origem.paradaId = " + trBuscaOrigemDestino.getOrigem().getParadaId() + + " and t.destino.paradaId = " + trBuscaOrigemDestino.getDestino().getParadaId(); + + getSession().createQuery("update RutaCombinacion set activo = true where rutacombinacionId in (" + sql + " )").executeUpdate(); + } + + public List pesquisaTarifaObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsCategoria, List lsEmpresa, List lsRuta, List lsTipoPuntoVenta, List lsVigenciaTarifa, List lsOrgaoConcedente) { + + StringBuilder hql = new StringBuilder(" "); + hql.append(" SELECT "); + hql.append(" T.TARIFA_ID,"); // 0 + hql.append(" TRA.DESCTRAMO, "); // 1 + hql.append(" ORI.DESCPARADA as origem,"); // 2 + hql.append(" DES.DESCPARADA as destino, "); // 3 + hql.append(" R.DESCRUTA,"); // 4 + hql.append(" M.DESCMARCA, "); // 5 + hql.append(" CS.DESCCLASE,"); // 6 + hql.append(" VT.feciniciovigencia, "); // 7 + hql.append(" VT.fecfinvigencia,"); // 8 + hql.append(" MON.descmoneda, "); // 9 + hql.append(" T.preciooriginal, "); // 10 + hql.append(" T.PRECIO,"); // 11 + hql.append(" R.RUTA_ID,"); // 12 + hql.append(" MON.moneda_id,"); // 13 + hql.append(" VT.VIGENCIATARIFA_ID,"); // 14 + hql.append(" M.MARCA_ID, "); // 15 + hql.append(" T.IMPORTEPEDAGIO, "); // 16 + hql.append(" OCONC.DESCORGAO, "); // 17 + hql.append(" T.IMPORTETAXAEMBARQUE, "); // 18 + hql.append(" T.IMPORTESEGURO "); // 19 + + hql.append(" FROM "); + hql.append(" RUTA_COMBINACION RC "); + hql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + hql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + hql.append(" inner join ORGAO_CONCEDENTE OCONC on (R.ORGAOCONCEDENTE_ID = OCONC.ORGAOCONCEDENTE_ID) "); + hql.append(" , TARIFA T "); + if (!lsEmpresa.isEmpty()) { + hql.append(" , RUTA_EMPRESA RE "); + } + hql.append(" , MARCA M, MONEDA MON, VIGENCIA_TARIFA VT "); + hql.append(" , CLASE_SERVICIO CS , PARADA ORI, PARADA DES "); + hql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND R.activo = 1 "); + if (!lsEmpresa.isEmpty()) { + hql.append(" AND RE.activo = 1 AND RC.RUTA_ID = RE.RUTA_ID "); + } + hql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + hql.append(" AND T.MARCA_ID = M.MARCA_ID "); + hql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + hql.append(" AND T.VIGENCIATARIFA_ID = VT.VIGENCIATARIFA_ID "); + hql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + hql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + hql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + hql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + hql.append(" AND T.RUTA_ID = R.RUTA_ID "); + + if (!lsVigenciaTarifa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (VigenciaTarifa vt : lsVigenciaTarifa) { + sb.append(vt.getVigenciatarifaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND VT.VIGENCIATARIFA_ID in (").append(listInt).append(")"); + } + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + if (!lsRuta.isEmpty() && !lsRuta.toString().contains("TODAS")) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + if (!lsClaseServicio.isEmpty() && !lsClaseServicio.toString().contains("TODAS")) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + if (!lsOrgaoConcedente.isEmpty() && !lsOrgaoConcedente.toString().contains("TODOS")) { + StringBuilder sb = new StringBuilder(""); + for (OrgaoConcedente oc : lsOrgaoConcedente) { + sb.append(oc.getOrgaoConcedenteId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND OCONC.ORGAOCONCEDENTE_ID in (").append(listInt).append(") "); + } + + hql.append(" order by R.DESCRUTA, R.RUTA_ID, RC.RUTACOMBINACION_ID,t.tarifa_id "); + + System.out.println(hql.toString()); + + List lsObj = this.getSession().createSQLQuery(hql.toString()).list(); + + return lsObj; + } + + public List pesquisaTarifaOficialObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsEmpresa, List lsRuta, List lsVigenciaTarifa) { + + StringBuilder hql = new StringBuilder(" "); + hql.append(" SELECT "); + hql.append(" T.TARIFAOFICIAL_ID, "); + hql.append(" TRA.DESCTRAMO, "); + hql.append(" ORI.DESCPARADA as origem, "); + hql.append(" DES.DESCPARADA as destino, "); + hql.append(" R.DESCRUTA,"); + hql.append(" M.DESCMARCA, "); + hql.append(" CS.DESCCLASE,'' as feciniciovigencia, "); + hql.append(" '' as fecfinvigencia, "); + hql.append(" MON.descmoneda, "); + hql.append(" T.preciooriginal, "); + hql.append(" T.PRECIO,R.RUTA_ID, "); + hql.append(" MON.moneda_id,'' AS VIGENCIATARIFA_ID, "); + hql.append(" M.MARCA_ID, "); + hql.append(" T.IMPORTETAXAEMBARQUE, "); + hql.append(" T.IMPORTESEGURO, "); + hql.append(" T.IMPORTEPEDAGIO, "); + hql.append("T.IMPORTEOUTROS "); + hql.append(" FROM "); + hql.append(" RUTA_COMBINACION RC "); + hql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + hql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + hql.append(" , TARIFA_OFICIAL T "); + if (!lsEmpresa.isEmpty()) { + hql.append(" , RUTA_EMPRESA RE "); + } + hql.append(" , MARCA M, MONEDA MON"); + hql.append(" , CLASE_SERVICIO CS , PARADA ORI, PARADA DES "); + hql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND R.activo = 1 "); + if (!lsEmpresa.isEmpty()) { + hql.append(" AND RE.activo = 1 AND RC.RUTA_ID = RE.RUTA_ID "); + } + hql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + hql.append(" AND T.MARCA_ID = M.MARCA_ID "); + hql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + hql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + hql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + hql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + hql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + if (!lsRuta.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if (!listInt.contains("-1")){ + hql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + if (!lsClaseServicio.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + //Tratando caso de conter opção TODAS + if(!listInt.contains("-1")) { + hql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + } + + hql.append(" order by R.DESCRUTA, R.RUTA_ID, RC.RUTACOMBINACION_ID,t.TARIFAOFICIAL_id "); + + List lsObj = this.getSession().createSQLQuery(hql.toString()).list(); + + return lsObj; + } + + public List pesquisaTarifaGroupObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsCategoria, List lsEmpresa, List lsRuta, List lsTipoPuntoVenta, List lsVigenciaTarifa) { + + StringBuilder sql = new StringBuilder(" "); + sql.append(" SELECT R.descruta, "); + sql.append(" R.RUTA_ID, "); + sql.append(" MON.moneda_id, "); + sql.append(" '' AS VIGENCIATARIFA_ID, "); + sql.append(" M.MARCA_ID, "); + sql.append(" mon.descmoneda, "); + sql.append(" vt.FECINICIOVIGENCIA, "); + sql.append(" vt.FECFINVIGENCIA, "); + sql.append(" M.descmarca, "); + sql.append(" CS.descclase "); + sql.append(" FROM "); + sql.append(" RUTA_COMBINACION RC "); + sql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + sql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + sql.append(" , TARIFA_OFICIAL T , "); + sql.append(" RUTA_EMPRESA RE "); + sql.append(" , MARCA M, "); + sql.append(" MONEDA MON,"); + sql.append(" , CLASE_SERVICIO CS , "); + sql.append(" PARADA ORI, "); + sql.append(" PARADA DES "); + sql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND RE.activo = 1 AND R.activo = 1 "); + sql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + sql.append(" AND RC.RUTA_ID = RE.RUTA_ID "); + sql.append(" AND T.MARCA_ID = M.MARCA_ID "); + sql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + sql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + sql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + sql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + sql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + if (!lsRuta.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + if (!lsClaseServicio.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + + sql.append(" GROUP by R.descruta,R.RUTA_ID,MON.moneda_id,VT.VIGENCIATARIFA_ID,M.MARCA_ID,mon.descmoneda,vt.FECINICIOVIGENCIA,vt.FECFINVIGENCIA, M.descmarca,CS.descclase "); + sql.append(" ORDER by R.descruta,R.RUTA_ID,MON.moneda_id,VT.VIGENCIATARIFA_ID,M.MARCA_ID"); + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaEscalaGroupVO.class)); + + return query.list(); + } + + public List pesquisaTarifaEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId) { + + StringBuilder sql = new StringBuilder(" "); + sql.append("select distinct po.cveparada as cveOrigem,po.descparada as descOrigem, "); + sql.append(" pd.cveparada as cveDestino,pd.descparada as descDestino,tmp.numsecuencia as NUMSECORIGEM,tmp2.numsecuencia as NUMSECDESTINO, "); + sql.append(" ta.PRECIO as precio,ruta.ruta_id as rutaId,ruta.descruta as descruta "); + sql.append("from "); + sql.append(" ruta_combinacion rc "); + sql.append(" inner join ruta on (ruta.ruta_id = rc.ruta_id) "); + sql.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sql.append(" inner join parada po on po.parada_id = t.origen_id "); + sql.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sql.append(" inner join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rownum =1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" "); + sql.append(" union "); + + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp on tmp.parada_id = po.parada_id "); + + sql.append("left join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" union "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp2 on tmp2.parada_id = pd.parada_id "); + sql.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sql.append(" left join tarifa ta on ta.TRAMO_ID = rc.tramo_id and ta.claseservicio_id = r.claseservicio_id and ta.MONEDA_ID = ").append(monedaId).append(" and ta.activo = 1 "); + sql.append(" where "); + sql.append(" rc.ruta_id = ").append(rutaId); + sql.append(" and rc.activo = 1 "); + sql.append(" and ta.MARCA_ID = ").append(marcaId); + sql.append(" and ta.VIGENCIATARIFA_ID = ").append(vigenciaId); + sql.append(" and ta.moneda_id = ").append(monedaId); + sql.append(" order by ruta.ruta_id ,tmp.numsecuencia,tmp2.numsecuencia "); + + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaEscalaVO.class)); + + return query.list(); + } + + public List pesquisaTarifaOficialGroupObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsEmpresa, List lsRuta, List lsVigenciaTarifa) { + + StringBuilder sql = new StringBuilder(" "); + sql.append(" SELECT R.descruta,R.RUTA_ID,MON.moneda_id,M.MARCA_ID,mon.descmoneda, M.descmarca,CS.descclase "); + sql.append(" FROM "); + sql.append(" RUTA_COMBINACION RC "); + sql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + sql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + sql.append(" , TARIFA_OFICIAL T , RUTA_EMPRESA RE "); + sql.append(" , MARCA M, MONEDA MON"); + sql.append(" , CLASE_SERVICIO CS , PARADA ORI, PARADA DES "); + sql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND RE.activo = 1 AND R.activo = 1 "); + sql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + sql.append(" AND RC.RUTA_ID = RE.RUTA_ID "); + sql.append(" AND T.MARCA_ID = M.MARCA_ID "); + sql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + sql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + sql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + sql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + sql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + } + if (!lsRuta.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + } + if (!lsClaseServicio.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + } + + sql.append(" GROUP by R.descruta,R.RUTA_ID,MON.moneda_id,M.MARCA_ID,mon.descmoneda, M.descmarca,CS.descclase "); + sql.append(" ORDER by R.descruta,R.RUTA_ID,MON.moneda_id,M.MARCA_ID"); + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaOficialEscalaGroupVO.class)); + + return query.list(); + } + + public List pesquisaTarifaOficialEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId) { + + StringBuilder sql = new StringBuilder(" "); + sql.append("select distinct po.cveparada as cveOrigem,po.descparada as descOrigem, "); + sql.append(" pd.cveparada as cveDestino,pd.descparada as descDestino,tmp.numsecuencia as NUMSECORIGEM,tmp2.numsecuencia as NUMSECDESTINO, "); + sql.append(" ta.PRECIO as precio,IMPORTETAXAEMBARQUE as TAXAEMBARQUE, IMPORTEPEDAGIO AS PEDAGIO,IMPORTEOUTROS AS OUTROS,IMPORTESEGURO AS SEGURO,ruta.ruta_id as rutaId,ruta.descruta as descruta "); + sql.append("from "); + sql.append(" ruta_combinacion rc "); + sql.append(" inner join ruta on (ruta.ruta_id = rc.ruta_id) "); + sql.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sql.append(" inner join parada po on po.parada_id = t.origen_id "); + sql.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sql.append(" inner join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rownum =1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" "); + sql.append(" union "); + + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp on tmp.parada_id = po.parada_id "); + + sql.append("left join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" union "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp2 on tmp2.parada_id = pd.parada_id "); + sql.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sql.append(" left join tarifa_oficial ta on ta.TRAMO_ID = rc.tramo_id and ta.claseservicio_id = r.claseservicio_id and ta.MONEDA_ID = ").append(monedaId).append(" and ta.activo = 1 "); + sql.append(" where "); + sql.append(" rc.ruta_id = ").append(rutaId); + sql.append(" and rc.activo = 1 "); + sql.append(" and ta.MARCA_ID = ").append(marcaId); + // sql.append(" and ta.VIGENCIATARIFA_ID = ").append(vigenciaId); + sql.append(" and ta.moneda_id = ").append(monedaId); + sql.append(" order by ruta.ruta_id ,tmp.numsecuencia,tmp2.numsecuencia "); + + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaOficialEscalaVO.class)); + + return query.list(); + } + @Override + public boolean existeTramo(Tramo tramo) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()) > 0l; + + } + + @Override + public boolean existeTramo(Tramo tramo, ClaseServicio claseServicio) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + Criteria cRuta = c.createCriteria("ruta"); + cRuta.add(Restrictions.eq("claseServicio", claseServicio)); + cRuta.add(Restrictions.eq("activo", Boolean.TRUE)); + + return HibernateFix.count(c.list()) > 0l; + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmpresaHibernateDAO.java new file mode 100644 index 000000000..114b5eae5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmpresaHibernateDAO.java @@ -0,0 +1,43 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; + +/** + * + * @author Administrador + */ +@Repository("rutaEmpresaDAO") +public class RutaEmpresaHibernateDAO extends GenericHibernateDAO + implements RutaEmpresaDAO { + + @Autowired + public RutaEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerPorEmpresa(Empresa empresa){ + StringBuilder sb = new StringBuilder(); + sb.append("select * from Ruta_Empresa where empresa_Id = :empresaId and activo = 1" ); + + Query qry = getSession().createSQLQuery(sb.toString()); + qry.setInteger("empresaId", empresa.getEmpresaId()); + + return qry.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java new file mode 100644 index 000000000..50607adeb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java @@ -0,0 +1,209 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tramo; + +/** + * + * @author Rafius + */ +@Repository("rutaDAO") +public class RutaHibernateDAO extends GenericHibernateDAO implements RutaDAO { + + @Autowired + public RutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cTipoPuntoVenta = c.createCriteria("rutaCombinacionList"); + cTipoPuntoVenta.add(Restrictions.eq("tramo", tramo)); + + return c.list(); + } + + @Override + public List buscarPorRutaPorEmpresas(List lsEmpresas) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cEmpresa = c.createCriteria("lsRutaEmpresa"); + cEmpresa.add(Restrictions.in("empresa", lsEmpresas)); + cEmpresa.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarPorClaseServicio(ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("claseServicio", claseServicio)); + + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa) { + StringBuffer hql = new StringBuffer(); + hql.append("SELECT DISTINCT r "); + hql.append("FROM Ruta r INNER JOIN r.lsRutaEmpresa re "); + hql.append("WHERE r.claseServicio.claseservicioId = :idClaseServicio "); + hql.append("AND re.empresa.empresaId = :idEmpresa "); + hql.append("AND r.activo = 1 "); + hql.append("ORDER BY r.descruta"); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("idClaseServicio", claseServicio.getClaseservicioId()); + sq.setParameter("idEmpresa", empresa.getEmpresaId()); + + List lsRuta = sq.list(); + return lsRuta; + } + + public List buscar(String nomeRuta, ClaseServicio claseServicio, + Boolean nomeObrigatorio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + // c.add(Restrictions.eq("descruta", nomeRuta)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("indNombreObligatorio", nomeObrigatorio)); + + return c.list(); + } + + public List obtenerPorEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ne("rutaId", -1)); + + if (empresa.getEmpresaId() != -1) { + c.createCriteria("lsRutaEmpresa").add(Restrictions.eq("empresa", empresa)); + } + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + @Override + public Parada buscarOrigen(Ruta ruta) { + Criteria c = this.getSession().createCriteria(RutaSecuencia.class); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("ruta", ruta)); + c.addOrder(Order.asc("numsecuencia")); + c.createAlias("tramo", "tramo") + .setProjection(Projections.property("tramo.origem")); + c.setMaxResults(1); + + return (Parada) c.uniqueResult(); + + } + + @Override + public Parada buscarDestino(Ruta ruta) { + Criteria c = this.getSession().createCriteria(RutaSecuencia.class); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("ruta", ruta)); + c.addOrder(Order.desc("numsecuencia")); + c.createAlias("tramo", "tramo") + .setProjection(Projections.property("tramo.destino")); + c.setMaxResults(1); + + return (Parada) c.uniqueResult(); + } + + public List buscarTodosExceto(Integer... idRuta) { + Criteria c = this.makeCriteria(); + for (Integer id : idRuta) { + c.add(Restrictions.ne("rutaId", id)); + } + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarTodosEstos(Integer[] idRutas) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("rutaId", idRutas)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarNumRuta(String numRuta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("numRuta", numRuta)); + + return c.list(); + } + + public List buscaRuta(String palavraPesquisaRuta) { + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM Ruta "); + hql.append(" WHERE descruta like :palavraPesquisaRuta "); + hql.append(" OR prefixo like :palavraPesquisaRuta "); + hql.append(" OR str(numRuta) like :palavraPesquisaRuta "); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("palavraPesquisaRuta", palavraPesquisaRuta + '%'); + + List lsRuta = sq.list(); + return lsRuta; + } + + public List buscaRutasFromOrgao(OrgaoConcedente orgao){ + StringBuffer hql = new StringBuffer(); + hql.append("select distinct r FROM Ruta r inner join r.rutaSecuenciaList rSeqList "); + hql.append(" inner join rSeqList.lsRutaCase casRutaList "); + hql.append(" WHERE r.orgaoConcedente.orgaoConcedenteId = :orgaoId and r.activo = 1 "); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("orgaoId", orgao.getOrgaoConcedenteId()); + + List lsRuta = sq.list(); + return lsRuta; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaSecuenciaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaSecuenciaHibernateDAO.java new file mode 100644 index 000000000..fb8438e85 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaSecuenciaHibernateDAO.java @@ -0,0 +1,102 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RutaSecuenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.hibernate.criterion.Order; + +/** + * + * @author Rafius + */ +@Repository("rutaSecuenciaDAO") +public class RutaSecuenciaHibernateDAO extends GenericHibernateDAO + implements RutaSecuenciaDAO { + + @Autowired + public RutaSecuenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarSecuenciaOrdenado(Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ruta", ruta)); + + c.addOrder(Order.asc("numsecuencia")); + + return c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list(); + } + + public int borrarSecuencias(Ruta ruta) { + Query query = this.getSession().createQuery("UPDATE RutaSecuencia SET activo = 0, fecmodif = current_timestamp(), usuarioId= :usuario where ruta = :ruta"); + query.setParameter("usuario", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + query.setParameter("ruta", ruta); + + return query.executeUpdate(); + } + + @Override + public boolean paradaSecuenciaValida(Ruta ruta, Parada origen, Parada destino) { + Criteria cOrigen = makeCriteria(); + cOrigen.add(Restrictions.eq("activo", Boolean.TRUE)); + cOrigen.add(Restrictions.eq("ruta", ruta)); + cOrigen.setProjection(Projections.property("numsecuencia")); + + Criteria cOrigenTramo = cOrigen.createCriteria("tramo"); + cOrigenTramo.add(Restrictions.eq("origem", origen)); + + + Short numSecOrigen = (Short) cOrigen.uniqueResult(); + + Criteria cDestino = makeCriteria(); + cDestino.add(Restrictions.eq("activo", Boolean.TRUE)); + cDestino.add(Restrictions.eq("ruta", ruta)); + cDestino.setProjection(Projections.property("numsecuencia")); + + Criteria cDestinoTramo = cDestino.createCriteria("tramo"); + cDestinoTramo.add(Restrictions.eq("origem", destino)); + + + Short numSecDestino = (Short) cDestino.uniqueResult(); + boolean destinoFinal = false; + // destino final da ruta + if (numSecDestino == null) { + cDestino = makeCriteria(); + cDestino.add(Restrictions.eq("activo", Boolean.TRUE)); + cDestino.add(Restrictions.eq("ruta", ruta)); + cDestino.setProjection(Projections.property("numsecuencia")); + + cDestinoTramo = cDestino.createCriteria("tramo"); + cDestinoTramo.add(Restrictions.eq("destino", destino)); + + + numSecDestino = (Short) cDestino.uniqueResult(); + + destinoFinal = true;//quando é o destino final (ultima parada da secuencia), o numero da secOrigem pode ser igual ao secDestino + } + + if ((numSecOrigen != null) && (numSecDestino != null)) { + return (destinoFinal)?(numSecOrigen.compareTo(numSecDestino) <= 0):(numSecOrigen.compareTo(numSecDestino) < 0); + } + + return false; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaEmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaEmpresaHibernateDAO.java new file mode 100644 index 000000000..609fa3771 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaEmpresaHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SecretariaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; + +@Repository("secretariaEmpresaDAO") +public class SecretariaEmpresaHibernateDAO extends GenericHibernateDAO + implements SecretariaEmpresaDAO { + + @Autowired + public SecretariaEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorSecretaria(Secretaria secretaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("secretaria", secretaria)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaHibernateDAO.java new file mode 100644 index 000000000..561d80dd2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.SecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("secretariaDAO") +public class SecretariaHibernateDAO extends GenericHibernateDAO + implements SecretariaDAO { + + @Autowired + public SecretariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descsecretaria, String cvesecretaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descsecretaria", descsecretaria)); + c.add(Restrictions.eq("cvesecretaria", cvesecretaria)); + + return c.list(); + } + + public List buscar(String descsecretaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descsecretaria", descsecretaria)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SegVKMHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SegVKMHibernateDAO.java new file mode 100644 index 000000000..b9cccf0ef --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SegVKMHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SegVKMDAO; +import com.rjconsultores.ventaboletos.entidad.SegVKM; + +/** + * + * @author Administrador + */ +@Repository("segVKMDAO") +public class SegVKMHibernateDAO extends GenericHibernateDAO + implements SegVKMDAO { + + @Autowired + public SegVKMHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String serie) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("serie", serie)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguradoraEmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguradoraEmpresaHibernateDAO.java new file mode 100644 index 000000000..21480d18d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguradoraEmpresaHibernateDAO.java @@ -0,0 +1,38 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SeguradoraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; + +@Repository("seguradoraEmpresaDAO") +public class SeguradoraEmpresaHibernateDAO extends GenericHibernateDAO implements SeguradoraEmpresaDAO { + + @Autowired + public SeguradoraEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerTodos() { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean existe(Empresa empresa, String serie){ + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("serie", serie)); + return !c.list().isEmpty(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroKmHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroKmHibernateDAO.java new file mode 100644 index 000000000..256231a68 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroKmHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SeguroKmDAO; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; + +@Repository("seguroKmDAO") +public class SeguroKmHibernateDAO extends GenericHibernateDAO implements SeguroKmDAO { + + @Autowired + public SeguroKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public boolean existe(Integer orgaoConcedenteId) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + + return HibernateFix.count(c.list()) > 0; + } + + public List buscarPorOrgao(OrgaoConcedente orgao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente", orgao)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroTarifaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroTarifaHibernateDAO.java new file mode 100644 index 000000000..a70c505db --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroTarifaHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; + +@Repository("seguroTarifaDAO") +public class SeguroTarifaHibernateDAO extends GenericHibernateDAO implements SeguroTarifaDAO { + + @Autowired + public SeguroTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public boolean existe(Integer orgaoConcedenteId) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + + return HibernateFix.count(c.list()) > 0; + } + + public List buscarPorOrgao(OrgaoConcedente orgao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente", orgao)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SisdapHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SisdapHibernateDAO.java new file mode 100644 index 000000000..89de01c8a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SisdapHibernateDAO.java @@ -0,0 +1,580 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.sql.DataSource; + +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.ResultSetHandler; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SisdapDAO; +import com.rjconsultores.ventaboletos.relatorios.MovimentoLinha; +import com.rjconsultores.ventaboletos.relatorios.MovimentoSecoes; +import com.rjconsultores.ventaboletos.relatorios.PrefixoAntt; + +@Repository("sisdapDAO") +public class SisdapHibernateDAO implements SisdapDAO { + + private static String HYPHEN = "-"; + + @Autowired + private DataSource dataSourceRead; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId) { + + List list = consultaMovimentoLinhas(fecInicio, fecFinal, empresaId); + + List result = new ArrayList(); + + for (MovimentoLinha movimentoLinha : list) { + boolean insert = agrupaMovimentoLinhas(result, movimentoLinha); + if (insert) + result.add(movimentoLinha); + } + + List periodos = new ArrayList(); + for (MovimentoLinha movimentoLinha : result) { + String periodo = movimentoLinha.getAno() + HYPHEN + movimentoLinha.getMes(); + if (!periodos.contains(periodo)) { + periodos.add(periodo); + } + } + + List prefixos = buscaPrefixoEmpresa(empresaId); + + HashMap> periodosPrefixos = new HashMap>(); + for (String pd : periodos) { + periodosPrefixos.put(pd, prefixos); + } + + for (MovimentoLinha movimentoLinha : result) { + String periodo = movimentoLinha.getAno() + HYPHEN + movimentoLinha.getMes(); + + PrefixoAntt prefixoAntt = new PrefixoAntt(); + prefixoAntt.setAntt(movimentoLinha.getAntt()); + prefixoAntt.setPrefixo(movimentoLinha.getPrefixo()); + + if (periodosPrefixos.get(periodo).contains(prefixoAntt)) { + periodosPrefixos.get(periodo).remove(prefixoAntt); + } + } + + for (String key : periodosPrefixos.keySet()) { + String[] periodo = key.split(HYPHEN); + Integer ano = Integer.parseInt(periodo[0]); + Integer mes = Integer.parseInt(periodo[1]); + + for (PrefixoAntt prefixoAntt : periodosPrefixos.get(key)) { + MovimentoLinha linha = new MovimentoLinha(); + linha.setAno(ano); + linha.setMes(mes); + linha.setAntt(prefixoAntt.getAntt()); + linha.setPrefixo(prefixoAntt.getPrefixo()); + linha.setLugaresIda(NumberUtils.INTEGER_ZERO); + linha.setLugaresVolta(NumberUtils.INTEGER_ZERO); + linha.setViagensIda(NumberUtils.INTEGER_ZERO); + linha.setViagensVolta(NumberUtils.INTEGER_ZERO); + + result.add(linha); + } + } + + Collections.sort(result, new Comparator() { + public int compare(Object o1, Object o2) { + MovimentoLinha c1 = (MovimentoLinha) o1; + MovimentoLinha c2 = (MovimentoLinha) o2; + + int result = c1.getAno().compareTo(c2.getAno()); + if (result == 0) { + result = c1.getMes().compareTo(c2.getMes()); + } + if (result == 0) { + result = c1.getAntt().compareToIgnoreCase(c2.getAntt()); + } + if (result == 0) { + return c1.getPrefixo().compareToIgnoreCase(c2.getPrefixo()); + } + return result; + } + }); + + List movimentoLinhas = new ArrayList(); + movimentoLinhas.add("empresa;prefixo;mes;ano;viagem_ida;viagem_volta;lugar_ida;lugar_volta"); + for (MovimentoLinha movimentoLinha : result) { + movimentoLinhas.add(movimentoLinha.toString()); + } + + return movimentoLinhas; + } + + private List consultaMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId) { + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + StringBuilder sb = new StringBuilder(); + sb.append("select e.codantt antt, r.prefixo prefixo, "); + sb.append(" to_char(c.feccorrida, 'MM') mes, to_char(c.feccorrida, 'yyyy') ano, "); + sb.append(" nvl(case r.indsentidoida when 1 then count(r.prefixo) end, 0) viagensida, "); + sb.append(" nvl(case r.indsentidoida when 0 then count(r.prefixo) end, 0) viagensvolta, "); + sb.append(" nvl(case r.indsentidoida when 1 then sum(da.cantasientos) end, 0) lugaresida, "); + sb.append(" nvl(case r.indsentidoida when 0 then sum(da.cantasientos) end, 0) lugaresvolta "); + sb.append("from ruta_empresa re "); + sb.append(" left join marca m on m.marca_id = re.empresa_id "); + sb.append(" left join empresa e on m.empresa_id = e.empresa_id "); + sb.append(" left join ruta r on re.ruta_id = r.ruta_id "); + sb.append(" left join corrida c on c.ruta_id = r.ruta_id "); + sb.append(" left outer join rol_operativo ro on c.roloperativo_id = ro.roloperativo_id "); + sb.append(" left outer join diagrama_autobus da on da.diagramaautobus_id = ro.diagramaautobus_id "); + sb.append("where m.marca_id = ? and re.activo = 1 and r.activo = 1 "); + sb.append(" and r.orgaoconcedente_id = 3 and e.codantt is not null "); + sb.append(" and c.feccorrida between to_date(?, 'DD/MM/YYYY') and "); + sb.append(" to_date(?, 'DD/MM/YYYY') "); + sb.append("group by e.codantt, r.prefixo, r.indsentidoida, "); + sb.append(" to_char(c.feccorrida, 'MM'), to_char(c.feccorrida, 'yyyy') "); + sb.append("order by mes, ano, e.codantt, r.prefixo, viagensida, viagensvolta "); + + QueryRunner queryRunner = new QueryRunner(dataSourceRead); + ResultSetHandler> handler = new BeanListHandler(MovimentoLinha.class); + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId, sdf.format(fecInicio), sdf.format(fecFinal)); + } catch (SQLException e) { + e.printStackTrace(); + } + + return returnedList; + } + + private List buscaPrefixoEmpresa(Integer empresaId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select e.codantt antt, r.prefixo prefixo "); + sb.append(" from ruta_empresa re "); + sb.append(" left join marca m on m.marca_id = re.empresa_id "); + sb.append(" left join empresa e on m.empresa_id = e.empresa_id "); + sb.append(" left join ruta r on re.ruta_id = r.ruta_id "); + sb.append(" where re.empresa_id = ? and r.orgaoconcedente_id = 3 "); + sb.append(" and re.activo = 1 and r.activo = 1 "); + sb.append(" group by e.codantt, r.prefixo "); + sb.append(" order by e.codantt, r.prefixo "); + + + QueryRunner queryRunner = new QueryRunner(dataSourceRead); + ResultSetHandler> handler = new BeanListHandler(PrefixoAntt.class); + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId); + } catch (SQLException e) { + e.printStackTrace(); + } + + return returnedList; + } + + private boolean agrupaMovimentoLinhas(List resul, MovimentoLinha movimentoLinha) { + + if (resul.isEmpty()) { + return true; + } else { + for (MovimentoLinha ml : resul) { + if (ml.getPrefixo().equals(movimentoLinha.getPrefixo()) && ml.getMes().equals(movimentoLinha.getMes()) + && ml.getAno().equals(movimentoLinha.getAno())) { + + if (movimentoLinha.getViagensVolta() > 0) { + ml.setLugaresVolta(movimentoLinha.getLugaresVolta()); + ml.setViagensVolta(movimentoLinha.getViagensVolta()); + } + + if (movimentoLinha.getViagensIda() > 0) { + ml.setLugaresIda(movimentoLinha.getLugaresIda()); + ml.setViagensIda(movimentoLinha.getViagensIda()); + } + return false; + } + } + } + + return true; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId) { + List listResultConsulta = consultaMovimentoSecoes(fecInicio, fecFinal, empresaId); + List listResultIdaVoltaInvertida = new ArrayList(); + List listVoltasSemIda = new ArrayList(); + + for (MovimentoSecoes ms : listResultConsulta) { + + Boolean achou = Boolean.FALSE; + if(isIda(ms)) { + for (MovimentoSecoes ms2 : listResultConsulta) { + if(ms.getLocalOrigem().equals(ms2.getLocalDestino()) && ms2.getLocalOrigem().equals(ms.getLocalDestino()) && !isIda(ms2) && ms2.getPrefixo().equals(ms.getPrefixo())) { + ms.setDescontoIdosoVolta(ms2.getDescontoIdosoVolta()); + ms.setGratuidadeIdosoVolta(ms2.getGratuidadeIdosoVolta()); + ms.setGratuidadePasseLivreVolta(ms2.getGratuidadePasseLivreVolta()); + ms.setPassageirosVolta(ms2.getPassageirosVolta()); + listResultIdaVoltaInvertida.add(ms); + achou = Boolean.TRUE; + break; + } + } + + if(!achou) { + listResultIdaVoltaInvertida.add(ms); + } + } else { + listVoltasSemIda.add(ms); + } + } + + for (MovimentoSecoes volta : listVoltasSemIda) { + + Boolean achou = Boolean.FALSE; + + for (MovimentoSecoes idaVolta : listResultIdaVoltaInvertida) { + if(idaVolta.getLocalOrigem().equals(volta.getLocalDestino()) && volta.getLocalOrigem().equals(idaVolta.getLocalDestino()) && volta.getPrefixo().equals(idaVolta.getPrefixo())) { + achou = Boolean.TRUE; + } + } + + if(!achou) { + String origem = volta.getLocalOrigem(); + String destino = volta.getLocalDestino(); + + volta.setLocalDestino(origem); + volta.setLocalOrigem(destino); + listResultIdaVoltaInvertida.add(volta); + } + } + + List periodos = new ArrayList(); + for (MovimentoSecoes ms : listResultIdaVoltaInvertida) { + String periodo = ms.getAno() + HYPHEN + ms.getMes(); + if (!periodos.contains(periodo)) { + periodos.add(periodo); + } + } + + List prefixos = buscaPrefixoEmpresaOrigenDestino(empresaId); + + HashMap> periodosPrefixos = new HashMap>(); + for (String pd : periodos) { + periodosPrefixos.put(pd, prefixos); + } + + for (MovimentoSecoes ms : listResultIdaVoltaInvertida) { + String periodo = ms.getAno() + HYPHEN + ms.getMes(); + + PrefixoAntt prefixoAntt = new PrefixoAntt(); + prefixoAntt.setAntt(ms.getAntt()); + prefixoAntt.setPrefixo(ms.getPrefixo()); + prefixoAntt.setLocalDestino(ms.getLocalDestino()); + prefixoAntt.setLocalOrigem(ms.getLocalOrigem()); + + if (periodosPrefixos.get(periodo).contains(prefixoAntt)) { + periodosPrefixos.get(periodo).remove(prefixoAntt); + } + } + + for (String key : periodosPrefixos.keySet()) { + String[] periodo = key.split(HYPHEN); + Integer ano = Integer.parseInt(periodo[0]); + Integer mes = Integer.parseInt(periodo[1]); + + for (PrefixoAntt prefixoAntt : periodosPrefixos.get(key)) { + MovimentoSecoes ms = new MovimentoSecoes(); + ms.setAno(ano); + ms.setMes(mes); + + ms.setAntt(prefixoAntt.getAntt()); + ms.setPrefixo(prefixoAntt.getPrefixo()); + ms.setLocalDestino(prefixoAntt.getLocalDestino()); + ms.setLocalOrigem(prefixoAntt.getLocalOrigem()); + + ms.setDescontoIdosoIda(NumberUtils.INTEGER_ZERO); + ms.setDescontoIdosoVolta(NumberUtils.INTEGER_ZERO); + ms.setGratuidadeIdosoIda(NumberUtils.INTEGER_ZERO); + ms.setGratuidadeIdosoVolta(NumberUtils.INTEGER_ZERO); + ms.setGratuidadePasseLivreIda(NumberUtils.INTEGER_ZERO); + ms.setGratuidadePasseLivreVolta(NumberUtils.INTEGER_ZERO); + ms.setPassageirosIda(NumberUtils.INTEGER_ZERO); + ms.setPassageirosVolta(NumberUtils.INTEGER_ZERO); + + listResultIdaVoltaInvertida.add(ms); + } + } + + Collections.sort(listResultIdaVoltaInvertida, new Comparator() { + public int compare(Object o1, Object o2) { + MovimentoSecoes c1 = (MovimentoSecoes) o1; + MovimentoSecoes c2 = (MovimentoSecoes) o2; + + int result = c1.getAno().compareTo(c2.getAno()); + if (result == 0) { + result = c1.getMes().compareTo(c2.getMes()); + } + if (result == 0) { + result = c1.getAntt().compareToIgnoreCase(c2.getAntt()); + } + if (result == 0) { + return c1.getPrefixo().compareToIgnoreCase(c2.getPrefixo()); + } + if (result == 0) { + return c1.getLocalOrigem().compareToIgnoreCase(c2.getLocalOrigem()); + } + if (result == 0) { + return c1.getLocalDestino().compareToIgnoreCase(c2.getLocalDestino()); + } + return result; + } + }); + + List movimentosSecoes = new ArrayList(); + movimentosSecoes.add("empresa;prefixo;local_origem;local_destino;mes;ano;passageiro_ida;passageiro_volta;gratuidade_ida" + + ";gratuidade_volta;idoso_ida;idoso_volta;desconto_ida;desconto_volta "); + + for (MovimentoSecoes ms : listResultIdaVoltaInvertida) { + movimentosSecoes.add(ms.toString()); + } + + return movimentosSecoes; + } + + private boolean isIda(MovimentoSecoes ms) { + Integer somaVolta = (ms.getDescontoIdosoVolta() + ms.getGratuidadeIdosoVolta() + ms.getGratuidadePasseLivreVolta() + ms.getPassageirosVolta()); + Integer somaIda = (ms.getDescontoIdosoIda() + ms.getGratuidadeIdosoIda() + ms.getGratuidadePasseLivreIda() + ms.getPassageirosIda()); + return (somaVolta.intValue() == 0) && (somaIda.intValue() > 0); + } + + private List consultaMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId) { + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + StringBuilder sb = new StringBuilder(); + sb.append("SELECT subAlias.antt, "); + sb.append(" subAlias.prefixo, "); + sb.append(" subAlias.mes, "); + sb.append(" subAlias.ano, "); + sb.append(" po.codantt localOrigem, "); + sb.append(" pd.codantt localDestino, "); + sb.append(" sum(subAlias.passageirosida) as passageirosida, "); + sb.append(" sum(subAlias.passageirosvolta) as passageirosvolta, "); + sb.append(" sum(subAlias.gratuidadepasselivreida) as gratuidadepasselivreida, "); + sb.append(" sum(subAlias.gratuidadepasselivrevolta) as gratuidadepasselivrevolta, "); + sb.append(" sum(subAlias.gratuidadeidosoida) as gratuidadeidosoida, "); + sb.append(" sum(subAlias.gratuidadeidosovolta) as gratuidadeidosovolta, "); + sb.append(" sum(subAlias.descontoidosoida) as descontoidosoida, "); + sb.append(" sum(subAlias.descontoidosovolta) as descontoidosovolta "); + + sb.append("FROM (SELECT distinct subResp.antt antt, "); + sb.append(" subResp.prefixo prefixo, "); + sb.append(" subResp.mes mes, "); + sb.append(" subResp.ano ano, "); + sb.append(" coalesce(ase.aliasorigen_id, subResp.localorigem) aliasorigen, "); + sb.append(" coalesce(ase.aliasdestino_id, subResp.localdestino) aliasdestino, "); + sb.append(" subResp.passageirosida passageirosida, "); + sb.append(" subResp.passageirosvolta passageirosvolta, "); + sb.append(" subResp.gratuidadepasselivreida gratuidadepasselivreida, "); + sb.append(" subResp.gratuidadepasselivrevolta gratuidadepasselivrevolta, "); + sb.append(" subResp.gratuidadeidosoida gratuidadeidosoida, "); + sb.append(" subResp.gratuidadeidosovolta gratuidadeidosovolta, "); + sb.append(" subResp.descontoidosoida descontoidosoida, "); + sb.append(" subResp.descontoidosovolta descontoidosovolta "); + + sb.append(" FROM (SELECT distinct r.ruta_id ruta_id, "); + sb.append(" e.codantt antt, "); + sb.append(" r.prefixo prefixo, "); + sb.append(" To_char(c.feccorrida, 'MM') mes, "); + sb.append(" To_char(c.feccorrida, 'yyyy') ano, "); + sb.append(" po.parada_id localorigem, "); + sb.append(" pd.parada_id localdestino, "); + + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IS NULL) THEN Count(*) END, 0) passageirosida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IS NULL) THEN Count(*) END, 0) passageirosvolta, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IN ( 2 )) THEN Count(*) END, 0) gratuidadepasselivreida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IN ( 2 )) THEN Count(*) END, 0) gratuidadepasselivrevolta, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IN ( 1 )) THEN Count(*) END, 0) gratuidadeidosoida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IN ( 1 )) THEN Count(*) END, 0) gratuidadeidosovolta, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IN ( 3 )) THEN Count(*) END, 0) descontoidosoida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN (SELECT categoria_id "); + sb.append(" FROM categoria "); + sb.append(" WHERE grupocategoria_id IN ( 3 )) THEN Count(*) END, 0) descontoidosovolta "); + sb.append(" FROM ruta_empresa re "); + sb.append(" left join marca m ON m.marca_id = re.empresa_id "); + sb.append(" left join empresa e ON m.empresa_id = e.empresa_id "); + sb.append(" left join ruta r ON re.ruta_id = r.ruta_id "); + sb.append(" left join corrida c ON c.ruta_id = r.ruta_id "); + sb.append(" left outer join boleto b ON c.corrida_id = b.corrida_id AND c.feccorrida = b.feccorrida "); + sb.append(" left outer join parada po ON po.parada_id = b.origen_id "); + sb.append(" left outer join parada pd ON pd.parada_id = b.destino_id "); + + sb.append(" WHERE m.marca_id = ? "); + sb.append(" AND re.activo = 1 "); + sb.append(" AND r.activo = 1 "); + sb.append(" AND r.orgaoconcedente_id = 3 "); + sb.append(" AND b.numasiento IS NOT NULL "); + sb.append(" AND b.motivocancelacion_id IS NULL "); + sb.append(" AND e.codantt IS NOT NULL "); + sb.append(" AND c.feccorrida BETWEEN To_date(?, 'DD/MM/YYYY') AND To_date (?, 'DD/MM/YYYY') "); + sb.append(" AND b.categoria_id <> (select valorconstante from constante where NOMBCONSTANTE = 'GRATUIDADE_CRIANCA')"); + sb.append(" GROUP BY e.codantt, "); + sb.append(" r.prefixo, "); + sb.append(" To_char(c.feccorrida, 'MM'), "); + sb.append(" To_char(c.feccorrida, 'yyyy'), "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id, "); + sb.append(" r.indsentidoida, "); + sb.append(" b.categoria_id, "); + sb.append(" r.ruta_id "); + sb.append( " ORDER BY e.codantt, "); + sb.append( " r.prefixo) subResp "); + + sb.append(" left join alias_servico ase ON ( subResp.localorigem = ase.origen_id AND subResp.localdestino = ase.destino_id and ase.ruta_id = subResp.ruta_id) "); + + sb.append( " ORDER BY subResp.antt,"); + sb.append( " subResp.prefixo"); + sb.append( " ) subAlias"); + + sb.append(" inner join parada po ON ( subAlias.aliasorigen = po.parada_id ) "); + sb.append(" inner join parada pd ON ( subAlias.aliasdestino = pd.parada_id ) "); + + sb.append("GROUP BY mes, "); + sb.append(" ano, "); + sb.append(" antt, "); + sb.append(" prefixo, "); + sb.append(" po.codantt, "); + sb.append(" pd.codantt "); + + sb.append("ORDER BY mes, "); + sb.append(" ano, "); + sb.append(" antt, "); + sb.append(" prefixo, "); + sb.append(" localOrigem, "); + sb.append(" localDestino "); + + QueryRunner queryRunner = new QueryRunner(dataSourceRead); + ResultSetHandler> handler = new BeanListHandler(MovimentoSecoes.class); + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId, sdf.format(fecInicio), sdf.format(fecFinal)); + + } catch (SQLException e) { + e.printStackTrace(); + } + + return returnedList; + } + + private List buscaPrefixoEmpresaOrigenDestino(Integer empresaId) { + + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT DISTINCT "); + sb.append(" subAlias.antt, "); + sb.append(" subAlias.prefixo, "); + sb.append(" CASE WHEN subAlias.indIda = 1 THEN po.codantt ELSE pd.codantt END localOrigem, "); + sb.append(" CASE WHEN subAlias.indIda = 1 THEN pd.codantt ELSE po.codantt END localDestino "); + sb.append(" FROM (SELECT distinct subResp.antt antt, "); + sb.append(" subResp.prefixo prefixo, "); + sb.append(" ase.aliasorigen_id aliasorigen, "); + sb.append(" ase.aliasdestino_id aliasdestino, "); + sb.append(" subResp.indIda indIda "); + + sb.append(" FROM (SELECT distinct r.ruta_id ruta_id, "); + sb.append(" e.codantt antt, "); + sb.append(" r.prefixo prefixo, "); + sb.append(" po.parada_id localorigem, "); + sb.append(" pd.parada_id localdestino, "); + sb.append(" r.INDSENTIDOIDA indIda "); + sb.append(" FROM ruta_empresa re "); + sb.append(" join empresa e ON re.empresa_id = e.empresa_id "); + sb.append(" join ruta r ON re.ruta_id = r.ruta_id "); + sb.append(" join RUTA_COMBINACION rc on rc.RUTA_ID = r.ruta_id "); + sb.append(" join tramo tr on tr.TRAMO_ID = rc.TRAMO_ID "); + sb.append(" join parada po ON po.parada_id = tr.origen_id "); + sb.append(" join parada pd ON pd.parada_id = tr.destino_id "); + + sb.append(" WHERE e.empresa_id = ? "); + sb.append(" AND re.activo = 1 "); + sb.append(" AND r.activo = 1 "); + sb.append(" AND r.orgaoconcedente_id = 3 "); + sb.append(" AND e.codantt IS NOT NULL "); + sb.append(" GROUP BY e.codantt, "); + sb.append(" r.prefixo, "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id, "); + sb.append(" r.ruta_id, "); + sb.append(" r.INDSENTIDOIDA "); + sb.append(" ORDER BY e.codantt, "); + sb.append(" r.prefixo) subResp "); + + sb.append(" join alias_servico ase ON ( subResp.localorigem = ase.origen_id AND subResp.localdestino = ase.destino_id and ase.ruta_id = subResp.ruta_id) "); + + sb.append(" ORDER BY subResp.antt, "); + sb.append(" subResp.prefixo ) subAlias "); + + sb.append(" join parada po ON ( subAlias.aliasorigen = po.parada_id ) "); + sb.append(" join parada pd ON ( subAlias.aliasdestino = pd.parada_id ) "); + + sb.append(" WHERE po.codantt <> pd.codantt "); + + sb.append(" GROUP BY antt, "); + sb.append(" prefixo, "); + sb.append(" po.codantt, "); + sb.append(" pd.codantt , "); + sb.append(" indIda "); + sb.append(" ORDER BY antt, "); + sb.append(" prefixo, "); + sb.append(" localOrigem, "); + sb.append(" localDestino "); + + QueryRunner queryRunner = new QueryRunner(dataSourceRead); + ResultSetHandler> handler = new BeanListHandler(PrefixoAntt.class); + + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId); + } catch (SQLException e) { + e.printStackTrace(); + } + return returnedList; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SistemaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SistemaHibernateDAO.java new file mode 100644 index 000000000..c454f506e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/SistemaHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.SistemaDAO; +import com.rjconsultores.ventaboletos.entidad.Sistema; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("sistemaDAO") +public class SistemaHibernateDAO extends GenericHibernateDAO + implements SistemaDAO { + + @Autowired + public SistemaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombsistema")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaCategoriaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaCategoriaHibernateDAO.java new file mode 100644 index 000000000..4e737d0e8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaCategoriaHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarifaCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("tarifaCategoriaDAO") +public class TarifaCategoriaHibernateDAO + extends GenericHibernateDAO + implements TarifaCategoriaDAO { + + @Autowired + public TarifaCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorCategoria(Categoria categoria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoria", categoria)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java new file mode 100644 index 000000000..623b7f15f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java @@ -0,0 +1,252 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.Validate; +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.dao.TarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author rodrigo + */ +@Repository("tarifaDAO") +public class TarifaHibernateDAO extends GenericHibernateDAO implements TarifaDAO { + + @Autowired + private RutaDAO rutaDAO; + private static Logger log = Logger.getLogger(TarifaHibernateDAO.class); + + @Autowired + public TarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean existe(Marca marca, Tramo tramo, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente) { + + Validate.notNull(marca); + Validate.notNull(tramo); + Validate.notNull(moneda); + Validate.notNull(claseServicio); + Validate.notNull(vigenciaTarifa); + Validate.notNull(ruta); + Validate.notNull(orgaoConcedente); + + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("orgaoConcedente", orgaoConcedente)); + + c.setProjection(Projections.rowCount()); + + return (HibernateFix.count(c.list()) > 0); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Categoria categoria, TipoPuntoVenta tipoPuntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + Criteria cCategoria = null; + if (categoria != null) { + cCategoria = c.createCriteria("lsTarifaCategoria"); + cCategoria.add(Restrictions.eq("categoria", categoria)); + cCategoria.add(Restrictions.eq("activo", Boolean.TRUE)); + } + + Criteria cTipoPuntoVenta = null; + if (tipoPuntoVenta != null) { + cTipoPuntoVenta = c.createCriteria("lsTarifaTipoptovta"); + cTipoPuntoVenta.add(Restrictions.eq("tipoPuntoVenta", tipoPuntoVenta)); + cTipoPuntoVenta.add(Restrictions.eq("activo", Boolean.TRUE)); + } + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + Criteria cTramo = c.createCriteria("tramo"); + if (origem != null) { + cTramo.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + cTramo.add(Restrictions.eq("destino", destino)); + } + + if (moneda != null) { + c.add(Restrictions.eq("moneda", moneda)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (vigenciaTarifa != null) { + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + } + + return c.list(); + } + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("marca", marca)); + + Criteria cTramo = c.createCriteria("tramo"); + cTramo.add(Restrictions.eq("activo", true)); + + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (Tarifa) c.uniqueResult(); + } + + public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia, Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + if (vigencia != null) { + c.add(Restrictions.eq("vigenciaTarifa", vigencia)); + } + if (empresa != null) { + c.createCriteria("marca").add(Restrictions.eq("empresa", empresa)); + } + + return c.list(); + } + + public List buscarTarifasAtivasPorVigencia(VigenciaTarifa vigenciaTarifa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + + return c.list(); + } + + public boolean buscarTarifaExisteTramo(Tramo tramo) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + return (HibernateFix.count(c.list()) > 0); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { + try { + StringBuilder sQuery = null; + if (excluirTarifasDestino) { + sQuery = new StringBuilder("DELETE FROM TARIFA WHERE VIGENCIATARIFA_ID = :VIGENCIATARIFAID "); + SQLQuery qrUpdate = getSession().createSQLQuery(sQuery.toString()); + qrUpdate.setParameter("VIGENCIATARIFAID", vigenciaTarifaDestino.getVigenciatarifaId()); + qrUpdate.executeUpdate(); + } + + sQuery = new StringBuilder("INSERT INTO TARIFA( "); + sQuery.append("TARIFA_ID,PRECIO,PRECIOREDABIERTO,TRAMO_ID,MARCA_ID,CLASESERVICIO_ID,PRECIOORIGINAL,MONEDA_ID,VIGENCIATARIFA_ID,STATUSTARIFA,ACTIVO,FECMODIF,") + .append("USUARIO_ID,IMPORTETAXAEMBARQUE,IMPORTEPEDAGIO,IMPORTEOUTROS,IMPORTESEGURO,ORGAOCONCEDENTE_ID,RUTA_ID,ORIGEN_ID,DESTINO_ID) ") + .append(" SELECT " + + "TARIFA_SEQ.NEXTVAL, " + + "PRECIO, " + + "PRECIOREDABIERTO, " + + "TRAMO_ID, " + + "tarifa.MARCA_ID, " + + "CLASESERVICIO_ID, " + + "PRECIOORIGINAL, " + + "MONEDA_ID, " + + ":VIGENCIATARIFAIDDESTINO, " + + "STATUSTARIFA, " + + "1, " + + "sysdate, " + + ":USUARIOID, " + + "IMPORTETAXAEMBARQUE, " + + "IMPORTEPEDAGIO, " + + "IMPORTEOUTROS, " + + "IMPORTESEGURO, " + + "ORGAOCONCEDENTE_ID, " + + "RUTA_ID, " + + "ORIGEN_ID, " + + "DESTINO_ID " + + + "FROM TARIFA tarifa " + + "INNER JOIN MARCA marca ON marca.MARCA_ID = tarifa.MARCA_ID " + + "WHERE tarifa.ACTIVO = 1 AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDORIGEM"); + + if (empresa != null) { + sQuery.append(" AND marca.EMPRESA_ID = :EMPRESA_ID"); + } + + SQLQuery qrInsert = getSession().createSQLQuery(sQuery.toString()); + qrInsert.setParameter("VIGENCIATARIFAIDORIGEM", vigenciaTarifaOrigem.getVigenciatarifaId()); + qrInsert.setParameter("VIGENCIATARIFAIDDESTINO", vigenciaTarifaDestino.getVigenciatarifaId()); + qrInsert.setParameter("USUARIOID", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + if (empresa != null) { + qrInsert.setParameter("EMPRESA_ID", empresa.getEmpresaId()); + } + qrInsert.executeUpdate(); + + } catch (Exception e) { + log.error(e.getMessage()); + throw new BusinessException(e.getMessage(), e.getCause()); + } + } + + @Override + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + c.setProjection(Projections.rowCount()); + return (HibernateFix.count(c.list()) > 0); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHistHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHistHibernateDAO.java new file mode 100644 index 000000000..2e3602395 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHistHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarifaHistDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaHist; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("tarifaHistDAO") +public class TarifaHistHibernateDAO extends GenericHibernateDAO + implements TarifaHistDAO { + + @Autowired + public TarifaHistHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaKmHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaKmHibernateDAO.java new file mode 100644 index 000000000..ecb90ab46 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaKmHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TarifaKmDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; + +/** +* +* @author daniel.zauli +*/ +@Repository("tarifaKmDAO") +public class TarifaKmHibernateDAO extends GenericHibernateDAO +implements TarifaKmDAO { + + @Autowired + public TarifaKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("orgaoconcedenteId", orgaoconcedenteId)); + if( claseId.getClaseservicioId() != -1){ + c.add(Restrictions.eq("claseServicio", claseId)); + } + + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java new file mode 100644 index 000000000..05627dc6a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java @@ -0,0 +1,221 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarifaMinimaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; + +import java.math.BigDecimal; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Repository("tarifaMinimaDAO") +public class TarifaMinimaHibernateDAO extends GenericHibernateDAO + implements TarifaMinimaDAO { + + @Autowired + public TarifaMinimaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (moneda != null) { + c.add(Restrictions.eq("moneda", moneda)); + } + + return c.list(); + } + + public List pesquisarPlaza(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Plaza plaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (plaza != null) { + c.add(Restrictions.eq("plaza", plaza)); + } + + return c.list(); + } + + public List buscarPorPlaza(Plaza plaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("plaza", plaza)); + + return c.list(); + } + + public List pesquisar(BigDecimal valor, Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("importetarifa", valor)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("plaza", plaza)); + + return c.list(); + } + + public List pesquisar(Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, OrgaoConcedente orgaoConcedente) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + // c.add(Restrictions.eq("importetarifa", valor)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("plaza", plaza)); + c.add(Restrictions.eq("orgaoConcedente", orgaoConcedente)); + + return c.list(); + } + + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio, Moneda moneda) { + + Criteria criterioBusca = getSession().createCriteria(getPersistentClass()); + + Disjunction disjunctionOrigem = Restrictions.disjunction(); + Criterion cOrigem = Restrictions.eq("origem", origem); + Criterion cOrigemTodos = Restrictions.eq("origem.paradaId", Parada.ID_PARADA_TODOS); + disjunctionOrigem.add(cOrigem); + disjunctionOrigem.add(cOrigemTodos); + criterioBusca.add(disjunctionOrigem); + + Disjunction disjunctionDestino = Restrictions.disjunction(); + Criterion cDestino = Restrictions.eq("destino", destino); + Criterion cDestinoTodos = Restrictions.eq("destino.paradaId", Parada.ID_PARADA_TODOS); + disjunctionDestino.add(cDestino); + disjunctionDestino.add(cDestinoTodos); + criterioBusca.add(disjunctionDestino); + + criterioBusca.add(Restrictions.eq("activo", Boolean.TRUE)); + criterioBusca.add(Restrictions.eq("moneda", moneda)); + + criterioBusca.add(Restrictions.or(Restrictions.eq("marca", marca), Restrictions.eq("marca.marcaId", (short) -1))); + criterioBusca.add(Restrictions.or(Restrictions.eq("claseServicio", claseServicio), Restrictions.eq("claseServicio.claseservicioId", -1))); + + return criterioBusca.list(); + } + + public List buscarPorMarcaMoneda(Marca marca, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } + + public List buscarPorClaseServicioMoneda( + ClaseServicio claseServicio, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("plaza", plaza)); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } + + @Override + @Transactional + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + getSession().save(tarifaMinimaCategoria); + return tarifaMinimaCategoria; + } + + @Override + @Transactional + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + getSession().merge(tarifaMinimaCategoria); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaOficialHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaOficialHibernateDAO.java new file mode 100644 index 000000000..630f74738 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaOficialHibernateDAO.java @@ -0,0 +1,244 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; + +@Repository("tarifaOficialDAO") +public class TarifaOficialHibernateDAO extends GenericHibernateDAO implements TarifaOficialDAO { + + private static Logger log = LoggerFactory.getLogger(TarifaOficialHibernateDAO.class); + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public TarifaOficialHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public Integer gerarTarifaPorCoeficiente(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + + String sql = sqlBuilder.getSQLGerarTarifaOficial(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + @Override + public Integer gerarTarifaArtesp(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + + String sql = sqlBuilder.getSQLGerarTarifaOficialArtesp(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + @Override + public Integer gerarTabelaZerada(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + + String sql = sqlBuilder.getSQLGerarTabelaZerada(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + @Override + public Integer atualizarTarifaCoeficiente(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId) { + + String sql = sqlBuilder.getSQLAtualizarTarifaOficial(rutaId, usuarioId, orgaoConcedenteId); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + public void limparTarifasOficiais() { + Query query = getSession().createQuery("DELETE FROM TarifaOficial"); + query.executeUpdate(); + } + + private void apagarTarifasInativas(VigenciaTarifa vigenciaTarifa){ + StringBuilder sb = new StringBuilder(""); + sb.append("select "); + sb.append(" tar.tarifaId "); + sb.append("from "); + sb.append(" Tarifa tar,TarifaOficial tao "); + sb.append("where "); + sb.append(" tar.activo=0 "); + sb.append(" and tao.activo = 1 "); + sb.append(" and tar.tramo=tao.tramo "); + sb.append(" and tar.marca=tao.marca "); + sb.append(" and tar.claseServicio =tao.claseServicio "); + sb.append(" and tar.moneda=tao.moneda "); + sb.append(" and tar.orgaoConcedente=tao.orgaoConcedente "); + sb.append(" and tar.ruta=tao.ruta "); + sb.append(" and tar.vigenciaTarifa.vigenciatarifaId = :vigenciaId "); + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("vigenciaId", vigenciaTarifa.getVigenciatarifaId()); + + List list = query.list(); + + if (!list.isEmpty()){ + query = getSession().createQuery("DELETE FROM TarifaTipoptovta WHERE tarifa.tarifaId in (:ids)"); + query.setParameterList("ids", list); + int qtd = query.executeUpdate(); + log.info("qtd TarifaTipoptovta apagada = " + qtd); + + query = getSession().createQuery("DELETE FROM TarifaCategoria WHERE tarifa.tarifaId in (:ids)"); + query.setParameterList("ids", list); + qtd = query.executeUpdate(); + log.info("qtd TarifaCategoria apagada = " + qtd); + + query = getSession().createQuery("DELETE FROM Tarifa WHERE activo = 0 and tarifaId in (:ids)"); + query.setParameterList("ids", list); + qtd = query.executeUpdate(); + log.info("qtd Tarifa apagada = " + qtd); + + + + } + } + + @Override + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro) { + //Apago antes as tarifas que podem estar como activo =0 + apagarTarifasInativas(vigenciaTarifa); + + // Insiro as tarifas que não existem + SQLQuery querySQL = getSession().createSQLQuery(sqlBuilder.getSQLInserirTarifaPelaTarifaOficial(vigenciaTarifa.getVigenciatarifaId(), usuarioId)); + querySQL.executeUpdate(); + // Atualizo o preço e o componente dos preços que já existem + querySQL = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTarifaPorTarifaOfical(vigenciaTarifa.getVigenciatarifaId(), usuarioId, calculaPegagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro)); + querySQL.executeUpdate(); + } + + @Override + public void atualizarTaxaEmbarque(List lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + + + int x = 0; + + if(lsRuta != null && !lsRuta.isEmpty()){ + x=lsRuta.size(); + } + + do{ + Integer rutaId = null ; + + if(lsRuta != null && !lsRuta.isEmpty()){ + rutaId = lsRuta.get(x-1).getRutaId(); + } + + // Atualizo a taxa de embarque de acordo a parada e km + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getAtualizarTaxaEmbarquePorKmParada(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas)); + query.executeUpdate(); + + // Atualizo a taxa de embarque de acordo a km do orgao + query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTaxaEmbarquePorKmOrgao(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas)); + query.executeUpdate(); + + // Atualizo a taxa de embarque de acordo a parada e valor fixo + query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTaxaEmbarquePorParadaFixo(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas)); + query.executeUpdate(); + x--; + }while(x > 0); + } + + @Override + public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId, Integer usuarioId) { + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorKm(rutaId, usuarioId, orgaoId)); + query.executeUpdate(); + } + + @Override + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId, Integer usuarioId) { + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorTarifa(rutaId, usuarioId, orgaoId)); + query.executeUpdate(); + } + + @Override + public long obtenerCount(){ + String sql = " select count(*) from TarifaOficial "; + Query query = getSession().createQuery(sql.toString()); + long qtd =0; + qtd = (Long) query.list().get(0); + + return qtd; + } + + @Override + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Integer usuarioId, Boolean taxaEmbarque) { + StringBuilder sql = new StringBuilder(); + sql.append(" UPDATE TarifaOficial tao "); + sql.append(" SET tao.precio = FN_ARREDONDAMENTO_TARIFA(tao.precio,tao.orgaoConcedente.orgaoConcedenteId,tao.importeseguro,tao.importetaxaembarque,tao.importepedagio,tao.importeoutros,:txEmbarque), "); + sql.append(" tao.activo = true , "); + sql.append(" tao.fecmodif= CURRENT_TIMESTAMP(), "); + sql.append(" tao.usuarioId =:usuarioId "); + + if (orgaoConcedenteId != null) { + sql.append(" WHERE tao.orgaoConcedente.orgaoConcedenteId = :orgao "); + } + + Query query = getSession().createQuery(sql.toString()); + if (orgaoConcedenteId != null) { + query.setParameter("orgao", orgaoConcedenteId); + } + query.setInteger("txEmbarque", taxaEmbarque ? 1 : 0); + query.setParameter("usuarioId", usuarioId); + query.executeUpdate(); + } + + public void atualizarPedagio() { + StringBuilder sql = new StringBuilder(); + sql.append(" merge into tarifa_oficial "); + sql.append(" using "); + sql.append(" ( "); + sql.append(" WITH tarifas_ofic as ( "); + sql.append(" select tarifaoficial_id, ORGAOCONCEDENTE_ID, ruta_id , origen_id , DESTINO_ID from tarifa_oficial "); + sql.append(" ), "); + sql.append(" peaje_tarifas as ( "); + sql.append(" select * from peaje p inner join tarifas_ofic tof on "); + sql.append(" p.ORGAOCONCEDENTE_ID = tof.ORGAOCONCEDENTE_ID and p.ruta_id = tof.ruta_id "); + sql.append(" and p.ORIGEN_ID = tof.ORIGEN_ID and p.DESTINO_ID = tof.DESTINO_ID and p.activo = 1 "); + sql.append(" ) "); + sql.append(" select pf.tarifaoficial_id , sum(importepeaje) as soma from peaje_tarifas pf Group by pf.tarifaoficial_id "); + sql.append(" "); + sql.append(" ) tarifa_importe "); + sql.append(" on (tarifa_oficial.tarifaoficial_id = tarifa_importe.tarifaoficial_id) "); + sql.append(" when matched then "); + sql.append(" update set "); + sql.append(" importepedagio = tarifa_importe.soma "); + + Connection conn = getSession().connection(); + Statement stmt; + try { + stmt = conn.createStatement(); + stmt.executeUpdate(sql.toString()); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaTipoptovtaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaTipoptovtaHibernateDAO.java new file mode 100644 index 000000000..f31e20391 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaTipoptovtaHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarifaTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("tarifaTipoptovtaDAO") +public class TarifaTipoptovtaHibernateDAO + extends GenericHibernateDAO + implements TarifaTipoptovtaDAO { + + @Autowired + public TarifaTipoptovtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaCreditoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaCreditoHibernateDAO.java new file mode 100644 index 000000000..517b54f22 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaCreditoHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TarjetaCreditoDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; + +@Repository("tarjetaCreditoDAO") +public class TarjetaCreditoHibernateDAO extends GenericHibernateDAO + implements TarjetaCreditoDAO { + + @Autowired + public TarjetaCreditoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descTarjetaCredito")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaFidelidadHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaFidelidadHibernateDAO.java new file mode 100644 index 000000000..465e0a43d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaFidelidadHibernateDAO.java @@ -0,0 +1,93 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarjetaFidelidadDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.ProjectionList; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("tarjetaFidelidadDAO") +public class TarjetaFidelidadHibernateDAO extends GenericHibernateDAO + implements TarjetaFidelidadDAO { + + @Autowired + public TarjetaFidelidadHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + return c.list(); + } + + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numTarjeta", numTarjeta)); + return (TarjetaFidelidad)c.list().get(0); + } + + public List obtenerCantDesc() { + + /*Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + ProjectionList projList = Projections.projectionList(); + projList.add(Projections.groupProperty("descGeneracion")); + projList.add(Projections.rowCount()); + c.setProjection(projList); + List list = c.list(); + + List list1 =list; + list.get(0); + list.get(1); //el la descripcion + //list.get( 0 )[1] //el la cantidad + + return list; + + */ + List sumatarjetas = new ArrayList(); + + String hql = "select count(*),descGeneracion" + + " from TarjetaFidelidad where activo = 1 group by descGeneracion"; + + Query qry = getSession().createQuery(hql); + + for (Iterator it = qry.iterate(); it.hasNext();) { + Object[] row = (Object[]) it.next(); + TarjetaFidelidadCuenta item = new TarjetaFidelidadCuenta(); + + item.setDescGeneracion((String) row[1]); + item.setCantidad(HibernateFix.count(row[0]).intValue()); + sumatarjetas.add(item); + } + return sumatarjetas; + + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaRecaudacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaRecaudacionHibernateDAO.java new file mode 100644 index 000000000..70da4125c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaRecaudacionHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarjetaRecaudacionDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tarjetaRecaudacionDAO") +public class TarjetaRecaudacionHibernateDAO + extends GenericHibernateDAO + implements TarjetaRecaudacionDAO { + + @Autowired + public TarjetaRecaudacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaViajeHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaViajeHibernateDAO.java new file mode 100644 index 000000000..3455c35f6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaViajeHibernateDAO.java @@ -0,0 +1,139 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.zkoss.zul.Comboitem; + +import com.rjconsultores.ventaboletos.dao.TarjetaViajeDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; +import java.util.Calendar; +import java.util.GregorianCalendar; +import org.hibernate.criterion.Order; + +@Repository("tarjetaViajeDAO") +public class TarjetaViajeHibernateDAO extends GenericHibernateDAO implements TarjetaViajeDAO { + + @Autowired + public TarjetaViajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarTarjetaPorFiltros(Integer autoIni, Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa) { + String hql = " select tv from TarjetaViaje tv " + + " where tv.tarjetaviajeId > 0 and activo = 1 "; + StringBuilder sb = new StringBuilder(); + if (autoIni != null && autoFin != null) { + sb.append(" and cast(tv.autobus.numautobus as int) <= ").append(autoFin); + sb.append(" and cast(tv.autobus.numautobus as int) >= ").append(autoIni); + } + if (dataFin != null && dataIni != null) { + sb.append(" and tv.fecHorSalida >= :dataIni"); + sb.append(" and tv.fecHorSalida <= :dataFin"); + } + if (empresa != null) { + Empresa e = (Empresa) empresa.getValue(); + if (e.getEmpresaId() != -1) { + sb.append(" and tv.empresa.empresaId = ").append(e.getEmpresaId()); + } + } + + sb.append(" order by cast(tv.autobus.numautobus as int), tv.fecHorSalida, tv.origen, tv.conductor.conductorId asc "); + + hql += sb.toString(); + + Query sq = getSession().createQuery(hql); + if (dataFin != null && dataIni != null) { + sq.setTimestamp("dataIni", dataIni); + sq.setTimestamp("dataFin", dataFin); + } + List lsTarjetas = sq.list(); + + return lsTarjetas; + } + + @Override + public List buscarTarjetaPorFiltros(TarjetaViaje tarjeta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.or(Restrictions.eq("autobus", tarjeta.getAutobus()), Restrictions.eq("conductor", tarjeta.getConductor()))); + c.add(Restrictions.eq("origen", tarjeta.getOrigen())); + return c.list(); + } + + @Override + public boolean buscarTarjetaExisteVolta(TarjetaViaje tarjeta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.or(Restrictions.eq("autobus", tarjeta.getAutobus()), Restrictions.eq("conductor", tarjeta.getConductor()))); + c.add(Restrictions.ge("fecHorSalida", tarjeta.getFecHorSalida())); + c.add(Restrictions.not(Restrictions.eq("tarjetaviajeId", tarjeta.getTarjetaviajeId()))); + c.addOrder(Order.asc("fecHorSalida")); + + c.setMaxResults(1); + + if (!c.list().isEmpty()) { + + TarjetaViaje tVResult = (TarjetaViaje) c.uniqueResult(); + if (tVResult.getOrigen().equals(tarjeta.getDestino()) + && tVResult.getDestino().equals(tarjeta.getOrigen())) { + return true; + } + } + + Criteria c1 = getSession().createCriteria(getPersistentClass()); + c1.add(Restrictions.eq("activo", true)); + c1.add(Restrictions.or(Restrictions.eq("autobus", tarjeta.getAutobus()), Restrictions.eq("conductor", tarjeta.getConductor()))); + c1.add(Restrictions.le("fecHorSalida", tarjeta.getFecHorSalida())); + c1.add(Restrictions.not(Restrictions.eq("tarjetaviajeId", tarjeta.getTarjetaviajeId()))); + c1.addOrder(Order.desc("fecHorSalida")); + c1.setMaxResults(1); + if (!c1.list().isEmpty()) { + TarjetaViaje tVResult = (TarjetaViaje) c1.uniqueResult(); + if (tVResult.getOrigen().equals(tarjeta.getDestino()) + && tVResult.getDestino().equals(tarjeta.getOrigen())) { + return true; + } + } + + + return false; + } + + @Override + public List buscarTarjetasParaEnvioNomina(Date fecIni, Date fecFin) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.isNull("fecenvionomina")); + + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(fecIni); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecIni); + gcalendar.set(Calendar.HOUR_OF_DAY, 0); + gcalendar.set(Calendar.MINUTE, 0); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + fecIni = gcalendar.getTime(); + + GregorianCalendar gcalendarFim = new GregorianCalendar(); + gcalendarFim.setTime(fecFin); + gcalendarFim.set(Calendar.HOUR_OF_DAY, 23); + gcalendarFim.set(Calendar.MINUTE, 59); + gcalendarFim.set(Calendar.SECOND, 59); + gcalendarFim.set(Calendar.MILLISECOND, 59); + fecFin = gcalendarFim.getTime(); + + c.add(Restrictions.between("fecHorSalida", fecIni, fecFin)); + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbLevanteCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbLevanteCtrlHibernateDAO.java new file mode 100644 index 000000000..30d12ca3e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbLevanteCtrlHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbLevanteCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; + +@Repository("taxaEmbLevanteCtrlDAO") +public class TaxaEmbLevanteCtrlHibernateDAO extends GenericHibernateDAO + implements TaxaEmbLevanteCtrlDAO { + + @Autowired + public TaxaEmbLevanteCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueKmHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueKmHibernateDAO.java new file mode 100644 index 000000000..dd603f4f3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueKmHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueKmDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("taxaEmbarqueKmDAO") +public class TaxaEmbarqueKmHibernateDAO extends GenericHibernateDAO + implements TaxaEmbarqueKmDAO { + + @Autowired + public TaxaEmbarqueKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("orgaoconcedenteId", orgaoconcedenteId)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueParadaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueParadaHibernateDAO.java new file mode 100644 index 000000000..97b0bfc21 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueParadaHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueParadaDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("taxaEmbarqueParadaDAO") +public class TaxaEmbarqueParadaHibernateDAO extends GenericHibernateDAO + implements TaxaEmbarqueParadaDAO { + + @Autowired + public TaxaEmbarqueParadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorLocalidade(Parada parada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("paradaId", parada)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCiudadHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCiudadHibernateDAO.java new file mode 100644 index 000000000..f639f60fa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCiudadHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCiudadDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoCambioCiudadDAO") +public class TipoCambioCiudadHibernateDAO extends GenericHibernateDAO + implements TipoCambioCiudadDAO { + + @Autowired + public TipoCambioCiudadHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCtrlHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCtrlHibernateDAO.java new file mode 100644 index 000000000..5ab521926 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCtrlHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoCambioCtrlDAO") +public class TipoCambioCtrlHibernateDAO extends GenericHibernateDAO + implements TipoCambioCtrlDAO { + + @Autowired + public TipoCambioCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoConvenioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoConvenioHibernateDAO.java new file mode 100644 index 000000000..a5cc27361 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoConvenioHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import java.io.Serializable; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("tipoConvenioDAO") +public class TipoConvenioHibernateDAO extends GenericHibernateDAO + implements TipoConvenioDAO { + + @Autowired + public TipoConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCorteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCorteHibernateDAO.java new file mode 100644 index 000000000..947525aff --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCorteHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCorteDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoCorteDAO") +public class TipoCorteHibernateDAO extends GenericHibernateDAO + implements TipoCorteDAO { + + @Autowired + public TipoCorteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String desctipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("desctipo", desctipo)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaDescuentoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaDescuentoHibernateDAO.java new file mode 100644 index 000000000..c71a25a2e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaDescuentoHibernateDAO.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("tipoCortesiaDescuentoDAO") +public class TipoCortesiaDescuentoHibernateDAO + extends GenericHibernateDAO + implements TipoCortesiaDescuentoDAO { + + @Autowired + public TipoCortesiaDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(TipoCortesia tipoCortesia) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (tipoCortesia != null) { + c.add(Restrictions.eq("tipoCortesia", tipoCortesia)); + } + return c.list(); + } + + public List Onchangue(TipoCortesia tp) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + if (tp != null) { + c.add(Restrictions.eq("tipoCortesia", tp)); + } + return c.list(); + } + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("porcdescuento", porcentaje)); + c.add(Restrictions.eq("tipoCortesia", tipoCortesia)); + + return c.list(); + } + + public List obtenerTipoCortesia(int i) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipoCortesia.tipocortesiaId", new Integer(i).shortValue())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaHibernateDAO.java new file mode 100644 index 000000000..9b42023b1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("tipoCortesiaDAO") +public class TipoCortesiaHibernateDAO extends GenericHibernateDAO + implements TipoCortesiaDAO { + + @Autowired + public TipoCortesiaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descTipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipo", descTipo)); + + return c.list(); + } + + public List obtenerGrupoCortesia(int i) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("grupoCortesia.grupocortesiaId", new Integer(i).shortValue())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java new file mode 100644 index 000000000..476db4676 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoDocAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +@Repository("tipoDocAutobusDAO") +public class TipoDocAutobusHibernateDAO extends GenericHibernateDAO +implements TipoDocAutobusDAO { + @Autowired + public TipoDocAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDomicilioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDomicilioHibernateDAO.java new file mode 100644 index 000000000..c73b57929 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDomicilioHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoDomicilioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoDomicilioDAO") +public class TipoDomicilioHibernateDAO extends GenericHibernateDAO + implements TipoDomicilioDAO { + + @Autowired + public TipoDomicilioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String desctipo, String cvetipodomicilio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("desctipo", desctipo)); + c.add(Restrictions.eq("cvetipodomicilio", cvetipodomicilio)); + + return c.list(); + } + + public List buscarClave(String cvetipodomicilio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cvetipodomicilio", cvetipodomicilio)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEmpleadoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEmpleadoHibernateDAO.java new file mode 100644 index 000000000..955acce24 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEmpleadoHibernateDAO.java @@ -0,0 +1,42 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoEmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; + +/** + * + * @author Shiro + */ +@Repository("tipoEmpleadoDAO") +public class TipoEmpleadoHibernateDAO extends GenericHibernateDAO +implements TipoEmpleadoDAO{ + + + @Autowired + public TipoEmpleadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraEmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraEmpresaHibernateDAO.java new file mode 100644 index 000000000..1b3901701 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraEmpresaHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; + +@Repository("tipoEventoExtraEmpresaDAO") +public class TipoEventoExtraEmpresaHibernateDAO extends GenericHibernateDAO implements +TipoEventoExtraEmpresaDAO { + + @Autowired + public TipoEventoExtraEmpresaHibernateDAO ( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + + return c.list(); + } + + @Override + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("tipoeventoextra", tipoeventoextra)); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraHibernateDAO.java new file mode 100644 index 000000000..dd3d95e90 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +@Repository("tipoEventoExtraDAO") +public class TipoEventoExtraHibernateDAO extends + GenericHibernateDAO implements + TipoEventoExtraDAO { + + @Autowired + public TipoEventoExtraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(String nombIngreso) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descTipoEvento", nombIngreso)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoIdentificacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoIdentificacionHibernateDAO.java new file mode 100644 index 000000000..d3bfe465a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoIdentificacionHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoIdentificacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; + +@Repository("tipoIdentificacionDAO") +public class TipoIdentificacionHibernateDAO extends GenericHibernateDAO implements TipoIdentificacionDAO { + + @Autowired + public TipoIdentificacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java new file mode 100644 index 000000000..5a11108c6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +@Repository("tipoMovimentacionDAO") +public class TipoMovimentacionHibernateDAO extends GenericHibernateDAO implements TipoMovimentacionDAO { + + @Autowired + public TipoMovimentacionHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public TipoMovimentacion buscarTipoMovimentacio(int tipoMovimentacion) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipomovimentacionId", tipoMovimentacion)); + + return (TipoMovimentacion) c.uniqueResult(); + + } + + @Override + public List obtenerTiposMovimetacionPuntoVenta() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("tipomovimentacionId", new Integer[]{TipoMovimentacion.TIPO_ENVIO, TipoMovimentacion.TIPO_TRANSFERENCIA, TipoMovimentacion.TIPO_VOLVER})); + + return c.list(); + } + + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimientoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimientoHibernateDAO.java new file mode 100644 index 000000000..29851bd86 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimientoHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoMovimientoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoMovimientoDAO") +public class TipoMovimientoHibernateDAO extends GenericHibernateDAO + implements TipoMovimientoDAO { + + @Autowired + public TipoMovimientoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descmovimiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descmovimiento", descmovimiento)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoOcupacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoOcupacionHibernateDAO.java new file mode 100644 index 000000000..c7e47be47 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoOcupacionHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoOcupacionDAO") +public class TipoOcupacionHibernateDAO extends GenericHibernateDAO + implements TipoOcupacionDAO { + + @Autowired + public TipoOcupacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String desctipo, String cvetipoocupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("desctipo", desctipo)); + c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + + return c.list(); + } + + public List buscarClave(String cvetipoocupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoParadaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoParadaHibernateDAO.java new file mode 100644 index 000000000..4204f6f44 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoParadaHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoParadaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoParadaDAO") +public class TipoParadaHibernateDAO extends GenericHibernateDAO + implements TipoParadaDAO { + + @Autowired + public TipoParadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipo")); + + return c.list(); + } + + public List buscar(String desctipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipo", desctipo)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoPuntoVentaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..cd0468577 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoPuntoVentaHibernateDAO.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoPuntoVentaDAO") +public class TipoPuntoVentaHibernateDAO extends GenericHibernateDAO implements TipoPuntoVentaDAO { + + @Autowired + public TipoPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipo")); + + return c.list(); + } + + public List buscar(String desctipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipo", desctipo)); + + return c.list(); + } + + @Override + public List obtenerTodosExceto(Short... id) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipo")); + c.add(Restrictions.not(Restrictions.in("tipoptovtaId", id))); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoServicioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoServicioHibernateDAO.java new file mode 100644 index 000000000..5dc343d23 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoServicioHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("tipoServicioDAO") +public class TipoServicioHibernateDAO extends GenericHibernateDAO + implements TipoServicioDAO { + + @Autowired + public TipoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descservicio")); + + return c.list(); + } + + public List buscar(String descservicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descservicio", descservicio)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoTarifaPacoteHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoTarifaPacoteHibernateDAO.java new file mode 100644 index 000000000..605fd37f4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoTarifaPacoteHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoTarifaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +@Repository("tipoTarifaPacoteDAO") +public class TipoTarifaPacoteHibernateDAO extends GenericHibernateDAO + implements TipoTarifaPacoteDAO { + + @Autowired + public TipoTarifaPacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipotarifa")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaTipoTarifaPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select pt.tipoTarifaPacote "); + sb.append(" from PacoteTarifa pt "); + sb.append(" where pt.pacote.pacoteId = :pacoteId "); + sb.append(" and pt.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoVentaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoVentaHibernateDAO.java new file mode 100644 index 000000000..898410ece --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoVentaHibernateDAO.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("tipoVentaDAO") +public class TipoVentaHibernateDAO extends GenericHibernateDAO + implements TipoVentaDAO { + + @Autowired + public TipoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipoventa")); + + return c.list(); + } + + public List buscar(String desctipoventa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipoventa", desctipoventa)); + + return c.list(); + } + + public TipoVenta obtenerID(Short tipoventaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("tipoventaId", tipoventaId)); + + return (TipoVenta) c.uniqueResult(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoHibernateDAO.java new file mode 100644 index 000000000..50a8b9a93 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoHibernateDAO.java @@ -0,0 +1,174 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; + +/** + * + * @author Administrador + */ +@Repository("tramoDAO") +public class TramoHibernateDAO extends GenericHibernateDAO + implements TramoDAO { + + @Autowired + public TramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + return c.list(); + } + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Tramo t = new Tramo(); + if (c.list().size() > 0) { + t = (Tramo) c.list().get(0); + } + + return t; + } + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via via) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("via", via)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (Tramo) c.uniqueResult(); + } + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + return c.list(); + } + + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + c.setFetchMode("origem", FetchMode.SELECT); + c.setFetchMode("destino", FetchMode.SELECT); + c.setFetchMode("lsTramoTiempo", FetchMode.SELECT); + c.setFetchMode("rutaSecuenciaList", FetchMode.SELECT); + c.setFetchMode("rutaCombinacionList", FetchMode.SELECT); + c.setFetchMode("tramoServicioList", FetchMode.SELECT); + c.setFetchMode("tramoKms", FetchMode.SELECT); + + return c.list(); + } + + // Obtener Vias Possiveis + public List obtenerViasOrigemDestino(Parada origem, Parada destino) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + c.setProjection(Projections.property("via")); + + return c.list(); + } + + public Tramo busca(Parada origem, Parada destino, Via via) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("via", via)); + + return (Tramo) c.uniqueResult(); + } + + public List buscarCveParada(String origen, String destino, String via) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.createCriteria("origem").add(Restrictions.eq("paradaId", Integer.parseInt(origen))); + c.createCriteria("destino").add(Restrictions.eq("paradaId", Integer.parseInt(destino))); + c.createCriteria("via").add(Restrictions.eq("viaId", Integer.parseInt(via))); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, + ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("via", via)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setFetchMode("origem", FetchMode.LAZY); + c.setFetchMode("destino", FetchMode.LAZY); + c.setFetchMode("lsTramoTiempo", FetchMode.LAZY); + c.setFetchMode("rutaSecuenciaList", FetchMode.LAZY); + c.setFetchMode("rutaCombinacionList", FetchMode.LAZY); + c.setFetchMode("tramoServicioList", FetchMode.LAZY); + c.setFetchMode("tramoKms", FetchMode.LAZY); + + Criteria c2 = c.createCriteria("tramoServicioList"); + c2.add(Restrictions.eq("claseServicio", claseServicio)); + c2.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setMaxResults(1); + List result = c.list(); + + if (result.isEmpty()) { + return null; + } + + return result.get(0); + } + + public Long count(Via via) { + Criteria c = this.makeCriteria(); + + c.add(Restrictions.eq("via", via)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoKmServicioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoKmServicioHibernateDAO.java new file mode 100644 index 000000000..8d2ad8483 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoKmServicioHibernateDAO.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TramoKmServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("tramoKmServicioDAO") +public class TramoKmServicioHibernateDAO extends GenericHibernateDAO + implements TramoKmServicioDAO { + + @Autowired + public TramoKmServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(TramoKmServicio tramoKmServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramoKmServicio.getTramo())); + c.add(Restrictions.eq("claseServicio", tramoKmServicio.getClaseServicio())); + c.add(Restrictions.eq("empresa", tramoKmServicio.getEmpresa())); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoServicioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoServicioHibernateDAO.java new file mode 100644 index 000000000..44b782a2b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoServicioHibernateDAO.java @@ -0,0 +1,95 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +/** + * + * @author Rafius + */ +@Repository("tramoServicioDAO") +public class TramoServicioHibernateDAO extends GenericHibernateDAO + implements TramoServicioDAO { + + @Autowired + public TramoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorTramo(Tramo tramo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", clase)); + + return c.list(); + } + + @Override + public TramoServicio buscar(Parada origen, Parada destino, Via via, ClaseServicio clase) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + Criteria cTramo = c.createCriteria("tramo"); + cTramo.add(Restrictions.eq("origem", origen)); + cTramo.add(Restrictions.eq("destino", destino)); + cTramo.add(Restrictions.eq("via", via)); + cTramo.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("claseServicio", clase)); + + return (TramoServicio) c.uniqueResult(); + + } + + @Override + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId) { + + Query query = getSession().createQuery("select count(*) from EsquemaTramo ct where ct.activo = 1 and ct.esquemaCorrida.esquemacorridaId = :esquemaCorrida"); + query.setParameter("esquemaCorrida", esquemaCorridaId); + Long cantTramos = HibernateFix.count(query.uniqueResult()); + + StringBuilder sb = new StringBuilder(""); + sb.append("select count(*) "); + sb.append("from "); + sb.append("esquema_corrida ec "); + sb.append("inner join esquema_tramo et on et.esquemacorrida_id = ec.esquemacorrida_id "); + sb.append("inner join tramo_servicio ts on ts.tramo_id = et.tramo_id and ts.CLASESERVICIO_ID = ec.CLASESERVICIO_ID "); + sb.append("where "); + sb.append("et.activo = 1 "); + sb.append("and ts.activo = 1 "); + sb.append("and ec.esquemacorrida_id = :esquemaCorrida"); + + Query query2 = getSession().createSQLQuery(sb.toString()); + query2.setParameter("esquemaCorrida", esquemaCorridaId); + + Long cantTramosTiempos = HibernateFix.count(query2.uniqueResult()); + + return cantTramos.equals(cantTramosTiempos); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoTiempoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoTiempoHibernateDAO.java new file mode 100644 index 000000000..45d7dad92 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoTiempoHibernateDAO.java @@ -0,0 +1,95 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TramoTiempoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tramoTiempoDAO") +public class TramoTiempoHibernateDAO extends GenericHibernateDAO implements TramoTiempoDAO { + + @Autowired + public TramoTiempoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", clase)); + + return c.list(); + } + + @Override + public List buscar(Tramo tramo, ClaseServicio clase, Date horaIni, Date horaFin) { + + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", clase)); + + Calendar tmpIni = Calendar.getInstance(); + tmpIni.setTime(horaIni); + + Calendar tmpFin = Calendar.getInstance(); + tmpFin.setTime(horaFin); + + Calendar fecInicio = DateUtil.getFecInicio(); + fecInicio.set(Calendar.HOUR_OF_DAY, tmpIni.get(Calendar.HOUR_OF_DAY)); + fecInicio.set(Calendar.MINUTE, tmpIni.get(Calendar.MINUTE)); + + Calendar fecFin = DateUtil.getFecInicio(); + fecFin.set(Calendar.HOUR_OF_DAY, tmpFin.get(Calendar.HOUR_OF_DAY)); + fecFin.set(Calendar.MINUTE, tmpFin.get(Calendar.MINUTE)); + + if (fecFin.compareTo(fecInicio) < 0){// se a data fin é menor que a data inicio (considerando a hora), é porque é no dia seguinte. Ex.: Intervalo 23:00 à 00:00 + fecFin.add(Calendar.DATE, 1); + } + + c.add(Restrictions.ge("horafin",fecInicio.getTime())); + c.add(Restrictions.le("horainicio",fecFin.getTime())); + + return c.list(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TurnoHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TurnoHibernateDAO.java new file mode 100644 index 000000000..bdfb2260c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/TurnoHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TurnoDAO; +import com.rjconsultores.ventaboletos.entidad.Turno; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("turnoDAO") +public class TurnoHibernateDAO extends GenericHibernateDAO + implements TurnoDAO { + + @Autowired + public TurnoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descturno) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descturno", descturno)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioBancarioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioBancarioHibernateDAO.java new file mode 100644 index 000000000..c78fee960 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioBancarioHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.UsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("usuarioBancarioDAO") +public class UsuarioBancarioHibernateDAO extends GenericHibernateDAO + implements UsuarioBancarioDAO { + + @Autowired + public UsuarioBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java new file mode 100644 index 000000000..7d5b1b64a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java @@ -0,0 +1,75 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.UsuarioEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; + + +@Repository("usuarioEmpresaDAO") +public class UsuarioEmpresaHibernateDAO extends GenericHibernateDAO + implements UsuarioEmpresaDAO { + + @Autowired + public UsuarioEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuarioLog", usuario)); + + return c.list(); + } + + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("usuarioLog", usuario)); + if(!c.list().isEmpty()){ + return true; + }else{ + return false; + } + } + + public List obtenerEmpresa(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuarioLog", usuario)); + List usuarioEmpresaList = c.list(); + List empresaList = new ArrayList(); + if(!usuarioEmpresaList.isEmpty()){ + for(UsuarioEmpresa ue : usuarioEmpresaList){ + empresaList.add(ue.getEmpresa()); + } + } + return empresaList; + } + + + + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioHibernateDAO.java new file mode 100644 index 000000000..2cdfba8a0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioHibernateDAO.java @@ -0,0 +1,111 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.UsuarioDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO; + +/** + * + * @author rodrigo + */ +@Repository("usuarioDAO") +public class UsuarioHibernateDAO extends GenericHibernateDAO implements UsuarioDAO { + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public UsuarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPeloNome(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombusuario", nome)); + c.addOrder(Order.asc("nombusuario")); + + return c.list(); + } + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("claveUsuario", stUsuario)); + c.add(Restrictions.eq("senha", senha)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (Usuario) c.uniqueResult(); + } + + public List buscarPorEmpleado(Empleado empleado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empleado", empleado)); + + return c.list(); + } + + public List buscarPelaCveUsuario(String cveUsuario) { + Query query = getSession().createQuery("select u from Usuario u where u.activo =1 and u.claveUsuario = :clave order by u.claveUsuario"); + query.setParameter("clave", cveUsuario); + + return query.list(); + } + + @SuppressWarnings("unchecked") + public List buscarUsuariosActivo() { + String sqlBuscarUsuariosActivo = sqlBuilder.getSQLBuscarUsuariosActivo(); + + SQLQuery sql = getSession().createSQLQuery(sqlBuscarUsuariosActivo) + .addScalar("usuarioId", IntegerType.INSTANCE) + .addScalar("cveusuario", StringType.INSTANCE) + .addScalar("nombusuario", StringType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(UsuarioActivoVO.class)); + + return sql.list(); + } + + @Override + @SuppressWarnings("unchecked") + public List buscarPeloNomeLike(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.like("nombusuario", nome, MatchMode.START)); + c.addOrder(Order.asc("nombusuario")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioPerfilHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioPerfilHibernateDAO.java new file mode 100644 index 000000000..15b32f0c7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioPerfilHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("usuarioPerfilDAO") +public class UsuarioPerfilHibernateDAO extends GenericHibernateDAO + implements UsuarioPerfilDAO { + + @Autowired + public UsuarioPerfilHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario", usuario)); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioSesionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioSesionHibernateDAO.java new file mode 100644 index 000000000..2cdb2a0c5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioSesionHibernateDAO.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.UsuarioSesionDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; + +/** + * + * @author RJ Consultores + */ +@Repository("usuarioSesionDAO") +public class UsuarioSesionHibernateDAO extends GenericHibernateDAO implements UsuarioSesionDAO { + private static Logger log = Logger.getLogger(UsuarioSesionHibernateDAO.class); + + @Autowired + public UsuarioSesionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(Usuario usuario) { + return this.findByCriteria(Restrictions.eq("usuario", usuario),Restrictions.eq("activo", Boolean.TRUE)); + } + + @Override + public void liberarUsuario(Usuario usuario) { + Query query = getSession().createQuery("UPDATE UsuarioSesion set indFirmado = false where usuario =:usuario"); + query.setParameter("usuario", usuario); + int i = query.executeUpdate(); + log.info("qtdLiberada="+i); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java new file mode 100644 index 000000000..4d36b62ed --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("usuarioUbicacionDAO") +public class UsuarioUbicacionHibernateDAO extends GenericHibernateDAO + implements UsuarioUbicacionDAO { + + @Autowired + public UsuarioUbicacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario", usuario)); + + return c.list(); + } + + @Override + public List buscarPuntoVentaPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario", usuario)); + c.setProjection(Property.forName("puntoVenta")); + c.createAlias("puntoVenta", "ptovta"); + c.addOrder(Order.asc("ptovta.nombpuntoventa")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ViaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ViaHibernateDAO.java new file mode 100644 index 000000000..1c19dd3bc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/ViaHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ViaDAO; +import com.rjconsultores.ventaboletos.entidad.Via; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("viaDAO") +public class ViaHibernateDAO extends GenericHibernateDAO + implements ViaDAO { + + @Autowired + public ViaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombvia")); + + return c.list(); + } + + public List buscar(String nombvia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombvia", nombvia)); + c.addOrder(Order.asc("nombvia")); + + return c.list(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/VigenciaTarifaHibernateDAO.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/VigenciaTarifaHibernateDAO.java new file mode 100644 index 000000000..388b51f14 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/VigenciaTarifaHibernateDAO.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.VigenciaTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("vigenciaTarifaDAO") +public class VigenciaTarifaHibernateDAO extends + GenericHibernateDAO implements + VigenciaTarifaDAO { + + @Autowired + public VigenciaTarifaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("feciniciovigencia")); + + return c.list(); + } + + @Override + public List pesquisar(Date inicio, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (inicio != null) { + c.add(Restrictions.eq("feciniciovigencia", inicio)); + } + + if (fim != null) { + c.add(Restrictions.eq("fecfinvigencia", fim)); + } + + return c.list(); + } + + @Override + public List buscarVigenciasIntervalo(VigenciaTarifa vt) { + + Calendar feciniciovigencia = Calendar.getInstance(); + feciniciovigencia.setTime(vt.getFeciniciovigencia()); + feciniciovigencia.set(Calendar.MILLISECOND, 0); + + Calendar fecfinvigencia = Calendar.getInstance(); + fecfinvigencia.setTime(vt.getFecfinvigencia()); + fecfinvigencia.set(Calendar.MILLISECOND, 0); + + + + Criteria c = this.getSession().createCriteria(VigenciaTarifa.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfinvigencia", feciniciovigencia.getTime())); + c.add(Restrictions.le("feciniciovigencia", fecfinvigencia.getTime())); + + return c.list(); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/sqlfunction/FnArredondamentoTarifa.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/sqlfunction/FnArredondamentoTarifa.java new file mode 100644 index 000000000..06c45fc49 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/hibernate/sqlfunction/FnArredondamentoTarifa.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.dao.hibernate.sqlfunction; + +import java.util.List; + +import org.hibernate.QueryException; +import org.hibernate.dialect.function.SQLFunction; +import org.hibernate.engine.Mapping; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.type.IntegerType; +import org.hibernate.type.Type; + +import com.rjconsultores.ventaboletos.dao.util.DBUtil; + +public class FnArredondamentoTarifa implements SQLFunction { + + @Override + public Type getReturnType(Type arg0, Mapping arg1) throws QueryException { + return new IntegerType(); + } + + @Override + public boolean hasArguments() { + return true; + } + + @Override + public boolean hasParenthesesIfNoArguments() { + return true; + } + + + public String render(List args, SessionFactoryImplementor arg1) throws QueryException { + if (args.size() != 6) { + throw new QueryException("Para o arredondamento de preço são necessário 6 parametros"); + } + + if (DBUtil.getInstance().isOracle()){ + return " FN_ARREDONDAMENTO_TARIFA(" + args.get(0) + ", " + args.get(1) + ", " + args.get(2) +", " + args.get(3) +", " + args.get(4) +", " + args.get(5) + ")"; + } + + throw new QueryException("Ainda não existe a traduação da função de arredondamento para o banco usado"); + + } + + + public String render(Type arg0, List arg1, SessionFactoryImplementor arg2) throws QueryException { + return render(arg1, arg2); + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java new file mode 100644 index 000000000..072bbd469 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java @@ -0,0 +1,111 @@ +package com.rjconsultores.ventaboletos.dao.sqlbuilder; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.vo.caja.CajaVO; + +/** + * Interface que indica quais são os SQL nativos da aplicação. + * + * Cada método representa um SQL nativo que deve ser implementado de acordo com a base de dados. + * + * O padrão para a clase é retornar o SQL nativo para o conjunto de parametros + * + * + * @author gleimar + * + */ +public interface SQLBuilder { + + public String getSQLGerarTarifaOficial(Integer codRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLGerarTabelaZerada(Integer codRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarTarifaOficial(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId); + + public String getSQLGerarTarifaOficialArtesp( Integer codRuta, Integer usuarioId, + Integer orgaoConcedenteId, List idsEmpresas); + + public String getAtualizarTaxaEmbarquePorKmParada(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarTaxaEmbarquePorKmOrgao(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarTaxaEmbarquePorParadaFixo(Integer rutaId, Integer usuarioId,Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarSeguroPorKm(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId); + + public String getSQLAtualizarSeguroPorTarifa(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId); + + public String getSQLAtualizarTarifaPorTarifaOfical(Integer vigenciaTarifaId, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro); + + public String getSQLInserirTarifaPelaTarifaOficial(Integer vigenciaTarifaId, Integer usuarioId); + + public String getSQLActualizarCorridaFecHusoFecVerano(); + + public String getSQLActualizarCorridaTramoFecHusoFecVerano(); + + public String getSQLBuscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta); + + public String getSQLBuscarUsuariosCajaCerrado(Date fecha, String cveusuario, String turnoid); + + public String getSQLBuscarCajaCerrado(Integer usuarioId, Date fecha, String turnoid); + + public String getSQLBuscarReceitasDespesasCaja(Integer usuarioId, Date fec); + + public String getSQLBuscarUsuariosActivo(); + + /** + * Venda Embarcada + * @return Retorna a Query para a inserção dos valores da venda na tabela de Caja + */ + public String getSQLInserirCajaVendaEmbarcada(); + + /** + * Venda Embarcada + * @return Retorna a Query para a inserção dos valores da venda na tabela de CajaFormaPago + */ + public String getSQLInserirCajaFormaPagoVendaEmbarcada(); + + /** + * Venda Embarcada + * @return Retorna a Query para a inserção dos valores da venda na tabela de Boleto + */ + public String getSQLInserirBoletoVendaEmbarcada(); + + /** + * Venda Embarcada + * @return Retorna a Query para a inserção dos valores da venda na tabela de BoletoFormaPago + */ + public String getSQLInserirBoletoFormaPagoVendaEmbarcada(); + + /** + * + * @return Retorna o valor gerado pela sequence para a tabela BoletoFormaPago + */ + public String getSQLObterSequenceBoletoFormaPago(); + + /** + * + * @return Retorna o valor gerado pela sequence para a tabela CajaFormaPago + */ + public String getSQLObterSequenceCajaFormaPago(); + + /** + * + * @return Retorna o valor gerado pela sequence da tabela Boleto + */ + public String getSQLObterSequenceBoleto(); + + /** + * + * @return Retorna o valor gerado pela sequence da tabela Caja + */ + public String getSQLObterSequenceCaja(); + + /** + * + * @return Retorna o valor gerado pela sequence do Numero de Operacao + */ + public String getSQLObterSequenciaNumOperacion(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLFactory.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLFactory.java new file mode 100644 index 000000000..f1a40bb2e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLFactory.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao.sqlbuilder; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.dao.sqlbuilder.impl.SQLBuilderOracle; +import com.rjconsultores.ventaboletos.dao.util.DBUtil; + +public class SQLFactory { + private static Logger log = Logger.getLogger(SQLFactory.class); + + public SQLBuilder getBuilder() { + if (DBUtil.getInstance().isOracle()) { + return new SQLBuilderOracle(); + } + + throw new RuntimeException("Não foi localizado a classe que traduz SQL Nativos"); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java new file mode 100644 index 000000000..896b5fdc1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java @@ -0,0 +1,1087 @@ +package com.rjconsultores.ventaboletos.dao.sqlbuilder.impl; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.dao.util.DBUtil; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; + +public class SQLBuilderOracle implements SQLBuilder { + private static final Integer HORAS_NO_DIA = Integer.valueOf(24); + private static final Integer RED_PAGO_FORMAPAGO_ID = Integer.valueOf(95); + private static final String RED_PAGO_EMISSOR_TARJETA = "RDP"; + private static final String RED_PAGO_FORMA_PAGO = "CR"; + + @Override + public String getSQLGerarTabelaZerada(final Integer codRuta, final Integer usuarioId,final Integer orgaoConcedenteId, final List idsEmpresas){ + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT "); + sb.append("INTO "); + sb.append(" TARIFA_OFICIAL "); + sb.append(" ( "); + sb.append(" TARIFAOFICIAL_ID, "); + sb.append(" PRECIO, "); + sb.append(" PRECIOORIGINAL, "); + sb.append(" TRAMO_ID, "); + sb.append(" MARCA_ID, "); + sb.append(" CLASESERVICIO_ID, "); + sb.append(" PRECIOREDABIERTO, "); + sb.append(" MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, "); + sb.append(" STATUSTARIFA, "); + sb.append(" IMPORTETAXAEMBARQUE, "); + sb.append(" IMPORTEPEDAGIO, "); + sb.append(" IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, "); + sb.append(" ORGAOCONCEDENTE_ID, "); + sb.append(" RUTA_ID, "); + sb.append(" ACTIVO, "); + sb.append(" FECMODIF, "); + sb.append(" USUARIO_ID, "); + sb.append(" ORIGEN_ID, "); + sb.append(" DESTINO_ID "); + sb.append(" ) "); + sb.append(" select "); + sb.append(" "); + sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, "); + sb.append(" 0, "); + sb.append(" 0, "); + sb.append(" t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" null, "); + sb.append(" m.moneda_id, "); + sb.append(" null, "); + sb.append(" 'A', "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" oc.orgaoconcedente_id, "); + sb.append(" r.ruta_id, "); + sb.append(" 1, "); + sb.append(" ").append(DBUtil.getInstance().dbSysdate()).append(", "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id "); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join ruta_empresa re on r.ruta_id = re.ruta_id "); + sb.append(" inner join marca ma on ma.empresa_id = re.empresa_id "); + sb.append(" inner join orgao_concedente oc on oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on "); + sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + sb.append(" rc.activo = 1 "); + if (codRuta != null) { + sb.append(" and r.ruta_id = ").append(codRuta); + } + sb.append(" and r.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and mc.activo = 1 "); + sb.append(" and re.activo = 1 "); + if (idsEmpresas != null) { + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedenteId != null) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + sb.append(" and "); + sb.append(" (t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" m.moneda_id, "); + sb.append(" oc.orgaoconcedente_id, r.ruta_id) "); + sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); + sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); + sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + + return sb.toString(); + } + + @Override + public String getSQLGerarTarifaOficialArtesp(final Integer codRuta, final Integer usuarioId, + final Integer orgaoConcedenteId, final List idsEmpresas) + { + StringBuilder sb = new StringBuilder(); + sb.append(" INSERT "); + sb.append(" INTO "); + sb.append(" TARIFA_OFICIAL "); + sb.append(" ( "); + sb.append(" TARIFAOFICIAL_ID, "); + sb.append(" PRECIO, "); + sb.append(" PRECIOORIGINAL, "); + sb.append(" TRAMO_ID, "); + sb.append(" MARCA_ID, "); + sb.append(" CLASESERVICIO_ID, "); + sb.append(" PRECIOREDABIERTO, "); + sb.append(" MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, "); + sb.append(" STATUSTARIFA, "); + sb.append(" IMPORTETAXAEMBARQUE, "); + sb.append(" IMPORTEPEDAGIO, "); + sb.append(" IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, "); + sb.append(" ORGAOCONCEDENTE_ID, "); + sb.append(" RUTA_ID, "); + sb.append(" ACTIVO, "); + sb.append(" FECMODIF, "); + sb.append(" USUARIO_ID, "); + sb.append(" ORIGEN_ID, "); + sb.append(" DESTINO_ID "); + sb.append(" ) "); + sb.append(" select "); + sb.append(" "); + sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, "); + + sb.append(" ROUND( "); + sb.append(" ("); + sb.append(" "); + sb.append(" case ( coalesce((select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) , 0 )) when 0 then"); + sb.append(" (select max( tkm.valortaxa ) from Tarifa_km tkm where tkm.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tkm.activo = 1)"); + sb.append(" else"); + sb.append(" (select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) end"); + sb.append(" ) "); + sb.append(" ,2), "); + + sb.append(" ROUND( "); + sb.append(" ("); + sb.append(" "); + sb.append(" case ( coalesce((select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) , 0 )) when 0 then"); + sb.append(" (select max( tkm.valortaxa ) from Tarifa_km tkm where tkm.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tkm.activo = 1)"); + sb.append(" else"); + sb.append(" (select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) end"); + sb.append(" ) "); + sb.append(" ,2), "); + + sb.append(" t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" null, "); + sb.append(" m.moneda_id, "); + sb.append(" null, "); + sb.append(" 'A', "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" oc.orgaoconcedente_id, "); + sb.append(" r.ruta_id, "); + sb.append(" 1, "); + sb.append(" ").append(DBUtil.getInstance().dbSysdate()).append(", "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id "); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join ruta_empresa re on r.ruta_id = re.ruta_id "); + sb.append(" inner join marca ma on ma.empresa_id = re.empresa_id "); + //sb.append(" and tc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tc.activo =1 "); + sb.append(" inner join orgao_concedente oc on oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id and t.activo =1");//adicionei isso t.activo =1"); + // sb.append(" inner join orgao_tramo tc on tc.tramo_id = rc.tramo_id ");// + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on "); + sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + + sb.append(" rc.activo = 1 "); + if (codRuta != null) { + sb.append(" and r.ruta_id = ").append(codRuta); + } + sb.append(" and r.activo = 1 "); + // sb.append(" and tc.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and mc.activo = 1 "); + sb.append(" and re.activo = 1 "); + sb.append(" and r.orgaoconcedente_id = 21 "); + if (idsEmpresas != null) { + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedenteId != null) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + sb.append(" and "); + sb.append(" (t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" m.moneda_id, "); + sb.append(" oc.orgaoconcedente_id, r.ruta_id) "); + sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); + sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); + sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + + return sb.toString(); + } + + @Override + public String getSQLGerarTarifaOficial(final Integer codRuta, final Integer usuarioId, + final Integer orgaoConcedenteId, final List idsEmpresas) { + + StringBuilder sb = new StringBuilder(); + sb.append(" INSERT "); + sb.append(" INTO "); + sb.append(" TARIFA_OFICIAL "); + sb.append(" ( "); + sb.append(" TARIFAOFICIAL_ID, "); + sb.append(" PRECIO, "); + sb.append(" PRECIOORIGINAL, "); + sb.append(" TRAMO_ID, "); + sb.append(" MARCA_ID, "); + sb.append(" CLASESERVICIO_ID, "); + sb.append(" PRECIOREDABIERTO, "); + sb.append(" MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, "); + sb.append(" STATUSTARIFA, "); + sb.append(" IMPORTETAXAEMBARQUE, "); + sb.append(" IMPORTEPEDAGIO, "); + sb.append(" IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, "); + sb.append(" ORGAOCONCEDENTE_ID, "); + sb.append(" RUTA_ID, "); + sb.append(" ACTIVO, "); + sb.append(" FECMODIF, "); + sb.append(" USUARIO_ID, "); + sb.append(" ORIGEN_ID, "); + sb.append(" DESTINO_ID "); + sb.append(" ) "); + sb.append(" select "); + sb.append(" "); + sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, "); + + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ,"); + + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) ,"); + + sb.append(" t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" null, "); + sb.append(" m.moneda_id, "); + sb.append(" null, "); + sb.append(" 'A', "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" oc.orgaoconcedente_id, "); + sb.append(" r.ruta_id, "); + sb.append(" 1, "); + sb.append(" ").append(DBUtil.getInstance().dbSysdate()).append(", "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id "); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join ruta_empresa re on r.ruta_id = re.ruta_id "); + sb.append(" inner join marca ma on ma.empresa_id = re.empresa_id "); + sb.append(" inner join orgao_tramo tc on tc.tramo_id = rc.tramo_id "); + sb.append(" and tc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tc.activo =1 "); + sb.append(" inner join orgao_concedente oc on "); + sb.append(" oc.orgaoconcedente_id = tc.orgaoconcedente_id "); + sb.append(" and oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join coeficiente_tarifa ct1 on ct1.coeficientetarifa_id = tc.coeficientetarifa1_id "); + sb.append(" left join coeficiente_tarifa ct2 on ct2.coeficientetarifa_id = tc.coeficientetarifa2_id "); + sb.append(" left join coeficiente_tarifa ct3 on ct3.coeficientetarifa_id = tc.coeficientetarifa3_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on "); + sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + sb.append(" rc.activo = 1 "); + if (codRuta != null) { + sb.append(" and r.ruta_id = ").append(codRuta); + } + sb.append(" and r.activo = 1 "); + sb.append(" and tc.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and mc.activo = 1 "); + sb.append(" and re.activo = 1 "); + sb.append(" and r.orgaoconcedente_id <> 21 "); + if(ApplicationProperties.getInstance().criarTarifaApenasTrechoVendido()){ + sb.append(" and rc.indventa = 1 "); + } + if (idsEmpresas != null) { + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedenteId != null) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + sb.append(" and "); + sb.append(" (t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" m.moneda_id, "); + sb.append(" oc.orgaoconcedente_id, r.ruta_id) "); + sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); + sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); + sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + + return sb.toString(); + } + + @Override + public String getSQLAtualizarTarifaOficial(final Integer rutaId, final Integer usuarioId, + final Integer orgaoConcedenteId) { + StringBuilder sb = new StringBuilder(""); + + sb.append("UPDATE TARIFA_OFICIAL SET PRECIO = "); + sb.append("( "); + sb.append("select "); + sb.append(" "); + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2)"); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join orgao_tramo tc on "); + sb.append(" tc.tramo_id = rc.tramo_id and tc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tc.activo =1 "); + sb.append(" inner join orgao_concedente oc on "); + sb.append(" oc.orgaoconcedente_id = tc.orgaoconcedente_id "); + sb.append(" and oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join coeficiente_tarifa ct1 on ct1.coeficientetarifa_id = tc.coeficientetarifa1_id "); + sb.append(" left join coeficiente_tarifa ct2 on ct2.coeficientetarifa_id = tc.coeficientetarifa2_id "); + sb.append(" left join coeficiente_tarifa ct3 on ct3.coeficientetarifa_id = tc.coeficientetarifa3_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + sb.append(" rc.activo = 1 "); + sb.append(" and r.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and tc.activo = 1 "); + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedenteId != null) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + sb.append(" and t.tramo_id = TARIFA_OFICIAL.tramo_id "); + sb.append(" and mc.marca_id = TARIFA_OFICIAL.marca_id "); + sb.append(" and r.CLASESERVICIO_ID = TARIFA_OFICIAL.CLASESERVICIO_ID "); + sb.append(" and m.moneda_id = TARIFA_OFICIAL.moneda_id "); + sb.append(" and oc.orgaoconcedente_id = TARIFA_OFICIAL.orgaoconcedente_id "); + sb.append(" and r.ruta_id = TARIFA_OFICIAL.ruta_id "); + sb.append(") "); + sb.append(" "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" activo = 1 "); + if (rutaId != null) { + sb.append(" and ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + return sb.toString(); + } + + @Override + public String getAtualizarTaxaEmbarquePorKmParada(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); + sb.append("( "); + sb.append("select "); + sb.append(" tepKm.valorTaxa "); + sb.append(" "); + sb.append(" "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join TAXA_EMBARQUE_PARADA tepKm on "); + sb.append(" tepKm.parada_id = t.origen_id and tepKm.KMATE >= "); + sb.append(" t.CANTKMREAL and tepKm.activo = 1 and tepKm.indtipo = 'K' "); + sb.append(" inner join marca m on m.marca_id = tao.marca_id "); + sb.append("where "); + sb.append(" tepKm.kmate= "); + sb.append(" (select min(tepKm1.KMATE) "); + sb.append(" from "); + sb.append(" TAXA_EMBARQUE_PARADA tepKm1 "); + sb.append(" where "); + sb.append(" tepKm1.parada_id = t.origen_id and tepKm1.KMATE >= t.CANTKMREAL and tepKm1.activo = 1 "); + sb.append(" ) "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.orgaoconcedente_id = tepKm.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + sb.append(" and tepKm.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + if (idsEmpresas != null) { + sb.append(" and m.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(") "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + + return sb.toString(); + } + + @Override + public String getSQLAtualizarTaxaEmbarquePorKmOrgao(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); + sb.append("coalesce( "); + sb.append("( "); + sb.append("select "); + sb.append(" tek.valorTaxa "); + sb.append(" "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join taxa_embarque_km tek on "); + sb.append(" tek.orgaoconcedente_id = tao.ORGAOCONCEDENTE_ID "); + sb.append(" and tek.activo = 1 and t.CANTKMREAL <= tek.kmate "); + sb.append(" inner join marca m on tao.marca_id = m.marca_id "); + sb.append("where "); + sb.append(" tek.kmate= "); + sb.append(" (select min(tek1.KMATE) "); + sb.append(" from "); + sb.append(" taxa_embarque_km tek1 "); + sb.append(" where "); + sb.append(" tek1.orgaoconcedente_id = tao.ORGAOCONCEDENTE_ID "); + sb.append(" and t.CANTKMREAL <= tek1.kmate and tek1.activo = 1 "); + sb.append(" ) "); + sb.append(" "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.orgaoconcedente_id = tek.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + + if (idsEmpresas != null) { + sb.append(" and m.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + + sb.append("),IMPORTETAXAEMBARQUE) "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + return sb.toString(); + } + + @Override + public String getSQLAtualizarTaxaEmbarquePorParadaFixo(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + StringBuilder sb = new StringBuilder(""); + + sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); + sb.append("coalesce( "); + sb.append("( "); + sb.append("select "); + sb.append(" tepFixo.valorTaxa "); + sb.append(" "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join TAXA_EMBARQUE_PARADA tepFixo on "); + sb.append(" tepFixo.parada_id = t.origen_id "); + sb.append(" and tepFixo.indtipo = 'F' and tepFixo.activo = 1 "); + sb.append(" inner join marca m on m.marca_id = tao.marca_id "); + sb.append("where "); + sb.append(" tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tepFixo.orgaoconcedente_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + if (idsEmpresas != null) { + sb.append(" and m.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append("),IMPORTETAXAEMBARQUE) "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + return sb.toString(); + } + + @Override + public String getSQLAtualizarSeguroPorKm(final Integer rutaId, final Integer usuarioId, + final Integer orgaoConcedenteId) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTESEGURO = "); + sb.append("( "); + sb.append("select "); + sb.append(" sk.VALORTAXA "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join seguro_km sk on "); + sb.append(" sk.KMATE >= t.CANTKMREAL and sk.activo = 1 "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = sk.ORGAOCONCEDENTE_ID "); + sb.append("where "); + sb.append(" sk.kmate= "); + sb.append(" (select min(sk1.KMATE) "); + sb.append(" from "); + sb.append(" seguro_km sk1 "); + sb.append(" where "); + sb.append(" sk1.KMATE >= t.CANTKMREAL and sk1.activo = 1 "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = sk1.ORGAOCONCEDENTE_ID "); + sb.append(" ) "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + sb.append(") "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + return sb.toString(); + } + + @Override + public String getSQLAtualizarSeguroPorTarifa(final Integer rutaId, final Integer usuarioId, + final Integer orgaoConcedenteId) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTESEGURO = "); + sb.append("( "); + sb.append("select "); + sb.append(" st.VALORTAXA "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join seguro_tarifa st on "); + sb.append(" st.VALORTARIFAATE >= tao.precio and st.activo = 1 "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = st.ORGAOCONCEDENTE_ID "); + sb.append("where "); + sb.append(" st.VALORTARIFAATE= "); + sb.append(" (select min(st1.VALORTARIFAATE) "); + sb.append(" from "); + sb.append(" seguro_tarifa st1 "); + sb.append(" where "); + sb.append(" st1.VALORTARIFAATE >= tao.precio and st1.activo = 1 "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = st1.ORGAOCONCEDENTE_ID "); + sb.append(" ) "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + sb.append(") "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + return sb.toString(); + } + + @Override + public String getSQLAtualizarTarifaPorTarifaOfical(final Integer vigenciaTarifaId, final Integer usuarioId, final Boolean calculaPegagio, final Boolean calculaTarifa, final Boolean calculaTaxaEmbarque, final Boolean calculaSeguro) { + StringBuilder sb = new StringBuilder(""); + sb.append("update ( "); + sb.append(" "); + sb.append("select "); + sb.append(" ta.precio as taprecio, "); + sb.append(" ta.preciooriginal as tapreciooriginal, "); + sb.append(" ta.importetaxaembarque as taimportetaxaembarque, "); + sb.append(" ta.importepedagio as taimportepedagio, "); + sb.append(" ta.importeoutros as taimporteoutros, "); + sb.append(" ta.importeseguro as taimporteseguro, "); + sb.append(" tao.precio as taoprecio, "); + sb.append(" tao.preciooriginal as taopreciooriginal, "); + sb.append(" tao.importetaxaembarque as taoimportetaxaembarque, "); + sb.append(" tao.importepedagio as taoimportepedagio, "); + sb.append(" tao.importeoutros as taoimporteoutros, "); + sb.append(" tao.importeseguro as taoimporteseguro, "); + sb.append(" ta.fecmodif as tafecmodif,ta.usuario_id as tausuario_id "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tarifa ta on "); + sb.append(" tao.marca_id = ta.marca_id "); + sb.append(" and tao.claseservicio_id = ta.claseservicio_id "); + sb.append(" and tao.tramo_id = ta.tramo_id "); + sb.append(" and tao.moneda_id = ta.moneda_id "); + sb.append(" and tao.ruta_id = ta.ruta_id "); + sb.append(" and tao.orgaoconcedente_id = ta.orgaoconcedente_id "); + sb.append("where "); + sb.append(" ta.vigenciatarifa_id = ").append(vigenciaTarifaId); + sb.append(" ) set "); + if (calculaPegagio) { + sb.append(" taimportepedagio = taoimportepedagio,"); + } + if (calculaTarifa) { + sb.append(" taprecio = taoprecio, "); + sb.append(" tapreciooriginal = taopreciooriginal, "); + } + if (calculaTaxaEmbarque) { + sb.append(" taimportetaxaembarque = taoimportetaxaembarque, "); + } + if (calculaSeguro) { + sb.append(" taimporteseguro = taoimporteseguro, "); + } + sb.append(" taimporteoutros = taoimporteoutros, "); + sb.append(" tafecmodif = current_timestamp, tausuario_id = ").append(usuarioId); + + return sb.toString(); + } + + @Override + public String getSQLInserirTarifaPelaTarifaOficial(final Integer vigenciaTarifaId, final Integer usuarioId) { + StringBuilder sb = new StringBuilder(""); + sb.append(" insert "); + sb.append(" into "); + sb.append(" TARIFA "); + sb.append(" ( TARIFA_ID, PRECIO, PRECIOREDABIERTO, TRAMO_ID, "); + sb.append(" MARCA_ID, CLASESERVICIO_ID, PRECIOORIGINAL, MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, STATUSTARIFA, ACTIVO, FECMODIF, "); + sb.append(" USUARIO_ID, IMPORTETAXAEMBARQUE, IMPORTEPEDAGIO, IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, ORGAOCONCEDENTE_ID, RUTA_ID, ORIGEN_ID, DESTINO_ID ) "); + sb.append(" select "); + sb.append(" TARIFA_SEQ.nextval, "); + sb.append(" tao.PRECIO , "); + sb.append(" tao.PRECIOREDABIERTO , "); + sb.append(" tao.TRAMO_ID , "); + sb.append(" tao.MARCA_ID , "); + sb.append(" tao.CLASESERVICIO_ID , "); + sb.append(" tao.PRECIOORIGINAL , "); + sb.append(" tao.MONEDA_ID , "); + sb.append(" v.VIGENCIATARIFA_ID , "); + sb.append(" tao.STATUSTARIFA , "); + sb.append(" tao.ACTIVO , "); + sb.append(" current_timestamp , "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" tao.IMPORTETAXAEMBARQUE , "); + sb.append(" tao.IMPORTEPEDAGIO , "); + sb.append(" tao.IMPORTEOUTROS , "); + sb.append(" tao.IMPORTESEGURO , "); + sb.append(" tao.ORGAOCONCEDENTE_ID , "); + sb.append(" tao.RUTA_ID , "); + sb.append(" tao.ORIGEN_ID , "); + sb.append(" tao.DESTINO_ID "); + sb.append(" from "); + sb.append(" TARIFA_OFICIAL tao, "); + sb.append(" VIGENCIA_TARIFA v "); + sb.append(" where "); + sb.append(" tao.ACTIVO=1 "); + sb.append(" and v.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append(" "); + sb.append(" and not (exists (select "); + sb.append(" tar.TARIFA_ID "); + sb.append(" from "); + sb.append(" TARIFA tar "); + sb.append(" where "); + sb.append(" tar.ACTIVO=1 "); + sb.append(" and tar.TRAMO_ID=tao.TRAMO_ID "); + sb.append(" and tar.MARCA_ID=tao.MARCA_ID "); + sb.append(" and tar.CLASESERVICIO_ID=tao.CLASESERVICIO_ID "); + sb.append(" and tar.MONEDA_ID=tao.MONEDA_ID "); + sb.append(" and tar.ORGAOCONCEDENTE_ID=tao.ORGAOCONCEDENTE_ID "); + sb.append(" and tar.RUTA_ID=tao.RUTA_ID "); + sb.append(" and tar.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append("))"); + + return sb.toString(); + } + + @Override + public String getSQLActualizarCorridaFecHusoFecVerano() { + + StringBuilder sb = new StringBuilder(); + + sb.append(" update Corrida cq "); + sb.append(" set cq.fechorSalidaOriginalH = "); + sb.append(" ( "); + sb.append(" select "); + sb.append(" c.fechorSalidaOriginal "); + sb.append(" + nvl((c.origem.ciudad.estado.tiempoHorHuso/").append(HORAS_NO_DIA).append("), 0) "); + sb.append(" + nvl( case when "); + sb.append(" c.fechorSalidaOriginal between "); + sb.append(" c.origem.ciudad.estado.fecInicioHorVerano "); + sb.append(" and c.origem.ciudad.estado.fecFinoHorVerano "); + sb.append(" then (c.origem.ciudad.estado.tiempoHorVerano/").append(HORAS_NO_DIA).append(") "); + sb.append(" else 0 end, 0) "); + sb.append(" from Corrida c "); + sb.append(" where c.id.corridaId in ( :corridaId ) "); + sb.append(" and c.id.feccorrida in ( :feccorrida ) "); + sb.append(" and c.id.corridaId = cq.id.corridaId "); + sb.append(" and c.id.feccorrida = cq.id.feccorrida "); + sb.append(" ) "); + sb.append(" where cq.id.corridaId in ( :corridaId ) "); + sb.append(" and cq.id.feccorrida in ( :feccorrida ) "); + + return sb.toString(); + } + + @Override + public String getSQLActualizarCorridaTramoFecHusoFecVerano() { + StringBuilder sb = new StringBuilder(); + + sb.append(" update CorridaTramo ctq "); + sb.append(" set ctq.fechorSalidaOriginalH = :fechorSalidaOriginalH, ctq.fechorsalidaH = :fechorsalidaH, ctq.fechorllegadaH = :fechorllegadaH"); + sb.append(" where ctq.corridatramoId = :corridatramoId "); + + return sb.toString(); + } + + @Override + public String getSQLBuscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select "); + sb.append(" "); + sb.append(" c.CAJA_ID as \"cajaId\", "); + sb.append(" c.NUMASIENTO as \"numAsiento\", "); + sb.append(" c.CATEGORIA_ID as \"categoriaId\", "); + sb.append(" c.NUMFOLIOSISTEMA as \"numFolioSistema\", "); + sb.append(" c.CLASESERVICIO_ID as \"claseServicioId\", "); + sb.append(" c.MARCA_ID as \"marcaId\", "); + sb.append(" c.ORIGEN_ID as \"origenId\", "); + sb.append(" c.DESTINO_ID as \"destinoId\", "); + sb.append(" c.CORRIDA_ID as \"corridaId\", "); + sb.append(" c.FECCORRIDA as \"fecCorrida\", "); + sb.append(" c.NOMBPASAJERO as \"nombPasajero\", "); + sb.append(" c.PRECIOBASE as \"precioBase\", "); + sb.append(" c.PRECIOPAGADO as \"precioPagado\", "); + sb.append(" c.TIPOVENTA_ID as \"tipoVentaId\", "); + sb.append(" c.NUMSERIEPREIMPRESA as \"numSeriePreimpresa\", "); + sb.append(" c.NUMFOLIOPREIMPRESO as \"numFolioPreImpreso\", "); + sb.append(" c.FECHORVIAJE as \"fecHorViaje\", "); + sb.append(" c.FECHORVENTA as \"fecHorVenta\", "); + sb.append(" c.PUNTOVENTA_ID as \"puntoVentaId\", "); + sb.append(" pv.numpuntoventa as \"numPuntoVenta\", "); + sb.append(" c.NUMKMVIAJE as \"numKmViaje\", "); + sb.append(" c.NUMOPERACION as \"numOperacion\", "); + sb.append(" c.MOTIVOCANCELACION_ID as \"motivoCancelacionId\", "); + sb.append(" c.EMPRESAPUNTOVENTA_ID as \"empresaPuntoVentaId\", "); + sb.append(" c.EMPRESACORRIDA_ID as \"empresaCorridaId\", "); + sb.append(" c.TURNO_ID as \"turnoId\", "); + sb.append(" c.IMPORTETAXAEMBARQUE as \"importeTaxaEmbarque\", "); + sb.append(" c.IMPORTEPEDAGIO as \"importePedagio\", "); + sb.append(" c.IMPORTEOUTROS as \"importeOutros\", "); + sb.append(" c.IMPORTESEGURO as \"importeSeguro\", "); + sb.append(" co.ruta_id as \"rutaId\", "); + sb.append(" c.usuario_id as \"usuarioId\", "); + sb.append(" ct.numautorizacion as \"numAutorizacion\", "); + sb.append(" (case when cfp.formapago_id = 11 then cdp.numdocumento else null end) as \"ordenSevicio\" "); + sb.append(" "); + sb.append(" from "); + sb.append(" caja c "); + sb.append(" left join corrida co on co.corrida_id = c.corrida_id and co.feccorrida = c.feccorrida "); + sb.append(" left join caja_formapago cfp on cfp.caja_id = c.caja_id "); + sb.append(" left join caja_det_pago cdp on cdp.cajaformapago_id = cfp.cajaformapago_id "); + sb.append(" left join caja_tarjeta ct on ct.cajadetpago_id = cdp.cajadetpago_id "); + sb.append(" left join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sb.append(" "); + sb.append(" where "); + sb.append(" trunc(fechorventa) between to_date('").append(sdf.format(fechaDesde)).append("','yyyy-MM-dd') and ").append(" to_date('").append(sdf.format(fechaHasta)).append("','yyyy-MM-dd')"); + sb.append(" and c.feccorte ").append(yaCerrado ? " is not null" : " is null "); + sb.append(" "); + sb.append(" order by c.fechorventa,c.usuario_id,c.caja_id asc "); + + return sb.toString(); + } + + @Override + public String getSQLBuscarUsuariosCajaCerrado(Date fecha, String cveusuario, String turnoid) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select distinct "); + sb.append(" "); + sb.append(" u.usuario_id as \"usuarioId\", "); + sb.append(" u.cveusuario as \"cveusuario\", "); + sb.append(" c.PUNTOVENTA_ID as \"puntoVentaId\", "); + sb.append(" pv.numpuntoventa as \"numPuntoVenta\", "); + sb.append(" c.FECCORTE as \"fecCorte\", "); + sb.append(" c.TURNO_ID as \"turnoId\", "); + sb.append(" (select sum(importe) from conta_corrente_ptovta ccpv where ccpv.puntoventa_id = c.puntoventa_id and ccpv.usuario_id = c.usuario_id and ccpv.feccorte = c.feccorte and ccpv.turno_id = c.turno_id) as \"importeTotal\""); + sb.append(" "); + sb.append(" from "); + sb.append(" caja c "); + sb.append(" left join usuario u on c.usuario_id = u.usuario_id "); + sb.append(" left join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sb.append(" "); + sb.append(" where "); + sb.append(" trunc(c.feccorte) = to_date('").append(sdf.format(fecha)).append("','yyyy-MM-dd')"); + + if (!cveusuario.equals("*")) { + sb.append(" and u.cveusuario like '" + cveusuario + "'"); + } + + if (!turnoid.equals("*")) { + sb.append(" and c.turno_id in(" + turnoid + ")"); + } else { + sb.append(" and c.turno_id is not null"); + } + + return sb.toString(); + } + + @Override + public String getSQLBuscarCajaCerrado(Integer usuarioId, Date fecha, String turnoid) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select "); + sb.append(" c.CAJA_ID as \"cajaId\", "); + sb.append(" c.NUMFOLIOSISTEMA as \"numFolioSistema\", "); + sb.append(" ori.descparada as \"origen\", "); + sb.append(" des.descparada as \"destino\", "); + sb.append(" c.CORRIDA_ID as \"corridaId\", "); + sb.append(" (case when c.motivocancelacion_id is null then cfp.importe else cfp.importe * -1 end) as \"precioPagado\", "); + sb.append(" c.FECHORVENTA as \"fecHorVenta\", "); + sb.append(" (case when c.motivocancelacion_id is null then c.IMPORTETAXAEMBARQUE else c.IMPORTETAXAEMBARQUE * -1 end) as \"importeTaxaEmbarque\", "); + sb.append(" ru.descruta as \"ruta\", "); + sb.append(" nvl(ct.numautorizacion, c.numoperacion) as \"numAutorizacion\", "); + sb.append(" (case when cfp.formapago_id = 11 then cdp.numdocumento else null end) as \"ordenSevicio\", "); + sb.append(" s.descsecretaria as \"secretaria\", "); + sb.append(" s.CVESECRETARIA as \"cvesecretaria\", "); + sb.append(" (case when fp.formapago_id = " + RED_PAGO_FORMAPAGO_ID).append(" then '" + RED_PAGO_EMISSOR_TARJETA + "' else ct.tipotarjeta end) as \"emissorTarjeta\", "); + sb.append(" cat.DESCCATEGORIA as \"tipoPasaje\", "); + sb.append(" (case when fp.formapago_id = " + RED_PAGO_FORMAPAGO_ID).append(" then '" + RED_PAGO_FORMA_PAGO + "' else fp.cvepago end) as \"formaPago\" "); + sb.append(" from "); + sb.append(" caja c "); + sb.append(" left join caja_formapago cfp on cfp.caja_id = c.caja_id "); + sb.append(" left outer join forma_pago fp on fp.formapago_id = cfp.formapago_id "); + sb.append(" left join caja_det_pago cdp on cdp.cajaformapago_id = cfp.cajaformapago_id "); + sb.append(" left join caja_tarjeta ct on ct.cajadetpago_id = cdp.cajadetpago_id "); + sb.append(" left join categoria cat on cat.categoria_id = c.categoria_id "); + sb.append(" left join secretaria s on s.secretaria_id = cdp.opcional1 "); + sb.append(" left join ruta ru on ru.ruta_id = c.ruta_id "); + sb.append(" left join parada ori on ori.parada_id = c.origen_id "); + sb.append(" left join parada des on des.parada_id = c.destino_id "); + sb.append(" where "); + sb.append(" trunc(c.feccorte) = to_date('").append(sdf.format(fecha)).append("','yyyy-MM-dd')"); + sb.append(" and c.usuario_id = ").append(usuarioId); + if (!turnoid.equals("*")) { + sb.append(" and c.turno_id in(" + turnoid + ")"); + } else { + sb.append(" and c.turno_id is not null"); + } + sb.append(" and c.indreimpresion = 0"); + sb.append(" order by c.CAJA_ID"); + + return sb.toString(); + } + + @Override + public String getSQLBuscarReceitasDespesasCaja(Integer usuarioId, Date fec) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + StringBuilder sb = new StringBuilder(""); + sb.append(" select "); + sb.append(" "); + sb.append(" c.precio as \"precio\", "); + sb.append(" t.desctipoevento as \"tipoEvento\" "); + sb.append(" "); + sb.append(" from "); + sb.append(" caja_diversos c "); + sb.append(" left join evento_extra e on c.eventoextra_id = e.eventoextra_id "); + sb.append(" left join tipo_evento_extra t on t.tipoeventoextra_id = e.tipoeventoextra_id "); + sb.append(" "); + sb.append(" where "); + sb.append(" c.feccorte = to_date('").append(sdf.format(fec)).append("','yyyy-MM-dd')"); + sb.append(" and c.turno_id is not null and c.usuario_id = ").append(usuarioId); + + return sb.toString(); + } + + @Override + public String getSQLBuscarUsuariosActivo() { + StringBuilder sb = new StringBuilder(""); + + sb.append(" select distinct"); + sb.append(" u.usuario_id as \"usuarioId\","); + sb.append(" u.cveusuario as \"cveusuario\","); + sb.append(" u.NOMBUSUARIO||' '||u.NOMBPATERNO||' '||u.NOMBMATERNO as \"nombusuario\""); + sb.append(" from"); + sb.append(" usuario u"); + sb.append(" where"); + sb.append(" u.activo = 1"); + sb.append(" order by"); + sb.append(" u.usuario_id"); + + return sb.toString(); + } + + @Override + public String getSQLInserirCajaVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into caja "); + sb.append("(caja_id, numasiento, categoria_id,numfoliosistema,claseservicio_id, marca_id, origen_id, destino_id, corrida_id, feccorrida,nombpasajero, preciobase, "); + sb.append("preciopagado,descuentoamparado, tipoventa_id, numseriepreimpresa, numfoliopreimpreso, fechorviaje, fechorventa, puntoventa_id,numkmviaje, numoperacion,"); + sb.append("indstatusoperacion,motivocancelacion_id, motivoreimpresion_id, cantpuntos, empresapuntoventa_id, empresacorrida_id, numreservacion, turno_id,"); + sb.append("indstatusboleto,indcancelacion, indreimpresion,indviajeredondo, feccorte, indextraviado, paridad, feccreacion, conveniodet_id, moneda_id, estacion_id,"); + sb.append("indreplica, usuarioautorizacion_id, tipoidentificacion_id, numidentificacion,clientefidelidad_id, opcional1, opcional2, opcional3, preciocargoextra,"); + sb.append("preciopricing, cajaoriginal_id, usuarioremoto_id, puntoventaremoto_id, numdocdescuento, canttransferencia,activo, fecmodif, usuario_id, nodo_id,"); + sb.append("porccategoria,importecategoria, cliente_id, pagorecaudacion_id, pagorecaudacion2_id, importetaxaembarque, importepedagio, importeoutros,"); + sb.append("importeseguro, indconexion, levante_id, ruta_id, serieimpfiscal, fecintegracion, ptovtaventa_id, indremotoinverso, fecnacimiento)"); + sb.append("values ("); + sb.append(":cajaId,:numAsiento,:categoriaId,null,:claseServicioId,:marcaId,:origemId,:destinoId,:corridaId,:fecCorrida,null,:precioBase,"); + sb.append(":precioPagado,null, :tipoVentaId, null, null, :fechorViaje, :fechorVenta, :puntoVentaId,null, :numOperacion,"); + sb.append("'F',null, null, null, :empresaPuntoVentaId, :empresaCorridaId, null, null,"); + sb.append("'V', 0, 0, 0, null, 0, null, :fecCreacion, null, null, :estacionId,"); + sb.append("0, null, null, null,null, null, null, null, null,"); + sb.append("null, null, null, null, null, null, 1, :fecModIf, :usuarioId, 1,"); + sb.append("null, null, null, null, null, :importeTaxaEmbarque, :importePedagio, :importeOutros,"); + sb.append(":importeSeguro, 0, null, :rutaId, null, null, null, 0, null)"); + + return sb.toString(); + } + + @Override + public String getSQLInserirCajaFormaPagoVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into caja_formapago "); + sb.append("(formapago_id, caja_id, importe, activo, fecmodif, usuario_id, indreplica, nodo_id, cajaformapago_id) values "); + sb.append("(:formaPagoId, :cajaId, :importe, 1, :fecModIf, :usuarioId, null, 1, :cajaFormaPagoId)"); + + return sb.toString(); + } + + @Override + public String getSQLInserirBoletoVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into boleto "); + sb.append("(empresacorrida_id, destino_id, tipoventa_id, categoria_id, motivoreimpresion_id, claseservicio_id, corrida_id, feccorrida, puntoventa_id,"); + sb.append("empresapuntoventa_id, turno_id, motivocancelacion_id, origen_id, marca_id, conveniodet_id, cliente_id, numasiento, numfoliosistema,"); + sb.append("nombpasajero,fecnacimiento,preciopagado,paridad, numseriepreimpresa, numfoliopreimpreso, fechorviaje, fechorventa, numkmviaje, numoperacion,"); + sb.append("indstatusoperacion, cantpuntos, numreservacion, indstatusboleto, indcancelacion, indreimpresion, indviajeredondo, feccreacion, activo,"); + sb.append("indconexion, fecmodif, usuario_id, usuarioautorizacion_id, tipoidentificacion_id, numidentificacion, indextraviado, preciobase, entregaboleto_id,"); + sb.append("opcional1,opcional2, opcional3, descuentoamparado, moneda_id, estacion_id, usuarioremoto_id, puntoventaremoto_id, preciocargoextra, nodo_id,"); + sb.append("indreplica, numdocdescuento, canttransferencia, porccategoria, preciopricing, importecategoria, boletooriginal_id, importetaxaembarque,"); + sb.append("importepedagio, importeoutros, importeseguro, desctipodoc, desctipodoc2, descnumdoc, descnumdoc2, tipoidentificaciondoc_id, descorgaodoc,"); + sb.append("NUMFIDELIDAD, INFOPASAJERO, LEVANTE_ID, ESTADOFOLIO_ID, RUTA_ID, DESCCORREO, DESCTELEFONO, SERIEIMPFISCAL,NUMASIENTOVINCULADO, BOLETO_ID) values "); + + sb.append("(:empresaCorridaId, :destinoId, :tipoVentaId, :categoriaId, null, :claseServicioId, :corridaId, :fecCorrida, :puntoVentaId, "); + sb.append(":empresaPuntoVentaId, null, null, :origemId, :marcaId, null, null, :numAsiento, null,"); + sb.append("null,null,:precioPagado,null,null, :numFolioPreimpresso, :fechorViaje, :fechorVenta, null, :numOperacion,"); + sb.append("'F', null, null, 'V', 0, 0, 0, null, 1,"); + sb.append("0, :fecModIf, :usuarioId,null, null, null, 0, :precioBase, null,"); + sb.append("null,null, null, null, null, :estacionId, null, null, null,1,"); + sb.append("0, null, null, null, :precioPricing, null, null, :importeTaxaEmbarque,"); + sb.append(":importePedagio, :importeOutros, :importeSeguro, null, null, null, null, null, null,"); + sb.append("null, null, null, null, :rutaId, null, null, :serieImpFiscal, null, :boletoId)"); + + return sb.toString(); + } + + @Override + public String getSQLInserirBoletoFormaPagoVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into boleto_formapago "); + sb.append("(formapago_id, boleto_id, importe, fecmodif, usuario_id, activo, indreplica, nodo_id, boletoformapago_id) values "); + sb.append("(:formaPagoId, :boletoId, :importe, :fecModIf, :usuarioId, 1, 0, 1,:boletoFormaPagoId)"); + + return sb.toString(); + } + + @Override + public String getSQLObterSequenceBoletoFormaPago() { + return "select boleto_formapago_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenceCajaFormaPago() { + return "select caja_formapago_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenceBoleto() { + return "select boleto_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenceCaja() { + return "select caja_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenciaNumOperacion() { + return "select numeoperacion_seq.nextval from dual"; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/util/AidfGenerator.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/util/AidfGenerator.java new file mode 100644 index 000000000..e3c4a3586 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/util/AidfGenerator.java @@ -0,0 +1,69 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +import org.hibernate.engine.SessionImplementor; +import org.hibernate.id.IdentifierGenerator; +/** + * Classe que trata a geração do ID da tabela Aidf. + * + * Foi abandonado o uso da sequence pois existiam lacunas nos numeros e já havia atingido o tamanho máximo de 3 dígitos, com isso + * sendo necessário aproveitar os número que não haviam sido utilizados + * + * @author gleimar + * + */ +public class AidfGenerator implements IdentifierGenerator { + + private static Logger log = Logger.getLogger(AidfGenerator.class); + + @Override + public Serializable generate(SessionImplementor session, Object object) throws HibernateException { + + int qtdMaxima = 999; + long idEncontrado = -1; + + Connection connection = session.connection(); + PreparedStatement ps; + + int i=1; + + try { + + ps = connection.prepareStatement("select count(*) as qtd from aidf where aidf_id = :1"); + + for(; (idEncontrado == -1) && (i <= qtdMaxima);i++){ + ps.setInt(1, i); + ResultSet rs = ps.executeQuery(); + rs.next(); + int qtd = rs.getInt("qtd"); + + if (qtd == 0){ + idEncontrado = i; + } + } + + } catch (SQLException e) { + log.error("erro ao buscar id aidf",e); + throw new HibernateException(e); + } + log.info("i="+i); + log.info("idEncontrado="+idEncontrado); + + if (i > qtdMaxima && (idEncontrado != qtdMaxima) ){ + throw new HibernateException("A qtd de IDs permitidos para AIDF foi atingido:"+qtdMaxima); + } + + if (idEncontrado == -1){ + throw new HibernateException("Houve algum erro ao buscar um novo ID para AIDF"); + } + return idEncontrado; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/dao/util/DBUtil.java b/modelWeb/src/com/rjconsultores/ventaboletos/dao/util/DBUtil.java new file mode 100644 index 000000000..b8f3ffaa8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/dao/util/DBUtil.java @@ -0,0 +1,76 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.log4j.Logger; +import org.springframework.core.io.ClassPathResource; + +public class DBUtil { + + private static Logger log = Logger.getLogger(DBUtil.class); + private static DBUtil INSTANCE; + private static Properties p; + + public static DBUtil getInstance() { + if (INSTANCE == null) { + INSTANCE = new DBUtil(); + } + return INSTANCE; + } + + private DBUtil() { + p = new Properties(); + InputStream is; + try { + is = new ClassPathResource("/com/rjconsultores/ventaboletos/web/cliente/conf/database.properties").getInputStream(); + + p.load(is); + is.close(); + } catch (IOException e) { + log.error("Erro ao carregar o properties do banco de dados", e); + } + } + + public boolean isOracle() { + return p.getProperty("database.dialect").toUpperCase().contains("ORACLE"); + } + + public boolean isSQLServer() { + return p.getProperty("database.dialect").toUpperCase().contains("SQLSERVER"); + } + + public boolean isRDS() { + return Boolean.valueOf(p.getProperty("database.rds", "false")); + } + + public String dbSysdate() { + if (isOracle()) { + if (isRDS()) { + return "DATETIME_RDS()"; + } else { + return "SYSDATE"; + } + } + if (isSQLServer()) { + return "GETDATE()"; + } + return ""; + } + + // private String getDefaultSchema(){ + // return p.getProperty("database.default_schema").toUpperCase(); + // } + + // public String agregarDefaulSchema(String objBaseDados){ + // String [] array = objBaseDados.split("\\."); + // + // if (array.length == 1){ + // return getDefaultSchema() + "." + array[0]; + // }else if (array.length == 2){ + // return getDefaultSchema() + "." + array[1]; + // } + // return objBaseDados; + // } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoBoleto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoBoleto.java new file mode 100644 index 000000000..8e9a0d4a3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoBoleto.java @@ -0,0 +1,282 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ABASTO_BOLETO_SEQ", sequenceName = "ABASTO_BOLETO_SEQ", allocationSize = 1) +@Table(name = "ABASTO_BOLETO") +public class AbastoBoleto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_BOLETO_SEQ") + @Column(name = "ABASTOBOLETO_ID") + private Integer abastoboletoId; + @Column(name = "NUMSERVIDOR") + private Integer numservidor; + @Column(name = "NUMREQUISICION") + private Long numrequisicion; + @Column(name = "FECHORREQ") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorreq; + @Column(name = "USUARIOREQ_ID") + private Integer usuarioreqId; + @Column(name = "CANTFAJILLA") + private Long cantfajilla; + @Column(name = "FECHORGENERACION") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorgeneracion; + @Column(name = "USUARIOGENERACION_ID") + private Integer usuariogeneracionId; + @Column(name = "STATUSFIRMA") + private Integer statusfirma; + @Column(name = "STATUSENVIO") + private Integer statusEnvio; + @Column(name = "FECHORFIRMA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorfirma; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTACENTRAL_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventacentral; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventa; + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + @ManyToOne + private Estacion estacion; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CLASIFICACION_ID", referencedColumnName = "CLASIFICACION_ID") + @ManyToOne + private Clasificacion clasificacion; + @JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID") + @ManyToOne + private Articulo articulo; + @OneToMany(mappedBy = "abastoBoleto", cascade = CascadeType.ALL) + private List detAbastoBoletoList; + + public Integer getAbastoboletoId() { + return abastoboletoId; + } + + public void setAbastoboletoId(Integer abastoboletoId) { + this.abastoboletoId = abastoboletoId; + } + + public Integer getNumservidor() { + return numservidor; + } + + public void setNumservidor(Integer numservidor) { + this.numservidor = numservidor; + } + + public Long getNumrequisicion() { + return numrequisicion; + } + + public void setNumrequisicion(Long numrequisicion) { + this.numrequisicion = numrequisicion; + } + + public Date getFechorreq() { + return fechorreq; + } + + public void setFechorreq(Date fechorreq) { + this.fechorreq = fechorreq; + } + + public Integer getUsuarioreqId() { + return usuarioreqId; + } + + public void setUsuarioreqId(Integer usuarioreqId) { + this.usuarioreqId = usuarioreqId; + } + + public Long getCantfajilla() { + return cantfajilla; + } + + public void setCantfajilla(Long cantfajilla) { + this.cantfajilla = cantfajilla; + } + + public Date getFechorgeneracion() { + return fechorgeneracion; + } + + public void setFechorgeneracion(Date fechorgeneracion) { + this.fechorgeneracion = fechorgeneracion; + } + + public Integer getUsuariogeneracionId() { + return usuariogeneracionId; + } + + public void setUsuariogeneracionId(Integer usuariogeneracionId) { + this.usuariogeneracionId = usuariogeneracionId; + } + + public Integer getStatusfirma() { + return statusfirma; + } + + public void setStatusfirma(Integer statusfirma) { + this.statusfirma = statusfirma; + } + + public Integer getStatusEnvio() { + return statusEnvio; + } + + public void setStatusEnvio(Integer statusEnvio) { + this.statusEnvio = statusEnvio; + } + + public Date getFechorfirma() { + return fechorfirma; + } + + public void setFechorfirma(Date fechorfirma) { + this.fechorfirma = fechorfirma; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventacentral() { + return puntoventacentral; + } + + public void setPuntoventacentral(PuntoVenta puntoventacentral) { + this.puntoventacentral = puntoventacentral; + } + + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Clasificacion getClasificacion() { + return clasificacion; + } + + public void setClasificacion(Clasificacion clasificacion) { + this.clasificacion = clasificacion; + } + + public Articulo getArticulo() { + return articulo; + } + + public void setArticulo(Articulo articulo) { + this.articulo = articulo; + } + + public List getDetAbastoBoletoList() { + return detAbastoBoletoList; + } + + public void setDetAbastoBoletoList(List detAbastoBoletoList) { + this.detAbastoBoletoList = detAbastoBoletoList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((abastoboletoId == null) ? 0 : abastoboletoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AbastoBoleto other = (AbastoBoleto) obj; + if (abastoboletoId == null) { + if (other.abastoboletoId != null) + return false; + } else if (!abastoboletoId.equals(other.abastoboletoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AbastoBoleto [abastoboletoId=" + abastoboletoId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java new file mode 100644 index 000000000..12b2336b2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java @@ -0,0 +1,150 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoCentral generated by hbm2java + */ +@Entity +@Table(name = "ABASTO_CENTRAL") +public class AbastoCentral implements java.io.Serializable { + + private Long abastocentralId; + private Aidf aidf; + private String numseriepreimpresa; + private String numfoliopreimpreso; + private String numsubseriepreimpreso; + private PuntoVenta puntoventa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Estacion estacion; + + public AbastoCentral() { + } + + public AbastoCentral(Aidf _aidf, String _numseriepreimpresa, String _numfoliopreimpreso, String _numsubseriepreimpreso, + PuntoVenta _puntoventa, Boolean _activo, Date _fecmodif, Integer _usuarioId) { + aidf = _aidf; + numseriepreimpresa = _numseriepreimpresa; + numfoliopreimpreso = _numfoliopreimpreso; + numsubseriepreimpreso = _numsubseriepreimpreso; + puntoventa = _puntoventa; + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + @SequenceGenerator(name = "ABASTO_HISTO_SEQ", sequenceName = "ABASTO_HISTO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_HISTO_SEQ") + @Column(name = "ABASTOCENTRAL_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAbastocentralId() { + return this.abastocentralId; + } + + public void setAbastocentralId(Long abastocentralId) { + this.abastocentralId = abastocentralId; + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "AIDF_ID") + public Aidf getAidf() { + return this.aidf; + } + + public void setAidf(Aidf aidf) { + this.aidf = aidf; + } + + @Column(name = "NUMSERIEPREIMPRESA", length = 10) + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + @Column(name = "NUMFOLIOPREIMPRESO", length = 12) + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + @Column(name = "NUMSUBSERIEPREIMPRESO", length = 10) + public String getNumsubseriepreimpreso() { + return this.numsubseriepreimpreso; + } + + public void setNumsubseriepreimpreso(String numsubseriepreimpreso) { + this.numsubseriepreimpreso = numsubseriepreimpreso; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @ManyToOne + @JoinColumn(name = "ESTACION_ID") + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java new file mode 100644 index 000000000..27cb2f742 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java @@ -0,0 +1,189 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoHisto generated by hbm2java + */ +@Entity +@Table(name = "ABASTO_HISTO") +public class AbastoHisto implements java.io.Serializable { + + private Long abastohistoId; + private TipoMovimentacion tipoMovimentacion; + private Aidf aidf; + private String numseriepreimpresa; + private String numfoliopreimpreso; + private String numsubseriepreimpreso; + private Date fechorhisto; + private PuntoVenta puntoventa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Estacion estacion; + + public AbastoHisto() { + } + + public AbastoHisto(AbastoCentral bilhete, TipoMovimentacion _tipoMovimentacion, Date _fechorhisto, Boolean _activo, Date _fecmodif, Integer _usuarioId) { + tipoMovimentacion = _tipoMovimentacion; + aidf = bilhete.getAidf(); + numseriepreimpresa = bilhete.getNumseriepreimpresa(); + numfoliopreimpreso = bilhete.getNumfoliopreimpreso(); + numsubseriepreimpreso = bilhete.getNumsubseriepreimpreso(); + estacion = bilhete.getEstacion(); + fechorhisto = _fechorhisto; + puntoventa = bilhete.getPuntoventa(); + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + public AbastoHisto(TipoMovimentacion _tipoMovimentacion, Aidf _aidf, String _numseriepreimpresa, String _numfoliopreimpreso, + String _numsubseriepreimpreso, Date _fechorhisto, PuntoVenta _puntoventa, Boolean _activo, Date _fecmodif, Integer _usuarioId, Estacion _estacion) { + tipoMovimentacion = _tipoMovimentacion; + aidf = _aidf; + numseriepreimpresa = _numseriepreimpresa; + numfoliopreimpreso = _numfoliopreimpreso; + numsubseriepreimpreso = _numsubseriepreimpreso; + fechorhisto = _fechorhisto; + puntoventa = _puntoventa; + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + estacion = _estacion; + } + + @SequenceGenerator(name = "ABASTO_HISTO_SEQ", sequenceName = "ABASTO_HISTO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_HISTO_SEQ") + @Column(name = "ABASTOHISTO_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAbastohistoId() { + return this.abastohistoId; + } + + public void setAbastohistoId(Long abastohistoId) { + this.abastohistoId = abastohistoId; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOMOVIMENTACION_ID") + public TipoMovimentacion getTipoMovimentacion() { + return this.tipoMovimentacion; + } + + public void setTipoMovimentacion(TipoMovimentacion tipoMovimentacion) { + this.tipoMovimentacion = tipoMovimentacion; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDF_ID") + public Aidf getAidf() { + return this.aidf; + } + + public void setAidf(Aidf aidf) { + this.aidf = aidf; + } + + @Column(name = "NUMSERIEPREIMPRESA", length = 10) + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + @Column(name = "NUMFOLIOPREIMPRESO", length = 12) + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + @Column(name = "NUMSUBSERIEPREIMPRESO", length = 10) + public String getNumsubseriepreimpreso() { + return this.numsubseriepreimpreso; + } + + public void setNumsubseriepreimpreso(String numsubseriepreimpreso) { + this.numsubseriepreimpreso = numsubseriepreimpreso; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORHISTO", length = 7) + public Date getFechorhisto() { + return this.fechorhisto; + } + + public void setFechorhisto(Date fechorhisto) { + this.fechorhisto = fechorhisto; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @ManyToOne + @JoinColumn(name = "ESTACION_ID") + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Aidf.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Aidf.java new file mode 100644 index 000000000..83d0b4d52 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Aidf.java @@ -0,0 +1,281 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.GenericGenerator; + +/** + * Aidf generated by hbm2java + */ +@Entity +@Table(name = "AIDF") +public class Aidf implements java.io.Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Long aidfId; + private AidfTipo aidfTipo; + private AidfEspecie aidfEspecie; + private Estado estado; + private String docfiscal; + private String acfiscal; + private String serie; + private String subserie; + private String forminicial; + private String formfinal; + private Date fecadquisicion; + private Date fecvencimiento; + private String inscestadual; + private Empresa empresa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private String cnpj; + private String tipoValidaVenta; + + public Aidf() { + } + + public Aidf(AidfTipo aidfTipo, AidfEspecie aidfEspecie, Estado estado, String docfiscal, String acfiscal, + String serie, String subserie, String forminicial, String formfinal, Date fecadquisicion, Date fecvencimiento, + String inscestadual, Empresa empresa, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidfTipo = aidfTipo; + this.aidfEspecie = aidfEspecie; + this.estado = estado; + this.docfiscal = docfiscal; + this.acfiscal = acfiscal; + this.serie = serie; + this.subserie = subserie; + this.forminicial = forminicial; + this.formfinal = formfinal; + this.fecadquisicion = fecadquisicion; + this.fecvencimiento = fecvencimiento; + this.inscestadual = inscestadual; + this.empresa = empresa; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return String.format("%s - %s", docfiscal, acfiscal); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidfId != null ? aidfId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Aidf)) + return false; + + Aidf other = (Aidf) object; + if ((this.aidfId == null && other.aidfId != null) || (this.aidfId != null && !this.aidfId.equals(other.aidfId))) { + return false; + } + return true; + } + + + @Id + @GenericGenerator(name="aidfgen_id", strategy="com.rjconsultores.ventaboletos.dao.util.AidfGenerator") + @GeneratedValue(generator="aidfgen_id") + @Column(name = "AIDF_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAidfId() { + return aidfId; + } + + public void setAidfId(Long aidfId) { + this.aidfId = aidfId; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDFTIPO_ID") + public AidfTipo getAidfTipo() { + return aidfTipo; + } + + public void setAidfTipo(AidfTipo aidfTipo) { + this.aidfTipo = aidfTipo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDFESP_ID") + public AidfEspecie getAidfEspecie() { + return aidfEspecie; + } + + public void setAidfEspecie(AidfEspecie aidfEspecie) { + this.aidfEspecie = aidfEspecie; + } + + @JoinColumn(name = "ESTADO_ID") + @ManyToOne + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Column(name = "DOCFISCAL", length = 20) + public String getDocfiscal() { + return docfiscal; + } + + public void setDocfiscal(String docfiscal) { + this.docfiscal = docfiscal; + } + + @Column(name = "ACFISCAL", length = 20) + public String getAcfiscal() { + return acfiscal; + } + + public void setAcfiscal(String acfiscal) { + this.acfiscal = acfiscal; + } + + @Column(name = "SERIE", length = 20) + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + @Column(name = "SUBSERIE", length = 20) + public String getSubserie() { + return subserie; + } + + public void setSubserie(String subserie) { + this.subserie = subserie; + } + + @Column(name = "FORMINICIAL", length = 12) + public String getForminicial() { + return forminicial; + } + + public void setForminicial(String forminicial) { + this.forminicial = forminicial; + } + + @Column(name = "FORMFINAL", length = 12) + public String getFormfinal() { + return formfinal; + } + + public void setFormfinal(String formfinal) { + this.formfinal = formfinal; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECADQUISICION", length = 7) + public Date getFecadquisicion() { + return fecadquisicion; + } + + public void setFecadquisicion(Date fecadquisicion) { + this.fecadquisicion = fecadquisicion; + } + + @Column(name = "CNPJ", length = 20) + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj){ + this.cnpj = cnpj; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECVENCIMIENTO", length = 7) + public Date getFecvencimiento() { + return fecvencimiento; + } + + public void setFecvencimiento(Date fecvencimiento) { + this.fecvencimiento = fecvencimiento; + } + + @Column(name = "INSCESTADUAL", length = 20) + public String getInscestadual() { + return inscestadual; + } + + public void setInscestadual(String inscestadual) { + this.inscestadual = inscestadual; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name="TIPOVALIDAVENTA") + public String getTipoValidaVenta() { + return tipoValidaVenta; + } + + public void setTipoValidaVenta(String tipoValidaVenta) { + this.tipoValidaVenta = tipoValidaVenta; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java new file mode 100644 index 000000000..69323235a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java @@ -0,0 +1,113 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AidfEspecie generated by hbm2java + */ +@Entity +@Table(name = "AIDF_ESPECIE") +public class AidfEspecie implements java.io.Serializable { + + private Integer aidfespId; + private String decespecie; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public AidfEspecie() { + } + + public AidfEspecie(Integer aidfespId) { + this.aidfespId = aidfespId; + } + + @Override + public String toString() { + return decespecie; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidfespId != null ? aidfespId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AidfEspecie)) + return false; + + AidfEspecie other = (AidfEspecie) object; + if ((this.aidfespId == null && other.aidfespId != null) || (this.aidfespId != null && !this.aidfespId.equals(other.aidfespId))) { + return false; + } + return true; + } + + public AidfEspecie(Integer aidfespId, String decespecie, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidfespId = aidfespId; + this.decespecie = decespecie; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Id + @Column(name = "AIDFESP_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getAidfespId() { + return this.aidfespId; + } + + public void setAidfespId(Integer aidfespId) { + this.aidfespId = aidfespId; + } + + @Column(name = "DECESPECIE", length = 20) + public String getDecespecie() { + return this.decespecie; + } + + public void setDecespecie(String decespecie) { + this.decespecie = decespecie; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java new file mode 100644 index 000000000..852043922 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java @@ -0,0 +1,113 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AidfTipo generated by hbm2java + */ +@Entity +@Table(name = "AIDF_TIPO") +public class AidfTipo implements java.io.Serializable { + + private Integer aidftipoId; + private String desctipo; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public AidfTipo() { + } + + public AidfTipo(Integer aidftipoId) { + this.aidftipoId = aidftipoId; + } + + @Override + public String toString() { + return desctipo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidftipoId != null ? aidftipoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AidfTipo)) + return false; + + AidfTipo other = (AidfTipo) object; + if ((this.aidftipoId == null && other.aidftipoId != null) || (this.aidftipoId != null && !this.aidftipoId.equals(other.aidftipoId))) { + return false; + } + return true; + } + + public AidfTipo(Integer aidftipoId, String desctipo, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidftipoId = aidftipoId; + this.desctipo = desctipo; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Id + @Column(name = "AIDFTIPO_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getAidftipoId() { + return this.aidftipoId; + } + + public void setAidftipoId(Integer aidftipoId) { + this.aidftipoId = aidftipoId; + } + + @Column(name = "DESCTIPO", length = 20) + public String getDesctipo() { + return this.desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AjusteEventoExtra.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AjusteEventoExtra.java new file mode 100644 index 000000000..2b6c00b66 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AjusteEventoExtra.java @@ -0,0 +1,208 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "AJUSTE_EVENTO_EXTRA") +@SequenceGenerator(name = "AJUSTE_EVENTO_EXTRA_SEQ", sequenceName = "AJUSTE_EVENTO_EXTRA_SEQ", allocationSize = 1) +public class AjusteEventoExtra implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AJUSTE_EVENTO_EXTRA_SEQ") + @Column(name = "AJUSTEEVENTOEXTRA_ID") + private Long ajusteeventoextraId; + @Column(name = "TIPOEVENTOEXTRA_ID") + private Integer tipoeventoextraId; + @Column(name = "FECHORINGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechoringreso; + @Column(name = "CORTETURNO_ID") + private Integer corteturnoId; + @Column(name = "IMPINGRESO") + private BigDecimal impingreso; + @Column(name = "NUMDOCUMENTO") + private String numdocumento; + @Column(name = "IMPORTEIVA") + private BigDecimal importeiva; + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "DEPOSITOBANCARIO_ID") + private Integer depositobancarioId; + @Column(name = "EMPRESA_ID") + private Integer empresaId; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "STATUSAJUSTE") + private Short statusajuste; + + public AjusteEventoExtra() { + } + + public AjusteEventoExtra(Long ajusteeventoextraId) { + this.ajusteeventoextraId = ajusteeventoextraId; + } + + public Long getAjusteeventoextraId() { + return ajusteeventoextraId; + } + + public void setAjusteeventoextraId(Long ajusteeventoextraId) { + this.ajusteeventoextraId = ajusteeventoextraId; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public Date getFechoringreso() { + return fechoringreso; + } + + public void setFechoringreso(Date fechoringreso) { + this.fechoringreso = fechoringreso; + } + + public Integer getCorteturnoId() { + return corteturnoId; + } + + public void setCorteturnoId(Integer corteturnoId) { + this.corteturnoId = corteturnoId; + } + + public BigDecimal getImpingreso() { + return impingreso; + } + + public void setImpingreso(BigDecimal impingreso) { + this.impingreso = impingreso; + } + + public String getNumdocumento() { + return numdocumento; + } + + public void setNumdocumento(String numdocumento) { + this.numdocumento = numdocumento; + } + + public BigDecimal getImporteiva() { + return importeiva; + } + + public void setImporteiva(BigDecimal importeiva) { + this.importeiva = importeiva; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getDepositobancarioId() { + return depositobancarioId; + } + + public void setDepositobancarioId(Integer depositobancarioId) { + this.depositobancarioId = depositobancarioId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Short getStatusajuste() { + return statusajuste; + } + + public void setStatusajuste(Short statusajuste) { + this.statusajuste = statusajuste; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ajusteeventoextraId != null ? ajusteeventoextraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AjusteEventoExtra)) { + return false; + } + AjusteEventoExtra other = (AjusteEventoExtra) object; + if ((this.ajusteeventoextraId == null && other.ajusteeventoextraId != null) || (this.ajusteeventoextraId != null && !this.ajusteeventoextraId.equals(other.ajusteeventoextraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra[ajusteeventoextraId=" + ajusteeventoextraId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AlertaCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AlertaCtrl.java new file mode 100644 index 000000000..7eaf082be --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AlertaCtrl.java @@ -0,0 +1,276 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "ALERTA_CTRL_SEQ", sequenceName = "ALERTA_CTRL_SEQ", allocationSize = 1) +@Table(name = "ALERTA_CTRL") +public class AlertaCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ALERTA_CTRL_SEQ") + @Basic(optional = false) + @Column(name = "ALERTACTRL_ID") + private Integer alertactrlId; + @Column(name = "PORCALTA") + private BigDecimal porcalta; + @Column(name = "PORCBAJA") + private BigDecimal porcbaja; + @Column(name = "TIEMPOALTA") + private Integer tiempoalta; + @Column(name = "TIEMPOBAJA") + private Integer tiempobaja; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDLUNES") + private Boolean indlunes; + @Column(name = "INDMARTES") + private Boolean indmartes; + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + @Column(name = "INDJUEVES") + private Boolean indjueves; + @Column(name = "INDVIERNES") + private Boolean indviernes; + @Column(name = "INDSABADO") + private Boolean indsabado; + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA", referencedColumnName = "FECCORRIDA") }) + private Corrida corrida; + + public AlertaCtrl() { + } + + public AlertaCtrl(Integer alertactrlId) { + this.alertactrlId = alertactrlId; + } + + public Integer getAlertactrlId() { + return alertactrlId; + } + + public void setAlertactrlId(Integer alertactrlId) { + this.alertactrlId = alertactrlId; + } + + public BigDecimal getPorcalta() { + return porcalta; + } + + public void setPorcalta(BigDecimal porcalta) { + this.porcalta = porcalta; + } + + public BigDecimal getPorcbaja() { + return porcbaja; + } + + public void setPorcbaja(BigDecimal porcbaja) { + this.porcbaja = porcbaja; + } + + public Boolean getInddomingo() { + return inddomingo; + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + public Boolean getIndjueves() { + return indjueves; + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndlunes() { + return indlunes; + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return indmartes; + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return indmiercoles; + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndsabado() { + return indsabado; + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getIndviernes() { + return indviernes; + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Integer getTiempoalta() { + return tiempoalta; + } + + public void setTiempoalta(Integer tiempoalta) { + this.tiempoalta = tiempoalta; + } + + public Integer getTiempobaja() { + return tiempobaja; + } + + public void setTiempobaja(Integer tiempobaja) { + this.tiempobaja = tiempobaja; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (alertactrlId != null ? alertactrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof AlertaCtrl)) { + return false; + } + AlertaCtrl other = (AlertaCtrl) object; + if ((this.alertactrlId == null && other.alertactrlId != null) || (this.alertactrlId != null && !this.alertactrlId.equals(other.alertactrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AlertaCtrl[alertactrlId=" + alertactrlId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AliasServico.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AliasServico.java new file mode 100644 index 000000000..9f628bfaa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AliasServico.java @@ -0,0 +1,159 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ALIAS_SERVICO_SEQ", sequenceName = "ALIAS_SERVICO_SEQ", allocationSize = 1) +@Table(name = "ALIAS_SERVICO") +public class AliasServico implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ALIAS_SERVICO_SEQ") + @Column(name = "ALIASSERVICO_ID") + private Integer aliasServicoId; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @OneToOne + @JoinColumn(name = "ALIASORIGEN_ID") + private Parada aliasOrigen; + @OneToOne + @JoinColumn(name = "ALIASDESTINO_ID") + private Parada aliasDestino; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getAliasServicoId() { + return aliasServicoId; + } + + public void setAliasServicoId(Integer aliasServicoId) { + this.aliasServicoId = aliasServicoId; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Parada getAliasOrigen() { + return aliasOrigen; + } + + public void setAliasOrigen(Parada aliasOrigen) { + this.aliasOrigen = aliasOrigen; + } + + public Parada getAliasDestino() { + return aliasDestino; + } + + public void setAliasDestino(Parada aliasDestino) { + this.aliasDestino = aliasDestino; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((aliasServicoId == null) ? 0 : aliasServicoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AliasServico other = (AliasServico) obj; + if (aliasServicoId == null) { + if (other.aliasServicoId != null) + return false; + } else if (!aliasServicoId.equals(other.aliasServicoId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Articulo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Articulo.java new file mode 100644 index 000000000..5e3c65b64 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Articulo.java @@ -0,0 +1,164 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "ARTICULO_SEQ", sequenceName = "ARTICULO_SEQ", allocationSize = 1) +@Table(name = "ARTICULO") +public class Articulo implements Serializable { + + public static final Integer TIPO_VENDA = 1; + public static final Integer TIPO_OUTRO = 2; + public static final Integer TIPO_VENDA_MANUAL = 3; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ARTICULO_SEQ") + @Column(name = "ARTICULO_ID") + private Integer articuloId; + @Column(name = "DESCARTICULO") + private String descarticulo; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "articulo") + private List abastoBoletoList; + @OneToMany(mappedBy = "articulo") + private List requisicionBoletoList; + @OneToOne(mappedBy = "articulo") + private Clasificacion clasificacion; + + public Articulo() { + } + + public Articulo(Integer articuloId) { + this.articuloId = articuloId; + } + + public Integer getArticuloId() { + return articuloId; + } + + public void setArticuloId(Integer articuloId) { + this.articuloId = articuloId; + } + + public String getDescarticulo() { + return descarticulo; + } + + public void setDescarticulo(String descarticulo) { + this.descarticulo = descarticulo; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getAbastoBoletoList() { + return abastoBoletoList; + } + + public void setAbastoBoletoList(List abastoBoletoList) { + this.abastoBoletoList = abastoBoletoList; + } + + public List getRequisicionBoletoList() { + return requisicionBoletoList; + } + + public void setRequisicionBoletoList(List requisicionBoletoList) { + this.requisicionBoletoList = requisicionBoletoList; + } + + public Clasificacion getClasificacion() { + return clasificacion; + } + + public void setClasificacion(Clasificacion clasificacion) { + this.clasificacion = clasificacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (articuloId != null ? articuloId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Articulo)) { + return false; + } + Articulo other = (Articulo) object; + if ((this.articuloId == null && other.articuloId != null) || (this.articuloId != null && !this.articuloId.equals(other.articuloId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Articulo[articuloId=" + articuloId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AsientoExclusivo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AsientoExclusivo.java new file mode 100644 index 000000000..cac7ec89f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AsientoExclusivo.java @@ -0,0 +1,193 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "ASIENTO_EXCLUSIVO_SEQ", sequenceName = "ASIENTO_EXCLUSIVO_SEQ", allocationSize = 1) +@Table(name = "ASIENTO_EXCLUSIVO") +public class AsientoExclusivo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ASIENTOEXCLUSIVO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ASIENTO_EXCLUSIVO_SEQ") + private Long asientoexclusivoId; + @Basic(optional = false) + @Column(name = "NUMASIENTO") + private String numasiento; + @Column(name = "VENDIBLE") + private Boolean vendible; + @Column(name = "TIEMPOLIBERACION") + private Integer tiempoLiberacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "MOTIVOBLOQUEO") + private String motivobloqueo; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @OneToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA")}) + private Corrida corrida; + @OneToOne + @JoinColumn(name = "DESTINO_ID",referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "PARADA_ID") + private Parada parada; + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public AsientoExclusivo() { + } + + public Long getAsientoexclusivoId() { + return asientoexclusivoId; + } + + public void setAsientoexclusivoId(Long asientoexclusivoId) { + this.asientoexclusivoId = asientoexclusivoId; + } + + public String getNumasiento() { + return numasiento; + } + + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } + + public Boolean getVendible() { + return vendible; + } + + public void setVendible(Boolean vendible) { + this.vendible = vendible; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getMotivobloqueo() { + return motivobloqueo; + } + + public void setMotivobloqueo(String motivobloqueo) { + this.motivobloqueo = motivobloqueo; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Integer getTiempoLiberacion() { + return tiempoLiberacion; + } + + public void setTiempoLiberacion(Integer tiempoLiberacion) { + this.tiempoLiberacion = tiempoLiberacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (asientoexclusivoId != null ? asientoexclusivoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AsientoExclusivo)) { + return false; + } + AsientoExclusivo other = (AsientoExclusivo) object; + if ((this.asientoexclusivoId == null && other.asientoexclusivoId != null) || (this.asientoexclusivoId != null && !this.asientoexclusivoId.equals(other.asientoexclusivoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AsientoExclusivo[asientoexclusivoId=" + asientoexclusivoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Autobus.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Autobus.java new file mode 100644 index 000000000..e84736dd8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Autobus.java @@ -0,0 +1,306 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "AUTOBUS_SEQ", sequenceName = "AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "AUTOBUS") +public class Autobus implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "AUTOBUS_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTOBUS_SEQ") + private Integer autobusId; + @Column(name = "NUMAUTOBUS") + private String numautobus; + @Column(name = "CANTPARADOS") + private Integer cantparados; + @Column(name = "DESCMODELO") + private String descmodelo; + @Column(name = "ANO") + private Integer ano; + @Column(name = "INDBANO") + private Boolean indbano; + @Column(name = "INDVIDEO") + private Boolean indvideo; + @Column(name = "INDAIRE") + private Boolean indaire; + @Column(name = "NUMMATRICULA") + private String nummatricula; + @Column(name = "PATRON") + private String patron; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DIAGRAMAAUTOBUS_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobus; + @JoinColumn(name = "DIAGRAMAAUTOBUS2_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobusPiso; + @OneToMany(mappedBy = "autobus") + private List corridaList; + @JoinColumn(name = "MARCAAUTOBUS_ID", referencedColumnName = "MARCAAUTOBUS_ID") + @ManyToOne + private MarcaAutobus marcaAutobus; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CIUDAD_ID", referencedColumnName = "CIUDAD_ID") + @ManyToOne + private Ciudad ciudad; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @OneToMany(mappedBy = "autobus", cascade = CascadeType.ALL) + private List autobusDocList; + @Column(name = "NUMVAGON") + private String numvagon; + + public Autobus() { + } + + public Autobus(Integer autobusId) { + this.autobusId = autobusId; + } + + public Integer getAutobusId() { + return autobusId; + } + + public void setAutobusId(Integer autobusId) { + this.autobusId = autobusId; + } + + public String getNumautobus() { + return numautobus; + } + + public void setNumautobus(String numautobus) { + this.numautobus = numautobus; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public DiagramaAutobus getDiagramaAutobus() { + return diagramaAutobus; + } + + public void setDiagramaAutobus(DiagramaAutobus diagramaAutobus) { + this.diagramaAutobus = diagramaAutobus; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public DiagramaAutobus getDiagramaAutobusPiso() { + return diagramaAutobusPiso; + } + + public void setDiagramaAutobusPiso(DiagramaAutobus diagramaAutobusPiso) { + this.diagramaAutobusPiso = diagramaAutobusPiso; + } + + public Integer getCantparados() { + return cantparados; + } + + public void setCantparados(Integer cantparados) { + this.cantparados = cantparados; + } + + public String getDescmodelo() { + return descmodelo; + } + + public void setDescmodelo(String descmodelo) { + this.descmodelo = descmodelo; + } + + public Integer getAno() { + return ano; + } + + public void setAno(Integer ano) { + this.ano = ano; + } + + public Boolean getIndbano() { + return indbano; + } + + public void setIndbano(Boolean indbano) { + this.indbano = indbano; + } + + public Boolean getIndvideo() { + return indvideo; + } + + public void setIndvideo(Boolean indvideo) { + this.indvideo = indvideo; + } + + public Boolean getIndaire() { + return indaire; + } + + public void setIndaire(Boolean indaire) { + this.indaire = indaire; + } + + public String getNummatricula() { + return nummatricula; + } + + public void setNummatricula(String nummatricula) { + this.nummatricula = nummatricula; + } + + public String getPatron() { + return patron; + } + + public void setPatron(String patron) { + this.patron = patron; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (autobusId != null ? autobusId.hashCode() : 0); + return hash; + } + + public MarcaAutobus getMarcaAutobus() { + return marcaAutobus; + } + + public void setMarcaAutobus(MarcaAutobus marcaAutobus) { + this.marcaAutobus = marcaAutobus; + } + + public List getAutobusDocList() { + return autobusDocList; + } + + public void setAutobusDocList(List autobusDocList) { + this.autobusDocList = autobusDocList; + } + + public void addDoc(AutobusDoc doc){ + this.autobusDocList.add(doc); + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public void removeDoc(AutobusDoc doc){ + this.autobusDocList.remove(doc); + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Autobus)) { + return false; + } + Autobus other = (Autobus) object; + if ((this.autobusId == null && other.autobusId != null) || (this.autobusId != null && !this.autobusId.equals(other.autobusId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNumautobus(); + } + + public String getNumvagon() { + return numvagon; + } + + public void setNumvagon(String numvagon) { + this.numvagon = numvagon; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java new file mode 100644 index 000000000..684f27865 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java @@ -0,0 +1,100 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "AUTOBUS_DOC_SEQ", sequenceName = "AUTOBUS_DOC_SEQ", allocationSize = 1) +@Table(name = "AUTOBUS_DOC") +public class AutobusDoc { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "AUTOBUSDOC_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTOBUS_DOC_SEQ") + private Integer autobusDocId; + @ManyToOne + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + private Autobus autobus; + @JoinColumn(name = "TIPODOCAUTOBUS_ID", referencedColumnName = "TIPODOCAUTOBUS_ID") + @ManyToOne + private TipoDocAutobus tipoDocAutobus; + @Column(name = "FECHACADUCIDAD") + private Date fechaCaducidad; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getAutobusDocId() { + return autobusDocId; + } + public void setAutobusDocId(Integer autobusDocId) { + this.autobusDocId = autobusDocId; + } + public Autobus getAutobus() { + return autobus; + } + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + public TipoDocAutobus getTipoDocAutobus() { + return tipoDocAutobus; + } + public void setTipoDocAutobus(TipoDocAutobus tipoDocAutobus) { + this.tipoDocAutobus = tipoDocAutobus; + } + public Date getFechaCaducidad() { + return fechaCaducidad; + } + public void setFechaCaducidad(Date fechaCaducidad) { + this.fechaCaducidad = fechaCaducidad; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AutobusDoc)) { + return false; + } + AutobusDoc other = (AutobusDoc) object; + if ((this.autobusDocId == null && other.autobusDocId != null) || (this.autobusDocId != null && !this.autobusDocId.equals(other.autobusDocId))) { + return false; + } + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Autorizacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Autorizacion.java new file mode 100644 index 000000000..26f7d7313 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Autorizacion.java @@ -0,0 +1,126 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "AUTORIZACION_SEQ", sequenceName = "AUTORIZACION_SEQ", allocationSize = 1) +@Table(name = "AUTORIZACION") +public class Autorizacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTORIZACION_SEQ") + @Column(name = "AUTORIZACION_ID") + private Integer autorizacionId; + @Column(name = "NOMBAUTORIZACION") + private String nombautorizacion; + @Column(name = "DESCAUTORIZACION") + private String descautorizacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Autorizacion() { + } + + public Autorizacion(Integer autorizacionId) { + this.autorizacionId = autorizacionId; + } + + public Integer getAutorizacionId() { + return autorizacionId; + } + + public void setAutorizacionId(Integer autorizacionId) { + this.autorizacionId = autorizacionId; + } + + public String getNombautorizacion() { + return nombautorizacion; + } + + public void setNombautorizacion(String nombautorizacion) { + this.nombautorizacion = nombautorizacion; + } + + public String getDescautorizacion() { + return descautorizacion; + } + + public void setDescautorizacion(String descautorizacion) { + this.descautorizacion = descautorizacion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (autorizacionId != null ? autorizacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Autorizacion)) { + return false; + } + Autorizacion other = (Autorizacion) object; + if ((this.autorizacionId == null && other.autorizacionId != null) || (this.autorizacionId != null && !this.autorizacionId.equals(other.autorizacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombautorizacion(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AutorizacionPerfil.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AutorizacionPerfil.java new file mode 100644 index 000000000..fc5b966f6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/AutorizacionPerfil.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "AUTORIZACION_PERFIL_SEQ", sequenceName = "AUTORIZACION_PERFIL_SEQ", allocationSize = 1) +@Table(name = "AUTORIZACION_PERFIL") +public class AutorizacionPerfil implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTORIZACION_PERFIL_SEQ") + @Column(name = "AUTORIZACIONPERFIL_ID") + private Integer autorizacionperfilId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "AUTORIZACION_ID") + private Autorizacion autorizacion; + @OneToOne + @JoinColumn(name = "PERFIL_ID") + private Perfil perfil; + + public AutorizacionPerfil() { + } + + public AutorizacionPerfil(Integer autorizacionperfilId) { + this.autorizacionperfilId = autorizacionperfilId; + } + + public Integer getAutorizacionperfilId() { + return autorizacionperfilId; + } + + public void setAutorizacionperfilId(Integer autorizacionperfilId) { + this.autorizacionperfilId = autorizacionperfilId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Autorizacion getAutorizacion() { + return autorizacion; + } + + public void setAutorizacion(Autorizacion autorizacion) { + this.autorizacion = autorizacion; + } + + public Perfil getPerfil() { + return perfil; + } + + public void setPerfil(Perfil perfil) { + this.perfil = perfil; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (autorizacionperfilId != null ? autorizacionperfilId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AutorizacionPerfil)) { + return false; + } + AutorizacionPerfil other = (AutorizacionPerfil) object; + if ((this.autorizacionperfilId == null && other.autorizacionperfilId != null) || (this.autorizacionperfilId != null && !this.autorizacionperfilId.equals(other.autorizacionperfilId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil[autorizacionperfilId=" + autorizacionperfilId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Banco.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Banco.java new file mode 100644 index 000000000..eb2ccfd5d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Banco.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "BANCO") +@SequenceGenerator(name = "BANCO_SEQ", sequenceName = "BANCO_SEQ", allocationSize = 1) +public class Banco implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "BANCO_SEQ") + @Column(name = "BANCO_ID") + private Integer bancoId; + @Column(name = "REFCONTRATO") + private String refcontrato; + @Column(name = "NOMBBANCO") + private String nombbanco; + @Column(name = "NUMCUENTA") + private BigDecimal numcuenta; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + + public Banco() { + } + + public Banco(Integer bancoId) { + this.bancoId = bancoId; + } + + public Integer getBancoId() { + return bancoId; + } + + public void setBancoId(Integer bancoId) { + this.bancoId = bancoId; + } + + public String getRefcontrato() { + return refcontrato; + } + + public void setRefcontrato(String refcontrato) { + this.refcontrato = refcontrato; + } + + public String getNombbanco() { + return nombbanco; + } + + public void setNombbanco(String nombbanco) { + this.nombbanco = nombbanco; + } + + public BigDecimal getNumcuenta() { + return numcuenta; + } + + public void setNumcuenta(BigDecimal numcuenta) { + this.numcuenta = numcuenta; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (bancoId != null ? bancoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Banco)) { + return false; + } + Banco other = (Banco) object; + if ((this.bancoId == null && other.bancoId != null) || (this.bancoId != null && !this.bancoId.equals(other.bancoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Banco[bancoId=" + bancoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CancelacionCargo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CancelacionCargo.java new file mode 100644 index 000000000..388da6aa8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CancelacionCargo.java @@ -0,0 +1,160 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CANCELACION_CARGO_SEQ", sequenceName = "CANCELACION_CARGO_SEQ", allocationSize = 1) +@Table(name = "CANCELACION_CARGO") +public class CancelacionCargo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CANCELACION_CARGO_SEQ") + @Column(name = "CANCELACIONCARGO_ID") + private Integer cancelacioncargoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "PORCCARGO") + private BigDecimal porccargo; + @Column(name = "IMPORTECARGO") + private BigDecimal importecargo; + @Column(name = "TIEMPOMINIMO") + private BigDecimal tiempominimo; + @Column(name = "TIEMPOMAXIMO") + private BigDecimal tiempomaximo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CANCELACIONCTRL_ID", referencedColumnName = "CANCELACIONCTRL_ID") + @ManyToOne + private CancelacionCtrl cancelacionCtrl; + + public CancelacionCargo() { + } + + public CancelacionCargo(Integer cancelacioncargoId) { + this.cancelacioncargoId = cancelacioncargoId; + } + + public Integer getCancelacioncargoId() { + return cancelacioncargoId; + } + + public void setCancelacioncargoId(Integer cancelacioncargoId) { + this.cancelacioncargoId = cancelacioncargoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public BigDecimal getPorccargo() { + return porccargo; + } + + public void setPorccargo(BigDecimal porccargo) { + this.porccargo = porccargo; + } + + public BigDecimal getImportecargo() { + return importecargo; + } + + public void setImportecargo(BigDecimal importecargo) { + this.importecargo = importecargo; + } + + public BigDecimal getTiempomaximo() { + return tiempomaximo; + } + + public void setTiempomaximo(BigDecimal tiempomaximo) { + this.tiempomaximo = tiempomaximo; + } + + public BigDecimal getTiempominimo() { + return tiempominimo; + } + + public void setTiempominimo(BigDecimal tiempominimo) { + this.tiempominimo = tiempominimo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CancelacionCtrl getCancelacionCtrl() { + return cancelacionCtrl; + } + + public void setCancelacionCtrl(CancelacionCtrl cancelacionCtrl) { + this.cancelacionCtrl = cancelacionCtrl; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cancelacioncargoId != null ? cancelacioncargoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CancelacionCargo)) { + return false; + } + CancelacionCargo other = (CancelacionCargo) object; + if ((this.cancelacioncargoId == null && other.cancelacioncargoId != null) || (this.cancelacioncargoId != null && !this.cancelacioncargoId.equals(other.cancelacioncargoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.CancelacionCargo[cancelacioncargoId=" + cancelacioncargoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CancelacionCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CancelacionCtrl.java new file mode 100644 index 000000000..20a089663 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CancelacionCtrl.java @@ -0,0 +1,222 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CANCELACION_CTRL_SEQ", sequenceName = "CANCELACION_CTRL_SEQ", allocationSize = 1) +@Table(name = "CANCELACION_CTRL") +public class CancelacionCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CANCELACION_CTRL_SEQ") + @Column(name = "CANCELACIONCTRL_ID") + private Integer cancelacionctrlId; + @Column(name = "TIEMPOPREVSALIDA") + @Temporal(TemporalType.TIME) + private Date tiempoprevsalida; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaOrigem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaDestino; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @ManyToOne + @JoinColumn(name = "MOTIVOCANCELACION_ID", referencedColumnName = "MOTIVOCANCELACION_ID") + private MotivoCancelacion motivoCancelacion; + @OneToMany(mappedBy = "cancelacionCtrl", cascade = CascadeType.ALL) + private List cancelacionCargoList; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + + public CancelacionCtrl() { + } + + public CancelacionCtrl(Integer cancelacionctrlId) { + this.cancelacionctrlId = cancelacionctrlId; + } + + public Integer getCancelacionctrlId() { + return cancelacionctrlId; + } + + public void setCancelacionctrlId(Integer cancelacionctrlId) { + this.cancelacionctrlId = cancelacionctrlId; + } + + public Date getTiempoprevsalida() { + return tiempoprevsalida; + } + + public void setTiempoprevsalida(Date tiempoprevsalida) { + this.tiempoprevsalida = tiempoprevsalida; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Parada getParadaDestino() { + return paradaDestino; + } + + public void setParadaDestino(Parada paradaDestino) { + this.paradaDestino = paradaDestino; + } + + public Parada getParadaOrigem() { + return paradaOrigem; + } + + public void setParadaOrigem(Parada paradaOrigem) { + this.paradaOrigem = paradaOrigem; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public MotivoCancelacion getMotivoCancelacion() { + return motivoCancelacion; + } + + public void setMotivoCancelacion(MotivoCancelacion motivoCancelacion) { + this.motivoCancelacion = motivoCancelacion; + } + + public List getCancelacionCargoList() { + List tmp = new ArrayList(); + if (cancelacionCargoList != null) { + for (CancelacionCargo cc : this.cancelacionCargoList) { + if (cc.getActivo()) { + tmp.add(cc); + } + } + } + + return tmp; + } + + public void setCancelacionCargoList(List cancelacionCargoList) { + this.cancelacionCargoList = cancelacionCargoList; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cancelacionctrlId != null ? cancelacionctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof CancelacionCtrl)) { + return false; + } + CancelacionCtrl other = (CancelacionCtrl) object; + if ((this.cancelacionctrlId == null && other.cancelacionctrlId != null) || (this.cancelacionctrlId != null && !this.cancelacionctrlId.equals(other.cancelacionctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CancelacionCtrl[cancelacionctrlId=" + cancelacionctrlId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CasetaPeaje.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CasetaPeaje.java new file mode 100644 index 000000000..a2e966055 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CasetaPeaje.java @@ -0,0 +1,138 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CASETA_PEAJE_SEQ", sequenceName = "CASETA_PEAJE_SEQ", allocationSize = 1) +@Table(name = "CASETA_PEAJE") +public class CasetaPeaje implements Serializable, Comparable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CASETA_PEAJE_SEQ") + @Column(name = "CASETAPEAJE_ID") + private Integer casetaPeajeId; + @Column(name = "DESCCASETA") + private String desccaseta; + @Column(name = "IMPORTEIDA") + private BigDecimal importeIda; + @Column(name = "IMPORTEVUELTA") + private BigDecimal importeVuelta; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToMany(fetch=FetchType.EAGER) + @JoinTable(name = "RUTA_CASETA", joinColumns = { @JoinColumn(name = "CASETAPEAJE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "RUTASECUENCIA_ID") }) + private List lsRutaSecuencia; + + + @Override + public int hashCode() { + int hash = 0; + hash += casetaPeajeId != null ? casetaPeajeId.hashCode() : 0; + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof CasetaPeaje)) { + return false; + } + CasetaPeaje other = (CasetaPeaje) object; + if ((this.casetaPeajeId == null && other.casetaPeajeId != null) || (this.casetaPeajeId != null && !this.casetaPeajeId.equals(other.casetaPeajeId))) { + return false; + } + return true; + } + + public CasetaPeaje(){ + lsRutaSecuencia = new ArrayList(); + } + + public Integer getCasetaPeajeId() { + return casetaPeajeId; + } + public void setCasetaPeajeId(Integer casetaPeajeId) { + this.casetaPeajeId = casetaPeajeId; + } + public String getDesccaseta() { + return desccaseta; + } + public void setDesccaseta(String desccaseta) { + this.desccaseta = desccaseta; + } + public BigDecimal getImporteIda() { + return importeIda; + } + public void setImporteIda(BigDecimal importeIda) { + this.importeIda = importeIda; + } + public BigDecimal getImporteVuelta() { + return importeVuelta; + } + public void setImporteVuelta(BigDecimal importeVuelta) { + this.importeVuelta = importeVuelta; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getCasetaPeajeId() + " - " +getDesccaseta(); + } + + @Override + public int compareTo(CasetaPeaje caseta) { + return this.getDesccaseta().compareTo(caseta.getDesccaseta()); + } + + public List getLsRutaSecuencia() { + return lsRutaSecuencia; + } + + public void setLsRutaSecuencia(List lsRutaSecuencia) { + this.lsRutaSecuencia = lsRutaSecuencia; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Categoria.java new file mode 100644 index 000000000..5865733e5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Categoria.java @@ -0,0 +1,220 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_SEQ", sequenceName = "CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA") +public class Categoria implements Serializable { + public static Integer CATEGORIA_NORMAL = 1; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_SEQ") + @Column(name = "CATEGORIA_ID") + private Integer categoriaId; + @Column(name = "DESCCATEGORIA") + private String desccategoria; + @Column(name = "ACTIVO") + private Boolean activo; + // CAmpos retirados + // @Column(name = "INDVENDEINTERNET") + // private Boolean vendeInternet; + // @Column(name = "INDVENDEAGENCIAWEB") + // private Boolean vendeAgenciaWeb; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + private List categoriaDescuentoList; + @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + private List reservacionCategoriaList; + + @JoinColumn(name = "GRUPOCATEGORIA_ID", referencedColumnName = "GRUPOCATEGORIA_ID") + @ManyToOne() + private GrupoCategoria grupoCategoria; + + @Column(name = "INDCONFERENCIAFISICACOMISSAO") + private Boolean indconferenciafisicacomissao; + + @Column(name = "INDEMITETERMORECUSA") + private Boolean indemitetermorecusa; + + @Column(name = "CVECATEGORIA") + private String cvecategoria; + + @Column(name = "DESCIMPRESIONGRATUIDADE") + private String descImpresionGratuidade; + + public Categoria() { + } + + public Categoria(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public Integer getCategoriaId() { + return categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public GrupoCategoria getGrupoCategoria() { + return grupoCategoria; + } + + public void setGrupoCategoria(GrupoCategoria grupoCategoria) { + this.grupoCategoria = grupoCategoria; + } + + public List getCategoriaDescuentoList() { + // return categoriaDescuentoList; + List rcList = new ArrayList(); + for (CategoriaDescuento rc : this.categoriaDescuentoList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + return rcList; + } + + public void setCategoriaDescuentoList(List categoriaDescuentoList) { + this.categoriaDescuentoList = categoriaDescuentoList; + } + + public List getReservacionCategoriaList() { + // return reservacionCategoriaList; + List rcList = new ArrayList(); + for (ReservacionCategoria rc : this.reservacionCategoriaList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + return rcList; + } + + public void setReservacionCategoriaList(List reservacionCategoriaList) { + this.reservacionCategoriaList = reservacionCategoriaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (categoriaId != null ? categoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof Categoria)) { + return false; + } + Categoria other = (Categoria) object; + if ((this.categoriaId == null && other.categoriaId != null) || (this.categoriaId != null && !this.categoriaId.equals(other.categoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDesccategoria(); + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public Boolean getIndemitetermorecusa() { + return indemitetermorecusa; + } + + public void setIndemitetermorecusa(Boolean indemitetermorecusa) { + this.indemitetermorecusa = indemitetermorecusa; + } + + public String getCvecategoria() { + return cvecategoria; + } + + public void setCvecategoria(String cvecategoria) { + this.cvecategoria = cvecategoria; + } + + public String getDescImpresionGratuidade() { + return descImpresionGratuidade; + } + + public void setDescImpresionGratuidade(String descImpresionGratuidade) { + this.descImpresionGratuidade = descImpresionGratuidade; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaClase.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaClase.java new file mode 100644 index 000000000..903cfa681 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaClase.java @@ -0,0 +1,135 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_CLASE_SEQ", sequenceName = "CATEGORIA_CLASE_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_CLASE") +public class CategoriaClase implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_CLASE_SEQ") + @Column(name = "CATEGORIACLASE_ID") + private Integer categoriaclaseId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaClase() { + } + + public CategoriaClase(Integer categoriaclaseId) { + this.categoriaclaseId = categoriaclaseId; + } + + public Integer getCategoriaclaseId() { + return categoriaclaseId; + } + + public void setCategoriaclaseId(Integer categoriaclaseId) { + this.categoriaclaseId = categoriaclaseId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaClase other = (CategoriaClase) obj; + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + (this.claseServicio != null ? this.claseServicio.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaClase[categoriaclaseId=" + categoriaclaseId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaCorrida.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaCorrida.java new file mode 100644 index 000000000..261eee1e8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaCorrida.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_CORRIDA_SEQ", sequenceName = "CATEGORIA_CORRIDA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_CORRIDA") +public class CategoriaCorrida implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_CORRIDA_SEQ") + @Column(name = "CATEGORIA_CORRIDA") + private Integer categoriaCorrida; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID") + @ManyToOne + @NotFound(action=NotFoundAction.IGNORE) + private CorridaCtrl corridaCtrl; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + @NotFound(action=NotFoundAction.IGNORE) + private CategoriaCtrl categoriaCtrl; + + public CategoriaCorrida() { + } + + public CategoriaCorrida(Integer categoriaCorrida) { + this.categoriaCorrida = categoriaCorrida; + } + + public Integer getCategoriaCorrida() { + return categoriaCorrida; + } + + public void setCategoriaCorrida(Integer categoriaCorrida) { + this.categoriaCorrida = categoriaCorrida; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CorridaCtrl getCorridaCtrl() { + return corridaCtrl; + } + + public void setCorridaCtrl(CorridaCtrl corridaCtrl) { + this.corridaCtrl = corridaCtrl; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaCorrida other = (CategoriaCorrida) obj; + if (this.corridaCtrl != other.corridaCtrl && (this.corridaCtrl == null || !this.corridaCtrl.equals(other.corridaCtrl))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + (this.corridaCtrl != null ? this.corridaCtrl.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaCorrida[categoriaCorrida=" + categoriaCorrida + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaCtrl.java new file mode 100644 index 000000000..c465b28a8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaCtrl.java @@ -0,0 +1,302 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_CTRL_SEQ", sequenceName = "CATEGORIA_CTRL_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_CTRL") +public class CategoriaCtrl implements Serializable { + + public final static Integer[] idsCategoriasNoVisible = {1}; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_CTRL_SEQ") + @Column(name = "CATEGORIACTRL_ID") + private Integer categoriactrlId; + @JoinColumn(name = "EMPRESA_ID") + @OneToOne + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaDescuentoList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaClaseList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaMarcaList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + @NotFound(action=NotFoundAction.IGNORE) + private List categoriaCorridaList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaMercadoList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaCtrl") + private List categoriaOrgaoList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaCtrl") + private List categoriaRutaList; + + public CategoriaCtrl() { + + } + + public CategoriaCtrl(Integer categoriactrlId) { + this.categoriactrlId = categoriactrlId; + } + + public CategoriaCtrl(Integer categoriactrlId, Date fecmodif) { + this.categoriactrlId = categoriactrlId; + this.fecmodif = fecmodif; + } + + public Integer getCategoriactrlId() { + return categoriactrlId; + } + + public void setCategoriactrlId(Integer categoriactrlId) { + this.categoriactrlId = categoriactrlId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + /** + * Regresa las categorias que son visibles al usuario. + * Ejemplo de categoria que no es visible: ADULTO - Id = 1 + * @return + */ + public List getCategoriaDescuentoVisiblesList() { + List listCategoriasVisibles = new ArrayList(); + List lsCategorias = getCategoriaDescuentoList(); + + for (CategoriaDescuento cd : lsCategorias) { + boolean esVisible = true; + for (Integer id : idsCategoriasNoVisible) { + if(cd.getCategoria()!=null){ + if (id.equals(cd.getCategoria().getCategoriaId())) { + esVisible = false; + } + } + } + + if (esVisible) { + listCategoriasVisibles.add(cd); + } + } + + return listCategoriasVisibles; + } + + public List getCategoriaDescuentoList() { + //return categoriaDescuentoList; + + List tmp = new ArrayList(); + if (categoriaDescuentoList != null) { + for (CategoriaDescuento cm : this.categoriaDescuentoList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaDescuentoList(List categoriaDescuentoList) { + this.categoriaDescuentoList = categoriaDescuentoList; + } + + public List getCategoriaClaseList() { + //return categoriaClaseList; + List tmp = new ArrayList(); + if (categoriaClaseList != null) { + for (CategoriaClase cm : this.categoriaClaseList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaClaseList(List categoriaClaseList) { + this.categoriaClaseList = categoriaClaseList; + } + + public List getCategoriaOrgaoList() { + //return categoriaMarcaList; + List tmp = new ArrayList(); + if (categoriaMercadoList != null) { + for (CategoriaOrgao cm : this.categoriaOrgaoList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public List getCategoriaRutaList() { + List tmp = new ArrayList(); + if (categoriaRutaList != null) { + for (CategoriaRuta cm : this.categoriaRutaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaorgaoList(List categoriaOrgaoList) { + this.categoriaOrgaoList = categoriaOrgaoList; + } + + public void setCategoriarutaList(List categoriaRutaList) { + this.categoriaRutaList = categoriaRutaList; + } + + public List getCategoriaMarcaList() { + //return categoriaMarcaList; + List tmp = new ArrayList(); + if (categoriaMercadoList != null) { + for (CategoriaMarca cm : this.categoriaMarcaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaMarcaList(List categoriaMarcaList) { + this.categoriaMarcaList = categoriaMarcaList; + } + + public List getCategoriaCorridaList() { + //return categoriaCorridaList; + List tmp = new ArrayList(); + if (categoriaCorridaList != null) { + for (CategoriaCorrida cm : this.categoriaCorridaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaCorridaList(List categoriaCorridaList) { + this.categoriaCorridaList = categoriaCorridaList; + } + + public List getCategoriaMercadoList() { + List tmp = new ArrayList(); + if (categoriaMercadoList != null) { + for (CategoriaMercado cm : this.categoriaMercadoList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaMercadoList(List categoriaMercadoList) { + this.categoriaMercadoList = categoriaMercadoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (categoriactrlId != null ? categoriactrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CategoriaCtrl)) { + return false; + } + CategoriaCtrl other = (CategoriaCtrl) object; + if ((this.categoriactrlId == null && other.categoriactrlId != null) || (this.categoriactrlId != null && !this.categoriactrlId.equals(other.categoriactrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaCtrl[categoriactrlId=" + categoriactrlId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java new file mode 100644 index 000000000..fb5c75543 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java @@ -0,0 +1,482 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.springframework.transaction.annotation.Transactional; + +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_DESCUENTO_SEQ", sequenceName = "CATEGORIA_DESCUENTO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_DESCUENTO") +public class CategoriaDescuento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_DESCUENTO_SEQ") + @Column(name = "CATEGORIADESCUENTO_ID") + private Integer categoriadescuentoId; + @Column(name = "CANTAUTORIZADA") + private Integer cantautorizada; + @Column(name = "DESCUENTOPORC") + private BigDecimal descuentoporc; + @Column(name = "DESCUENTOIMPORTE") + private BigDecimal descuentoimporte; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne(cascade = CascadeType.ALL) + private CategoriaCtrl categoriaCtrl; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + @OneToMany(mappedBy = "categoriaDescuento", cascade = CascadeType.ALL) + private List categoriaPeriodoList; + @Column(name = "INDIMPRIMEBOLETO") + private Boolean indImprimeBoleto; + @Column(name = "INDCUOTA") + private Boolean indCuota; + @Column(name = "INDCUOTATRAMO") + private Boolean indCuotaTramo; + @Column(name = "TIEMPOCUOTA") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoCuota; + @Column(name = "INDAPLICAFERIADO") + private String indAplicaFeriado; + @Column(name = "INDIMPORTEOUTROS") + private Boolean indImporteOutros; + @Column(name = "INDIMPORTESEGURO") + private Boolean indImporteSeguro; + @Column(name = "INDIMPORTETXEMBARQUE") + private Boolean indImporteTxEmbarque; + @Column(name = "INDIMPORTEPEDAGIO") + private Boolean indImportePedagio; + @Column(name = "TIEMPOACTIVAR") + private Integer tiempoActivar; + @Column(name = "TIEMPODESACTIVAR") + private Integer tiempoDesactivar; + @Column(name = "INDVENTAABIERTO") + private Boolean indVentaAbierto; + @Column(name = "INDVENTASOLAMENTERESERVA") + private Boolean indVentaSolamenteReserva; + @Column(name = "INDLIBERACIONSOLAMENTEENVASADO") + private Boolean indLiberacionSolamenteEnvasado; + @Column(name = "ASIENTOSRESERVADOS") + private String asientosReservados; + + @Column(name = "INDEXIGENOMBPASAJERO") + private Boolean indexigenombpasajero; + @Column(name = "INDEXIGEDOCPASAJERO") + private Boolean indexigedocpasajero; + @Column(name = "INDEXIGETELEFONOPASAJERO") + private Boolean indexigetelefonopasajero; + @Column(name = "INDEXIGEFECNACIMIENTOPASAJERO") + private Boolean indexigefecnacimientopasajero; + @Column(name = "INDEXIGEDOC2PASSAGEIRO") + private Boolean indExigeDoc2Passageiro; + + public enum DisponibilidadeFeriado { + // Declaração dos enum + GERARSEMPRE("SEMPRE", "S"), + + GERARQUANDOFERIADO("SÓ QUANDO FOR FERIADO", "F"), + + GERARQUANDONAOFERIADO("QUANDO NÃO FOR FERIADO", "N"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private DisponibilidadeFeriado(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + } + + public CategoriaDescuento() { + } + + public CategoriaDescuento(Integer categoriadescuentoId) { + this.categoriadescuentoId = categoriadescuentoId; + } + + public CategoriaDescuento(Integer categoriadescuentoId, Date fecmodif) { + this.categoriadescuentoId = categoriadescuentoId; + this.fecmodif = fecmodif; + } + + public Integer getCategoriadescuentoId() { + return categoriadescuentoId; + } + + public void setCategoriadescuentoId(Integer categoriadescuentoId) { + this.categoriadescuentoId = categoriadescuentoId; + } + + public Integer getCantautorizada() { + return cantautorizada; + } + + public void setCantautorizada(Integer cantautorizada) { + this.cantautorizada = cantautorizada; + } + + public BigDecimal getDescuentoporc() { + return descuentoporc; + } + + public void setDescuentoporc(BigDecimal descuentoporc) { + this.descuentoporc = descuentoporc; + } + + public BigDecimal getDescuentoimporte() { + return descuentoimporte; + } + + public void setDescuentoimporte(BigDecimal descuentoimporte) { + this.descuentoimporte = descuentoimporte; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public List getCategoriaPeriodoList() { + List tmp = new ArrayList(); + if (categoriaPeriodoList != null) { + for (CategoriaPeriodo cp : this.categoriaPeriodoList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setCategoriaPeriodoList(List categoriaPeriodoList) { + this.categoriaPeriodoList = categoriaPeriodoList; + } + + public Boolean getIndImprimeBoleto() { + return indImprimeBoleto; + } + + public void setIndImprimeBoleto(Boolean indImprimeBoleto) { + this.indImprimeBoleto = indImprimeBoleto; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaDescuento other = (CategoriaDescuento) obj; + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + if (this.categoria != other.categoria && (this.categoria == null || !this.categoria.equals(other.categoria))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 53 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + hash = 53 * hash + (this.categoria != null ? this.categoria.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaDescuento[categoriadescuentoId=" + categoriadescuentoId + "]"; + } + + public Boolean getIndCuota() { + return indCuota; + } + + public void setIndCuota(Boolean indCuota) { + this.indCuota = indCuota; + } + + public Boolean getIndCuotaTramo() { + return indCuotaTramo; + } + + public void setIndCuotaTramo(Boolean indCuotaTramo) { + this.indCuotaTramo = indCuotaTramo; + } + + public Date getTiempoCuota() { + return tiempoCuota; + } + + public void setTiempoCuota(Date tiempoCuota) { + this.tiempoCuota = tiempoCuota; + } + + public String getIndAplicaFeriado() { + return indAplicaFeriado; + } + + public void setIndAplicaFeriado(String indAplicaFeriado) { + this.indAplicaFeriado = indAplicaFeriado; + } + + public Boolean getIndImporteOutros() { + return indImporteOutros; + } + + public void setIndImporteOutros(Boolean indImporteOutros) { + this.indImporteOutros = indImporteOutros; + } + + public Boolean getIndImporteSeguro() { + return indImporteSeguro; + } + + public void setIndImporteSeguro(Boolean indImporteSeguro) { + this.indImporteSeguro = indImporteSeguro; + } + + public Boolean getIndImporteTxEmbarque() { + return indImporteTxEmbarque; + } + + public void setIndImporteTxEmbarque(Boolean indImporteTxEmbarque) { + this.indImporteTxEmbarque = indImporteTxEmbarque; + } + + public Boolean getIndImportePedagio() { + return indImportePedagio; + } + + public void setIndImportePedagio(Boolean indImportePedagio) { + this.indImportePedagio = indImportePedagio; + } + + public Integer getTiempoActivar() { + return tiempoActivar; + } + + public void setTiempoActivar(Integer hora, Integer minuto) { + setTiempoDesactivar(null); + hora = (hora == null) ? 0 : hora; + minuto = (minuto == null) ? 0 : minuto; + + int totalMinutos = (hora * 60) + minuto; + setTiempoActivar((totalMinutos == 0) ? null : totalMinutos); + } + + public void setTiempoActivar(Integer tiempoActivar) { + this.tiempoActivar = tiempoActivar; + } + + public Integer getTiempoDesactivar() { + return tiempoDesactivar; + } + + public void setTiempoDesactivar(Integer hora, Integer minuto) { + setTiempoActivar(null); + hora = (hora == null) ? 0 : hora; + minuto = (minuto == null) ? 0 : minuto; + + int totalMinutos = (hora * 60) + minuto; + setTiempoDesactivar((totalMinutos == 0) ? null : totalMinutos); + } + + public void setTiempoDesactivar(Integer tiempoDesactivar) { + this.tiempoDesactivar = tiempoDesactivar; + } + + public Boolean getIndVentaAbierto() { + return indVentaAbierto; + } + + public void setIndVentaAbierto(Boolean indVentaAbierto) { + this.indVentaAbierto = indVentaAbierto; + } + + public Boolean getIndVentaSolamenteReserva() { + return indVentaSolamenteReserva; + } + + public void setIndVentaSolamenteReserva(Boolean indVentaSolamenteReserva) { + this.indVentaSolamenteReserva = indVentaSolamenteReserva; + } + + public Boolean getIndLiberacionSolamenteEnvasado() { + return indLiberacionSolamenteEnvasado; + } + + public void setIndLiberacionSolamenteEnvasado(Boolean indLiberacionSolamenteEnvasado) { + this.indLiberacionSolamenteEnvasado = indLiberacionSolamenteEnvasado; + } + + public String getAsientosReservados() { + return asientosReservados; + } + + public void setAsientosReservados(String asientosReservados) { + this.asientosReservados = asientosReservados; + } + + public Boolean getIndexigenombpasajero() { + return indexigenombpasajero; + } + + public void setIndexigenombpasajero(Boolean indexigenombpasajero) { + this.indexigenombpasajero = indexigenombpasajero; + } + + public Boolean getIndexigedocpasajero() { + return indexigedocpasajero; + } + + public void setIndexigedocpasajero(Boolean indexigedocpasajero) { + this.indexigedocpasajero = indexigedocpasajero; + } + + public Boolean getIndexigetelefonopasajero() { + return indexigetelefonopasajero; + } + + public void setIndexigetelefonopasajero(Boolean indexigetelefonopasajero) { + this.indexigetelefonopasajero = indexigetelefonopasajero; + } + + public Boolean getIndexigefecnacimientopasajero() { + return indexigefecnacimientopasajero; + } + + public void setIndexigefecnacimientopasajero(Boolean indexigefecnacimientopasajero) { + this.indexigefecnacimientopasajero = indexigefecnacimientopasajero; + } + + public Boolean getIndExigeDoc2Passageiro() { + return indExigeDoc2Passageiro; + } + + public void setIndExigeDoc2Passageiro(Boolean indExigeDoc2Passageiro) { + this.indExigeDoc2Passageiro = indExigeDoc2Passageiro; + } + + @Transactional + public String getExigeCamposPasajeroVenta() { + + StringBuilder sCampos = new StringBuilder(); + + if(getIndexigenombpasajero() != null && getIndexigenombpasajero()) { + sCampos.append("NO"); + } + + if(getIndexigedocpasajero() != null && getIndexigedocpasajero()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("DO"); + } + if(getIndexigetelefonopasajero() != null && getIndexigetelefonopasajero()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("TL"); + } + if(getIndexigefecnacimientopasajero() != null && getIndexigefecnacimientopasajero()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("DT"); + } + if(getIndExigeDoc2Passageiro() != null && getIndExigeDoc2Passageiro()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("DOC2"); + } + return sCampos.toString(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaMarca.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaMarca.java new file mode 100644 index 000000000..c56c1c4e4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaMarca.java @@ -0,0 +1,136 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_MARCA_SEQ", sequenceName = "CATEGORIA_MARCA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_MARCA") +public class CategoriaMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_MARCA_SEQ") + @Column(name = "CATEGORIAMARCA_ID") + private Integer categoriamarcaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaMarca() { + } + + public CategoriaMarca(Integer categoriamarcaId) { + this.categoriamarcaId = categoriamarcaId; + } + + public Integer getCategoriamarcaId() { + return categoriamarcaId; + } + + public void setCategoriamarcaId(Integer categoriamarcaId) { + this.categoriamarcaId = categoriamarcaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaMarca other = (CategoriaMarca) obj; + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.marca != null ? this.marca.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaMarca[categoriamarcaId=" + categoriamarcaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaMercado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaMercado.java new file mode 100644 index 000000000..93d186f21 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaMercado.java @@ -0,0 +1,147 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_MERCADO_SEQ", sequenceName = "CATEGORIA_MERCADO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_MERCADO") +public class CategoriaMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_MERCADO_SEQ") + @Column(name = "CATEGORIAMERCADO_ID") + private Integer categoriamercadoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaMercado() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + public Integer getCategoriamercadoId() { + return categoriamercadoId; + } + + public void setCategoriamercadoId(Integer categoriamercadoId) { + this.categoriamercadoId = categoriamercadoId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaMercado other = (CategoriaMercado) obj; + if (this.destino != other.destino && (this.destino == null || !this.destino.equals(other.destino))) { + return false; + } + if (this.origem != other.origem && (this.origem == null || !this.origem.equals(other.origem))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 11 * hash + (this.destino != null ? this.destino.hashCode() : 0); + hash = 11 * hash + (this.origem != null ? this.origem.hashCode() : 0); + hash = 11 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaMercado[categoriamercadoId=" + categoriamercadoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java new file mode 100644 index 000000000..7e7e4f71d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java @@ -0,0 +1,133 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CATEGORIA_ORGAO_SEQ", sequenceName = "CATEGORIA_ORGAO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_ORGAO") +public class CategoriaOrgao implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_ORGAO_SEQ") + @Column(name = "CATEGORIAORGAO_ID") + private Integer categoriaorgaoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgao; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaOrgao() { + } + + public CategoriaOrgao(Integer categoriaorgaoId) { + this.categoriaorgaoId = categoriaorgaoId; + } + + + + public Integer getCategoriaorgaoId() { + return categoriaorgaoId; + } + + public void setCategoriaorgaoId(Integer categoriaorgaoId) { + this.categoriaorgaoId = categoriaorgaoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + + public OrgaoConcedente getOrgao() { + return orgao; + } + + public void setOrgao(OrgaoConcedente orgao) { + this.orgao = orgao; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaOrgao other = (CategoriaOrgao) obj; + if (this.orgao != other.orgao && (this.orgao == null || !this.orgao.equals(other.orgao))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.orgao != null ? this.orgao.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriaorgaoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaPeriodo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaPeriodo.java new file mode 100644 index 000000000..0fe015d8c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaPeriodo.java @@ -0,0 +1,157 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_PERIODO_SEQ", sequenceName = "CATEGORIA_PERIODO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_PERIODO") +public class CategoriaPeriodo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_PERIODO_SEQ") + @Column(name = "CATEGORIAPERIODO_ID") + private Integer categoriaperiodoId; + @Column(name = "FECINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicio; + @Column(name = "FECFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfin; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CATEGORIADESCUENTO_ID", referencedColumnName = "CATEGORIADESCUENTO_ID") + @ManyToOne + private CategoriaDescuento categoriaDescuento; + + public CategoriaPeriodo() { + } + + public CategoriaPeriodo(Integer categoriaperiodoId) { + this.categoriaperiodoId = categoriaperiodoId; + } + + public CategoriaPeriodo(Integer categoriaperiodoId, Date fecmodif) { + this.categoriaperiodoId = categoriaperiodoId; + this.fecmodif = fecmodif; + } + + public Integer getCategoriaperiodoId() { + return categoriaperiodoId; + } + + public void setCategoriaperiodoId(Integer categoriaperiodoId) { + this.categoriaperiodoId = categoriaperiodoId; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecfin() { + return fecfin; + } + + public void setFecfin(Date fecfin) { + this.fecfin = fecfin; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CategoriaDescuento getCategoriaDescuento() { + return categoriaDescuento; + } + + public void setCategoriaDescuento(CategoriaDescuento categoriaDescuento) { + this.categoriaDescuento = categoriaDescuento; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaPeriodo other = (CategoriaPeriodo) obj; + if (this.fecinicio != other.fecinicio && (this.fecinicio == null || !this.fecinicio.equals(other.fecinicio))) { + return false; + } + if (this.fecfin != other.fecfin && (this.fecfin == null || !this.fecfin.equals(other.fecfin))) { + return false; + } + if (this.categoriaDescuento != other.categoriaDescuento && (this.categoriaDescuento == null || !this.categoriaDescuento.equals(other.categoriaDescuento))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 19 * hash + (this.fecinicio != null ? this.fecinicio.hashCode() : 0); + hash = 19 * hash + (this.fecfin != null ? this.fecfin.hashCode() : 0); + hash = 19 * hash + (this.categoriaDescuento != null ? this.categoriaDescuento.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo[categoriaperiodoId=" + categoriaperiodoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaRuta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaRuta.java new file mode 100644 index 000000000..3fbe9d17d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaRuta.java @@ -0,0 +1,131 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CATEGORIA_RUTA_SEQ", sequenceName = "CATEGORIA_RUTA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_RUTA") +public class CategoriaRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_RUTA_SEQ") + @Column(name = "CATEGORIARUTA_ID") + private Integer categoriarutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaRuta() { + } + + public CategoriaRuta(Integer categoriarutaId) { + this.categoriarutaId = categoriarutaId; + } + + public Integer getCategoriarutaId() { + return categoriarutaId; + } + + public void setCategoriarutaId(Integer categoriarutaId) { + this.categoriarutaId = categoriarutaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaRuta other = (CategoriaRuta) obj; + if (this.ruta != other.ruta && (this.ruta == null || !this.ruta.equals(other.ruta))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.ruta != null ? this.ruta.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriarutaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaTipoPtoVta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaTipoPtoVta.java new file mode 100644 index 000000000..62887adad --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CategoriaTipoPtoVta.java @@ -0,0 +1,150 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_TIPOPTOVTA_SEQ", sequenceName = "CATEGORIA_TIPOPTOVTA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_TIPOPTOVTA") +public class CategoriaTipoPtoVta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_TIPOPTOVTA_SEQ") + @Column(name = "CATEGORIATIPOPTOVTA_ID") + private Integer categoriatipoptovtaId; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPuntoVenta; + + public CategoriaTipoPtoVta() { + } + + public CategoriaTipoPtoVta(Integer categoriatipoptovtaId) { + this.categoriatipoptovtaId = categoriatipoptovtaId; + } + + public CategoriaTipoPtoVta(Integer categoriatipoptovtaId, Boolean activo, Date fecmodif, int usuarioId) { + this.categoriatipoptovtaId = categoriatipoptovtaId; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getCategoriatipoptovtaId() { + return categoriatipoptovtaId; + } + + public void setCategoriatipoptovtaId(Integer categoriatipoptovtaId) { + this.categoriatipoptovtaId = categoriatipoptovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaTipoPtoVta other = (CategoriaTipoPtoVta) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.categoria != other.categoria && (this.categoria == null || !this.categoria.equals(other.categoria))) { + return false; + } + if (this.tipoPuntoVenta != other.tipoPuntoVenta && (this.tipoPuntoVenta == null || !this.tipoPuntoVenta.equals(other.tipoPuntoVenta))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 61 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 61 * hash + (this.categoria != null ? this.categoria.hashCode() : 0); + hash = 61 * hash + (this.tipoPuntoVenta != null ? this.tipoPuntoVenta.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaTipoptovta[categoriatipoptovtaId=" + categoriatipoptovtaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Ciudad.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Ciudad.java new file mode 100644 index 000000000..3ef539834 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Ciudad.java @@ -0,0 +1,199 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CIUDAD_SEQ", sequenceName = "CIUDAD_SEQ", allocationSize = 1) +@Table(name = "CIUDAD") +public class Ciudad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CIUDAD_SEQ") + @Column(name = "CIUDAD_ID") + private Integer ciudadId; + @Column(name = "NOMBCIUDAD") + private String nombciudad; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estado; + @OneToOne + @JoinColumn(name = "PLAZA_ID") + private Plaza plaza; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "INDZONAHORARIA") + private Integer zonaHoraria; + @OneToMany(mappedBy = "coloniaId") + private List lsColonia; + @Column(name = "CODMUNICIPIO") + private Integer codmunicipio; + @Column(name = "CODIBGE") + private Integer codibge; + + public Ciudad() { + } + + public Ciudad(Integer ciudadId) { + this.ciudadId = ciudadId; + } + + public Integer getCiudadId() { + return ciudadId; + } + + public void setCiudadId(Integer ciudadId) { + this.ciudadId = ciudadId; + } + + public String getNombciudad() { + return nombciudad; + } + + public void setNombciudad(String nombciudad) { + this.nombciudad = nombciudad; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public Plaza getPlaza() { + return plaza; + } + + public void setPlaza(Plaza plaza) { + this.plaza = plaza; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Integer getZonaHoraria() { + return zonaHoraria; + } + + public void setZonaHoraria(Integer zonaHoraria) { + this.zonaHoraria = zonaHoraria; + } + + public Integer getCodmunicipio() { + return codmunicipio; + } + + public void setCodmunicipio(Integer codmunicipio) { + this.codmunicipio = codmunicipio; + } + @Override + public int hashCode() { + int hash = 0; + hash += (ciudadId != null ? ciudadId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Ciudad)) { + return false; + } + Ciudad other = (Ciudad) object; + if ((this.getCiudadId() == null && other.getCiudadId() != null) || (this.getCiudadId() != null && !this.getCiudadId().equals(other.getCiudadId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombciudad() + ", " + this.getEstado().getNombestado(); + } + + /** + * @return the lsColonia + */ + public List getLsColonia() { + return lsColonia; + } + + /** + * @param lsColonia the lsColonia to set + */ + public void setLsColonia(List lsColonia) { + this.lsColonia = lsColonia; + } + + public Integer getCodibge() { + return codibge; + } + + public void setCodibge(Integer codibge) { + this.codibge = codibge; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java new file mode 100644 index 000000000..99bda5f73 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java @@ -0,0 +1,213 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CLASE_SERVICIO_SEQ", sequenceName = "CLASE_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "CLASE_SERVICIO") +public class ClaseServicio implements Serializable { + + public final static short TODOS = -1; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASE_SERVICIO_SEQ") + @Column(name = "CLASESERVICIO_ID") + private Integer claseservicioId; + @Column(name = "DESCCLASE") + private String descclase; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "claseServicio") + private List categoriaClaseList; + @OneToMany(mappedBy = "claseServicio") + private List reservacionClaseList; + @OneToMany(mappedBy = "claseServicio") + private List tramoTiempoList; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "EQUIVALENCIAELEKTRA_ID") + private String equivalenciaElektraId; + @OneToMany(mappedBy = "claseServicio") + private List tarifaHistList; + @OneToMany(mappedBy = "claseServicio") + private List corridaList; + + public ClaseServicio() { + } + + public ClaseServicio(Integer claseservicioId) { + this.claseservicioId = claseservicioId; + } + + public ClaseServicio(Integer claseservicioId, Date fecmodif) { + this.claseservicioId = claseservicioId; + this.fecmodif = fecmodif; + } + + public Integer getClaseservicioId() { + return claseservicioId; + } + + public void setClaseservicioId(Integer claseservicioId) { + this.claseservicioId = claseservicioId; + } + + public String getDescclase() { + return descclase; + } + + public void setDescclase(String descclase) { + this.descclase = descclase; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCategoriaClaseList() { + List tmp = new ArrayList(); + if (categoriaClaseList != null) { + for (CategoriaClase cc : this.categoriaClaseList) { + if (cc.getActivo()) { + tmp.add(cc); + } + } + } + + return tmp; + } + + public void setCategoriaClaseList(List categoriaClaseList) { + this.categoriaClaseList = categoriaClaseList; + } + + public List getReservacionClaseList() { + List tmp = new ArrayList(); + for (ReservacionClase rc : this.reservacionClaseList) { + if (rc.getActivo()) { + tmp.add(rc); + } + } + + return tmp; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public void setReservacionClaseList(List reservacionClaseList) { + this.reservacionClaseList = reservacionClaseList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (claseservicioId != null ? claseservicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ClaseServicio)) { + return false; + } + ClaseServicio other = (ClaseServicio) object; + if ((this.claseservicioId == null && other.claseservicioId != null) || (this.claseservicioId != null && !this.claseservicioId.equals(other.claseservicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescclase(); + } + + public List getTramoTiempoList() { + return tramoTiempoList; + } + + public void setTramoTiempoList(List tramoTiempoList) { + this.tramoTiempoList = tramoTiempoList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } + + public String getEquivalenciaElektraId() { + return equivalenciaElektraId; + } + + public void setEquivalenciaElektraId(String equivalenciaElektraId) { + this.equivalenciaElektraId = equivalenciaElektraId; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClaseservicioEquivalencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClaseservicioEquivalencia.java new file mode 100644 index 000000000..67c195690 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClaseservicioEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CLASESERVICIO_EQUIVALENCIA_SEQ", sequenceName = "CLASESERVICIO_EQUIVALENCIA_SEQ", allocationSize = 1) +@Table(name = "CLASESERVICIO_EQUIVALENCIA") +public class ClaseservicioEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASESERVICIO_EQUIVALENCIA_SEQ") + @Column(name = "CLASESERVICIOEQUIVALENCIA_ID") + private Integer claseservicioequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + private ClaseServicio claseservicio; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public ClaseservicioEquivalencia() { + } + + public ClaseservicioEquivalencia(Integer claseservicioequivalenciaId) { + this.claseservicioequivalenciaId = claseservicioequivalenciaId; + } + + public Integer getClaseservicioequivalenciaId() { + return claseservicioequivalenciaId; + } + + public void setClaseservicioequivalenciaId(Integer claseservicioequivalenciaId) { + this.claseservicioequivalenciaId = claseservicioequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + public ClaseServicio getClaseservicio() { + return claseservicio; + } + + public void setClaseservicio(ClaseServicio claseservicio) { + this.claseservicio = claseservicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (claseservicioequivalenciaId != null ? claseservicioequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ClaseservicioEquivalencia)) { + return false; + } + ClaseservicioEquivalencia other = (ClaseservicioEquivalencia) object; + if ((this.claseservicioequivalenciaId == null && other.claseservicioequivalenciaId != null) || (this.claseservicioequivalenciaId != null && !this.claseservicioequivalenciaId.equals(other.claseservicioequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia[ claseservicioequivalenciaId=" + claseservicioequivalenciaId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Clasificacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Clasificacion.java new file mode 100644 index 000000000..597a47862 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Clasificacion.java @@ -0,0 +1,149 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLASIFICACION_SEQ", sequenceName = "CLASIFICACION_SEQ", allocationSize = 1) +@Table(name = "CLASIFICACION") +public class Clasificacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASIFICACION_SEQ") + @Column(name = "CLASIFICACION_ID") + private Integer clasificacionId; + @Column(name = "DESCCLASIFICACION") + private String descclasificacion; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID") + @OneToOne + private Articulo articulo; + @OneToMany(mappedBy = "clasificacion", cascade = CascadeType.ALL) + private List abastoBoletoList; + @OneToMany(mappedBy = "clasificacion", cascade = CascadeType.ALL) + private List requisicionBoletoList; + + public Integer getClasificacionId() { + return clasificacionId; + } + + public void setClasificacionId(Integer clasificacionId) { + this.clasificacionId = clasificacionId; + } + + public String getDescclasificacion() { + return descclasificacion; + } + + public void setDescclasificacion(String descclasificacion) { + this.descclasificacion = descclasificacion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Articulo getArticulo() { + return articulo; + } + + public void setArticulo(Articulo articulo) { + this.articulo = articulo; + } + + public List getAbastoBoletoList() { + return abastoBoletoList; + } + + public void setAbastoBoletoList(List abastoBoletoList) { + this.abastoBoletoList = abastoBoletoList; + } + + public List getRequisicionBoletoList() { + return requisicionBoletoList; + } + + public void setRequisicionBoletoList(List requisicionBoletoList) { + this.requisicionBoletoList = requisicionBoletoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (clasificacionId != null ? clasificacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Pricing)) { + return false; + } + Clasificacion other = (Clasificacion) object; + if ((this.clasificacionId == null && other.clasificacionId != null) || (this.clasificacionId != null && !this.clasificacionId.equals(other.clasificacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Clasificacion[clasificacionId=" + clasificacionId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Cliente.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Cliente.java new file mode 100644 index 000000000..0a855ce17 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Cliente.java @@ -0,0 +1,497 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.annotations.Where; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "CLIENTE_SEQ", sequenceName = "CLIENTE_SEQ", allocationSize = 1) +@Table(name = "CLIENTE") +public class Cliente implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_SEQ") + @Column(name = "CLIENTE_ID") + private Integer clienteId; + @Column(name = "NOMBCLIENTE") + private String nombcliente; + @Column(name = "APELLIDOPATERNO") + private String apellidopaterno; + @Column(name = "APELLIDOMATERNO") + private String apellidomaterno; + @Column(name = "FECNACIMIENTO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecnacimiento; + @Column(name = "NUMRFC") + private String numrfc; + @Column(name = "NUMTELEFONO") + private String numtelefono; + @Column(name = "NUMTELEFONODOS") + private String numtelefonodos; + @Column(name = "NUMFAX") + private String numfax; + @Column(name = "NUMEXTENSION") + private String numextension; + @Column(name = "NUMEXTENSIONDOS") + private String numextensiondos; + @JoinColumn(name = "TIPOOCUPACION_ID") + @OneToOne(cascade = CascadeType.ALL) + private TipoOcupacion tipoocupacionId; + @Column(name = "MEDIOINFORMATIVO_ID") + private Integer medioinformativoId; + @JoinColumn(name = "MOTIVOVIAJE_ID") + @OneToOne(cascade = CascadeType.ALL) + private MotivoViaje motivoviajeId; + @Column(name = "INDSEXO") + private String indsexo; + @Column(name = "NUMCURP") + private String numcurp; + @Column(name = "CANTHIJOS") + private Integer canthijos; + @Column(name = "DESCCORREO") + private String desccorreo; + @Column(name = "EDAD") + private Integer edad; + @Column(name = "ESTADOCIVIL_ID") + private Integer estadocivilId; + @Column(name = "GRADOESTUDIO_ID") + private Integer gradoestudioId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "DESCCONTRASENA") + private String desccontrasena; + @Column(name = "NUMLADA") + private String numlada; + @Column(name = "INDCAMBIOCONTRASENA") + private Integer indcambiocontrasena; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "clienteId") + private List lsClienteDireccion; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @Where(clause = "activo=1") + private List listClienteFidelidad; + @Column(name = "NUMIDENTIFICAUNO") + private String numIdentificaUno; + @Column(name = "NUMIDENTIFICADOS") + private String numIdentificaDos; + @Column(name = "INDBLOQUEO") + private Boolean indBloqueo; + @JoinColumn(name = "TIPOIDENTIFICAUNO_ID") + @OneToOne + private TipoIdentificacion tipoIdentificacionUno; + @JoinColumn(name = "TIPOIDENTIFICADOS_ID") + @OneToOne + private TipoIdentificacion tipoIdentificacionDos; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + private List lsClienteDescuento; + + @ManyToMany + @JoinTable(name = "CLIENTE_CURSO", joinColumns = { @JoinColumn(name = "CLIENTE_ID") }, inverseJoinColumns = { @JoinColumn(name = "CURSO_ID") }) + private List cursoList; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "ESCOLA_ID", referencedColumnName = "ESCOLA_ID") + private Escola escola; + + public Cliente() { + } + + public Cliente(Integer clienteId) { + this.clienteId = clienteId; + } + + public Integer getClienteId() { + return clienteId; + } + + public void setClienteId(Integer clienteId) { + this.clienteId = clienteId; + } + + public String getNombcliente() { + return nombcliente; + } + + public void setNombcliente(String nombcliente) { + this.nombcliente = nombcliente; + } + + public String getApellidopaterno() { + return apellidopaterno; + } + + public void setApellidopaterno(String apellidopaterno) { + this.apellidopaterno = apellidopaterno; + } + + public String getApellidomaterno() { + return apellidomaterno; + } + + public void setApellidomaterno(String apellidomaterno) { + this.apellidomaterno = apellidomaterno; + } + + public Date getFecnacimiento() { + return fecnacimiento; + } + + public void setFecnacimiento(Date fecnacimiento) { + this.fecnacimiento = fecnacimiento; + } + + public String getNumrfc() { + return numrfc; + } + + public void setNumrfc(String numrfc) { + this.numrfc = numrfc; + } + + public String getNumtelefono() { + return numtelefono; + } + + public void setNumtelefono(String numtelefono) { + this.numtelefono = numtelefono; + } + + public String getNumtelefonodos() { + return numtelefonodos; + } + + public void setNumtelefonodos(String numtelefonodos) { + this.numtelefonodos = numtelefonodos; + } + + public String getNumfax() { + return numfax; + } + + public void setNumfax(String numfax) { + this.numfax = numfax; + } + + public String getNumextension() { + return numextension; + } + + public void setNumextension(String numextension) { + this.numextension = numextension; + } + + public String getNumextensiondos() { + return numextensiondos; + } + + public void setNumextensiondos(String numextensiondos) { + this.numextensiondos = numextensiondos; + } + + public TipoOcupacion getTipoocupacionId() { + return tipoocupacionId; + } + + public void setTipoocupacionId(TipoOcupacion tipoocupacionId) { + this.tipoocupacionId = tipoocupacionId; + } + + public Integer getMedioinformativoId() { + return medioinformativoId; + } + + public void setMedioinformativoId(Integer medioinformativoId) { + this.medioinformativoId = medioinformativoId; + } + + public MotivoViaje getMotivoviajeId() { + return motivoviajeId; + } + + public void setMotivoviajeId(MotivoViaje motivoviajeId) { + this.motivoviajeId = motivoviajeId; + } + + public String getIndsexo() { + return indsexo; + } + + public void setIndsexo(String indsexo) { + this.indsexo = indsexo; + } + + public String getNumcurp() { + return numcurp; + } + + public void setNumcurp(String numcurp) { + this.numcurp = numcurp; + } + + public Integer getCanthijos() { + return canthijos; + } + + public void setCanthijos(Integer canthijos) { + this.canthijos = canthijos; + } + + public String getDesccorreo() { + return desccorreo; + } + + public void setDesccorreo(String desccorreo) { + this.desccorreo = desccorreo; + } + + public Integer getEdad() { + return edad; + } + + public void setEdad(Integer edad) { + this.edad = edad; + } + + public Integer getEstadocivilId() { + return estadocivilId; + } + + public void setEstadocivilId(Integer estadocivilId) { + this.estadocivilId = estadocivilId; + } + + public Integer getGradoestudioId() { + return gradoestudioId; + } + + public void setGradoestudioId(Integer gradoestudioId) { + this.gradoestudioId = gradoestudioId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getDesccontrasena() { + return desccontrasena; + } + + public void setDesccontrasena(String desccontrasena) { + this.desccontrasena = desccontrasena; + } + + public String getNumlada() { + return numlada; + } + + public void setNumlada(String numlada) { + this.numlada = numlada; + } + + public Integer getIndcambiocontrasena() { + return indcambiocontrasena; + } + + public void setIndcambiocontrasena(Integer indcambiocontrasena) { + this.indcambiocontrasena = indcambiocontrasena; + } + + public List getLsClienteDireccion() { + return lsClienteDireccion; + } + + public void setLsClienteDireccion(List lsClienteDireccion) { + this.lsClienteDireccion = lsClienteDireccion; + } + + public List getListClienteFidelidad() { + return listClienteFidelidad; + } + + public void setListClienteFidelidad(List listClienteFidelidad) { + this.listClienteFidelidad = listClienteFidelidad; + } + + public String getNumIdentificaUno() { + return numIdentificaUno; + } + + public void setNumIdentificaUno(String numIdentificaUno) { + this.numIdentificaUno = numIdentificaUno; + } + + public String getNumIdentificaDos() { + return numIdentificaDos; + } + + public void setNumIdentificaDos(String numIdentificaDos) { + this.numIdentificaDos = numIdentificaDos; + } + + public Boolean getIndBloqueo() { + return indBloqueo; + } + + public void setIndBloqueo(Boolean indBloqueo) { + this.indBloqueo = indBloqueo; + } + + public TipoIdentificacion getTipoIdentificacionUno() { + return tipoIdentificacionUno; + } + + public void setTipoIdentificacionUno(TipoIdentificacion tipoIdentificacionUno) { + this.tipoIdentificacionUno = tipoIdentificacionUno; + } + + public TipoIdentificacion getTipoIdentificacionDos() { + return tipoIdentificacionDos; + } + + public void setTipoIdentificacionDos(TipoIdentificacion tipoIdentificacionDos) { + this.tipoIdentificacionDos = tipoIdentificacionDos; + } + + public List getLsClienteDescuento() { + return lsClienteDescuento; + } + + public void setLsClienteDescuento(List lsClienteDescuento) { + this.lsClienteDescuento = lsClienteDescuento; + } + + public List getCursoList() { + + List aux = new ArrayList(); + if (cursoList == null) { + return aux; + } + + for (Curso curso : cursoList) { + if (curso.getActivo()) { + aux.add(curso); + } + } + + return aux; + } + + public void setCursoList(List cursoList) { + this.cursoList = cursoList; + } + + public Escola getEscola() { + return escola; + } + + public void setEscola(Escola escola) { + this.escola = escola; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (clienteId != null ? clienteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Cliente)) { + return false; + } + Cliente other = (Cliente) object; + if ((this.clienteId == null && other.clienteId != null) || (this.clienteId != null && !this.clienteId.equals(other.clienteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Cliente[ clienteId=" + clienteId + " ]"; + } + + @Transient + public List getListClienteFidelidadActivos() { + List lsActivos = new ArrayList(); + + if (getListClienteFidelidad() != null) + for (ClienteFidelidad clienteFidelidad : getListClienteFidelidad()) { + if (clienteFidelidad.getActivo() && clienteFidelidad.getTarjetaFidelidad().getActivo()) { + lsActivos.add(clienteFidelidad); + } + } + + return lsActivos; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteCurso.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteCurso.java new file mode 100644 index 000000000..904631029 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteCurso.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLIENTE_CURSO_SEQ", sequenceName = "CLIENTE_CURSO_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_CURSO") +public class ClienteCurso implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_CURSO_SEQ") + @Column(name = "CLIENTECURSO_ID") + private Integer clientecursoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "CURSO_ID", referencedColumnName = "CURSO_ID") + @ManyToOne + private Curso curso; + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @ManyToOne + private Cliente cliente; + + public Integer getClientecursoId() { + return clientecursoId; + } + + public void setClientecursoId(Integer clientecursoId) { + this.clientecursoId = clientecursoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Curso getCurso() { + return curso; + } + + public void setCurso(Curso curso) { + this.curso = curso; + } + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteDescuento.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteDescuento.java new file mode 100644 index 000000000..fb47eb09e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteDescuento.java @@ -0,0 +1,231 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLIENTE_DESCUENTO_SEQ", sequenceName = "CLIENTE_DESCUENTO_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_DESCUENTO") +public class ClienteDescuento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_DESCUENTO_SEQ") + @Column(name = "CLIENTEDESCUENTO_ID") + private Integer clienteDescuentoId; + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @ManyToOne + private Cliente cliente; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @Column(name = "CANTMAXMES") + private Integer cantMaxMes; + @Column(name = "INDLUNES") + private Boolean INDLUNES; + @Column(name = "INDMARTES") + private Boolean INDMARTES; + @Column(name = "INDMIERCOLES") + private Boolean INDMIERCOLES; + @Column(name = "INDJUEVES") + private Boolean INDJUEVES; + @Column(name = "INDVIERNES") + private Boolean INDVIERNES; + @Column(name = "INDSABADO") + private Boolean INDSABADO; + @Column(name = "INDDOMINGO") + private Boolean INDDOMINGO; + @Column(name = "INDFORMAVALIDACIONESTUDIANTE") + private String indFormaValidacionEstudiante; + @Column(name = "FECINI") + @Temporal(TemporalType.DATE) + private Date fecIni; + @Column(name = "FECFIN") + @Temporal(TemporalType.DATE) + private Date FecFin; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getClienteDescuentoId() { + return clienteDescuentoId; + } + + public void setClienteDescuentoId(Integer clienteDescuentoId) { + this.clienteDescuentoId = clienteDescuentoId; + } + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Integer getCantMaxMes() { + return cantMaxMes; + } + + public void setCantMaxMes(Integer cantMaxMes) { + this.cantMaxMes = cantMaxMes; + } + + public Boolean getINDLUNES() { + return INDLUNES; + } + + public void setINDLUNES(Boolean iNDLUNES) { + INDLUNES = iNDLUNES; + } + + public Boolean getINDMARTES() { + return INDMARTES; + } + + public void setINDMARTES(Boolean iNDMARTES) { + INDMARTES = iNDMARTES; + } + + public Boolean getINDMIERCOLES() { + return INDMIERCOLES; + } + + public void setINDMIERCOLES(Boolean iNDMIERCOLES) { + INDMIERCOLES = iNDMIERCOLES; + } + + public Boolean getINDJUEVES() { + return INDJUEVES; + } + + public void setINDJUEVES(Boolean iNDJUEVES) { + INDJUEVES = iNDJUEVES; + } + + public Boolean getINDVIERNES() { + return INDVIERNES; + } + + public void setINDVIERNES(Boolean iNDVIERNES) { + INDVIERNES = iNDVIERNES; + } + + public Boolean getINDSABADO() { + return INDSABADO; + } + + public void setINDSABADO(Boolean iNDSABADO) { + INDSABADO = iNDSABADO; + } + + public Boolean getINDDOMINGO() { + return INDDOMINGO; + } + + public void setINDDOMINGO(Boolean iNDDOMINGO) { + INDDOMINGO = iNDDOMINGO; + } + + public Date getFecIni() { + return fecIni; + } + + public void setFecIni(Date fecIni) { + this.fecIni = fecIni; + } + + public Date getFecFin() { + return FecFin; + } + + public void setFecFin(Date fecFin) { + FecFin = fecFin; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getIndFormaValidacionEstudiante() { + return indFormaValidacionEstudiante; + } + + public void setIndFormaValidacionEstudiante(String indFormaValidacionEstudiante) { + this.indFormaValidacionEstudiante = indFormaValidacionEstudiante; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ClienteDescuento[ clienteDescuentoId=" + clienteDescuentoId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteDireccion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteDireccion.java new file mode 100644 index 000000000..058ba6151 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteDireccion.java @@ -0,0 +1,294 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author RJ + */ +@Entity + +@SequenceGenerator(name = "CLIENTE_DIRECCION_SEQ", sequenceName = "CLIENTE_DIRECCION_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_DIRECCION") + +public class ClienteDireccion implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_DIRECCION_SEQ") + @Column(name = "CLIENTEDIRECCION_ID") + private Integer clientedireccionId; + + @Column(name = "DESCCALLE") + private String desccalle; + + @Column(name = "DESCCALLECOMP") + private String desccallecomp; + + @Column(name = "DESCDELEGACION") + private String descdelegacion; + + @JoinColumn(name = "TIPODOMICILIO_ID") + @OneToOne(cascade=CascadeType.ALL) + private TipoDomicilio tipodomicilioId; + + @Column(name = "DESCPLANO") + private String descplano; + + @Column(name = "DESCCOORDENADA") + private String desccoordenada; + + @Column(name = "FECHORINICIOENTREGA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorinicioentrega; + + @Column(name = "FECHORFINENTREGA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorfinentrega; + + @Column(name = "COLONIA_ID") + private Integer coloniaId; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NUMINTERIOR") + private String numinterior; + @Column(name = "NUMEXTERIOR") + private String numexterior; + @Column(name = "DESCCOLONIA") + private String desccolonia; + @Column(name = "CODPOSTAL") + private String codpostal; + @Column(name = "DESCIUDAD") + private String desciudad; + @Column(name = "DESESTADO") + private String desestado; + + + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @ManyToOne + private Cliente clienteId; + + + public ClienteDireccion() { + + } + + public ClienteDireccion(Integer clientedireccionId) { + this.clientedireccionId = clientedireccionId; + } + + public Integer getClientedireccionId() { + return clientedireccionId; + } + + public void setClientedireccionId(Integer clientedireccionId) { + this.clientedireccionId = clientedireccionId; + } + + + public Cliente getClienteId() { + return clienteId; + } + + public void setClienteId(Cliente clienteId) { + this.clienteId = clienteId; + } + + public String getDesccalle() { + return desccalle; + } + + public void setDesccalle(String desccalle) { + this.desccalle = desccalle; + } + + public String getDesccallecomp() { + return desccallecomp; + } + + public void setDesccallecomp(String desccallecomp) { + this.desccallecomp = desccallecomp; + } + + public String getDescdelegacion() { + return descdelegacion; + } + + public void setDescdelegacion(String descdelegacion) { + this.descdelegacion = descdelegacion; + } + + public TipoDomicilio getTipodomicilioId() { + return tipodomicilioId; + } + + public void setTipodomicilioId(TipoDomicilio tipodomicilioId) { + this.tipodomicilioId = tipodomicilioId; + } + + public String getDescplano() { + return descplano; + } + + public void setDescplano(String descplano) { + this.descplano = descplano; + } + + public String getDesccoordenada() { + return desccoordenada; + } + + public void setDesccoordenada(String desccoordenada) { + this.desccoordenada = desccoordenada; + } + + public Date getFechorinicioentrega() { + return fechorinicioentrega; + } + + public void setFechorinicioentrega(Date fechorinicioentrega) { + this.fechorinicioentrega = fechorinicioentrega; + } + + public Date getFechorfinentrega() { + return fechorfinentrega; + } + + public void setFechorfinentrega(Date fechorfinentrega) { + this.fechorfinentrega = fechorfinentrega; + } + + public Integer getColoniaId() { + return coloniaId; + } + + public void setColoniaId(Integer coloniaId) { + this.coloniaId = coloniaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNuminterior() { + return numinterior; + } + + public void setNuminterior(String numinterior) { + this.numinterior = numinterior; + } + + public String getNumexterior() { + return numexterior; + } + + public void setNumexterior(String numexterior) { + this.numexterior = numexterior; + } + + public String getDesccolonia() { + return desccolonia; + } + + public void setDesccolonia(String desccolonia) { + this.desccolonia = desccolonia; + } + + public String getCodpostal() { + return codpostal; + } + + public void setCodpostal(String codpostal) { + this.codpostal = codpostal; + } + + public String getDesciudad() { + return desciudad; + } + + public void setDesciudad(String desciudad) { + this.desciudad = desciudad; + } + + public String getDesestado() { + return desestado; + } + + public void setDesestado(String desestado) { + this.desestado = desestado; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (clientedireccionId != null ? clientedireccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ClienteDireccion)) { + return false; + } + ClienteDireccion other = (ClienteDireccion) object; + if ((this.clientedireccionId == null && other.clientedireccionId != null) || (this.clientedireccionId != null && !this.clientedireccionId.equals(other.clientedireccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ClienteDireccion[ clientedireccionId=" + clientedireccionId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteFidelidad.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteFidelidad.java new file mode 100644 index 000000000..d50ee3e0d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClienteFidelidad.java @@ -0,0 +1,129 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLIENTE_FIDELIDAD_SEQ", sequenceName = "CLIENTE_FIDELIDAD_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_FIDELIDAD") +public class ClienteFidelidad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_FIDELIDAD_SEQ") + @Column(name = "CLIENTEFIDELIDAD_ID") + private Integer clienteFidelidadId; + @OneToOne + @JoinColumn(name = "CLIENTE_ID") + private Cliente cliente; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "TARJETAFIDELIDAD_ID") + private TarjetaFidelidad tarjetaFidelidad; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getClienteFidelidadId() { + return clienteFidelidadId; + } + + public void setClienteFidelidadId(Integer clienteFidelidadId) { + this.clienteFidelidadId = clienteFidelidadId; + } + + public TarjetaFidelidad getTarjetaFidelidad() { + return tarjetaFidelidad; + } + + public void setTarjetaFidelidad(TarjetaFidelidad tarjetaFidelidad) { + this.tarjetaFidelidad = tarjetaFidelidad; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((clienteFidelidadId == null) ? 0 : clienteFidelidadId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ClienteFidelidad other = (ClienteFidelidad) obj; + if (clienteFidelidadId == null) { + if (other.clienteFidelidadId != null) + return false; + } else if (!clienteFidelidadId.equals(other.clienteFidelidadId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClientePacote.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClientePacote.java new file mode 100644 index 000000000..5e2a2bcc9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ClientePacote.java @@ -0,0 +1,189 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +import com.rjconsultores.ventaboletos.enums.TipoPessoa; + +@Entity +@SequenceGenerator(name = "CLIENTE_PACOTE_SEQ", sequenceName = "CLIENTE_PACOTE_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_PACOTE") +public class ClientePacote implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "CLIENTEPACOTE_ID") + private Long clientepacoteId; + + @Column(name = "RAZAO_SOCIAL") + private String razaoSocial; + + @Column(name = "CPF_CNPJ") + private String cpfCnpj; + + @Column(name = "TIPO_PESSOA") + @Enumerated(EnumType.ORDINAL) + private TipoPessoa tipoPessoa; + + @Column(name = "DESCEMAIL") + private String descemail; + + @Column(name = "DESCTELEFONE") + private String desctelefone; + + @Column(name = "DESCFAX") + private String descfax; + + @Column(name = "CEP") + private String cep; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "NUMERO") + private String numero; + + @Column(name = "COMPLEMENTO") + private String complemento; + + @Column(name = "PAIS") + private String pais; + + @Column(name = "ESTADO") + private String estado; + + @Column(name = "CIDADE") + private String cidade; + + @Column(name = "BAIRRO") + private String bairro; + + public Long getClientepacoteId() { + return clientepacoteId; + } + + public void setClientepacoteId(Long clientepacoteId) { + this.clientepacoteId = clientepacoteId; + } + + public String getRazaoSocial() { + return razaoSocial; + } + + public void setRazaoSocial(String razaoSocial) { + this.razaoSocial = razaoSocial; + } + + public String getDescemail() { + return descemail; + } + + public void setDescemail(String descemail) { + this.descemail = descemail; + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + public String getDescfax() { + return descfax; + } + + public void setDescfax(String descfax) { + this.descfax = descfax; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getPais() { + return pais; + } + + public void setPais(String pais) { + this.pais = pais; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getCpfCnpj() { + return cpfCnpj; + } + + public void setCpfCnpj(String cpfCnpj) { + this.cpfCnpj = cpfCnpj; + } + + public TipoPessoa getTipoPessoa() { + return tipoPessoa; + } + + public void setTipoPessoa(TipoPessoa tipoPessoa) { + this.tipoPessoa = tipoPessoa; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java new file mode 100644 index 000000000..c25e99f06 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java @@ -0,0 +1,118 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COEFICIENTE_TARIFA_SEQ", sequenceName = "COEFICIENTE_TARIFA_SEQ", allocationSize = 1) +@Table(name = "COEFICIENTE_TARIFA") +public class CoeficienteTarifa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COEFICIENTE_TARIFA_SEQ") + @Column(name = "COEFICIENTETARIFA_ID") + private Integer coeficienteId; + @Column(name = "DESCCOEFICIENTE") + private String descCoeficiente; + @Column(name = "COEFICIENTE") + private BigDecimal coeficiente; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getCoeficienteId() { + return coeficienteId; + } + + public void setCoeficienteId(Integer coeficienteId) { + this.coeficienteId = coeficienteId; + } + + public String getDescCoeficiente() { + return descCoeficiente; + } + + public void setDescCoeficiente(String descCoeficiente) { + this.descCoeficiente = descCoeficiente; + } + + public BigDecimal getCoeficiente() { + return coeficiente; + } + + public void setCoeficiente(BigDecimal coeficiente) { + this.coeficiente = coeficiente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return descCoeficiente + " - " + coeficiente; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((coeficienteId == null) ? 0 : coeficienteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CoeficienteTarifa other = (CoeficienteTarifa) obj; + if (coeficienteId == null) { + if (other.coeficienteId != null) + return false; + } else if (!coeficienteId.equals(other.coeficienteId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Colonia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Colonia.java new file mode 100644 index 000000000..738508969 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Colonia.java @@ -0,0 +1,151 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "COLONIA_SEQ", sequenceName = "COLONIA_SEQ", allocationSize = 1) +@Table(name = "COLONIA") +public class Colonia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COLONIA_SEQ") + @Column(name = "COLONIA_ID") + private Integer coloniaId; + @Column(name = "DESCCOLONIA") + private String desccolonia; + @Column(name = "CODPOSTAL") + private String codpostal; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "CIUDAD_ID") + private Ciudad ciudad; + + public Colonia() { + } + + public Colonia(Integer coloniaId) { + this.coloniaId = coloniaId; + } + + public Integer getColoniaId() { + return coloniaId; + } + + public void setColoniaId(Integer coloniaId) { + this.coloniaId = coloniaId; + } + + public String getDesccolonia() { + return desccolonia; + } + + public void setDesccolonia(String desccolonia) { + this.desccolonia = desccolonia; + } + + public String getCodpostal() { + return codpostal; + } + + public void setCodpostal(String codpostal) { + this.codpostal = codpostal; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (coloniaId != null ? coloniaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Colonia)) { + return false; + } + Colonia other = (Colonia) object; + if ((this.getColoniaId() == null && other.getColoniaId() != null) || (this.getColoniaId() != null && !this.getColoniaId().equals(other.getColoniaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.desccolonia; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpCategoria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpCategoria.java new file mode 100644 index 000000000..49fc418e3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpCategoria.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_CATEGORIA_SEQ", sequenceName = "COM_EMP_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_CATEGORIA") +public class ComEmpCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_CATEGORIA_SEQ") + @Column(name = "COMEMPCATEGORIA_ID") + private Long comempcategoriaId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + + @Column(name = "ACTIVO") + private boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public Long getComempcategoriaId() { + return comempcategoriaId; + } + + public void setComempcategoriaId(Long comempcategoriaId) { + this.comempcategoriaId = comempcategoriaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((comempcategoriaId == null) ? 0 : comempcategoriaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ComEmpCategoria other = (ComEmpCategoria) obj; + if (comempcategoriaId == null) { + if (other.comempcategoriaId != null) + return false; + } else if (!comempcategoriaId.equals(other.comempcategoriaId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpConferencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpConferencia.java new file mode 100644 index 000000000..68a0666b2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpConferencia.java @@ -0,0 +1,221 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_CONFERENCIA_SEQ", sequenceName = "COM_EMP_CONFERENCIA_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_CONFERENCIA") +public class ComEmpConferencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_CONFERENCIA_SEQ") + @Column(name = "COMEMPCONFERENCIA_ID") + private Long comempconferenciaId; + + @Column(name = "INDBILHETEMANUAL") + private Boolean indbilhetemanual; + + @Column(name = "INDBILHETEVENDIDO") + private Boolean indbilhetevendido; + + @Column(name = "INDBILHETECANCELADO") + private Boolean indbilhetecancelado; + + @Column(name = "INDBILHETEDEVOLVIDO") + private Boolean indbilhetedevolvido; + + @Column(name = "INDGAPVENDIDO") + private Boolean indgapvendido; + + @Column(name = "INDGAPCANCELADO") + private Boolean indgapcancelado; + + @Column(name = "INDGAPDEVOLVIDO") + private Boolean indgapdevolvido; + + @Column(name = "INDEVENTOSFINANCEIROS") + private Boolean indeventosfinanceiros; + + @Column(name = "INDOCD") + private Boolean indocd; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public ComEmpConferencia() { + super(); + setIndbilhetecancelado(Boolean.FALSE); + setIndbilhetevendido(Boolean.FALSE); + setIndbilhetedevolvido(Boolean.FALSE); + setIndgapcancelado(Boolean.FALSE); + setIndgapdevolvido(Boolean.FALSE); + setIndgapvendido(Boolean.FALSE); + setIndeventosfinanceiros(Boolean.FALSE); + setIndocd(Boolean.FALSE); + } + + public Long getComempconferenciaId() { + return comempconferenciaId; + } + + public void setComempconferenciaId(Long comempconferenciaId) { + this.comempconferenciaId = comempconferenciaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getComempconferenciaId() == null) ? 0 : getComempconferenciaId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ComEmpConferencia)) + return false; + ComEmpConferencia other = (ComEmpConferencia) obj; + if (getComempconferenciaId() == null) { + if (other.getComempconferenciaId() != null) + return false; + } else if (!getComempconferenciaId().equals(other.getComempconferenciaId())) + return false; + return true; + } + + public Boolean getIndbilhetemanual() { + return indbilhetemanual; + } + + public void setIndbilhetemanual(Boolean indbilhetemanual) { + this.indbilhetemanual = indbilhetemanual; + } + + public Boolean getIndbilhetevendido() { + return indbilhetevendido; + } + + public void setIndbilhetevendido(Boolean indbilhetevendido) { + this.indbilhetevendido = indbilhetevendido; + } + + public Boolean getIndbilhetecancelado() { + return indbilhetecancelado; + } + + public void setIndbilhetecancelado(Boolean indbilhetecancelado) { + this.indbilhetecancelado = indbilhetecancelado; + } + + public Boolean getIndbilhetedevolvido() { + return indbilhetedevolvido; + } + + public void setIndbilhetedevolvido(Boolean indbilhetedevolvido) { + this.indbilhetedevolvido = indbilhetedevolvido; + } + + public Boolean getIndgapvendido() { + return indgapvendido; + } + + public void setIndgapvendido(Boolean indgapvendido) { + this.indgapvendido = indgapvendido; + } + + public Boolean getIndgapcancelado() { + return indgapcancelado; + } + + public void setIndgapcancelado(Boolean indgapcancelado) { + this.indgapcancelado = indgapcancelado; + } + + public Boolean getIndgapdevolvido() { + return indgapdevolvido; + } + + public void setIndgapdevolvido(Boolean indgapdevolvido) { + this.indgapdevolvido = indgapdevolvido; + } + + public Boolean getIndeventosfinanceiros() { + return indeventosfinanceiros; + } + + public void setIndeventosfinanceiros(Boolean indeventosfinanceiros) { + this.indeventosfinanceiros = indeventosfinanceiros; + } + + public Boolean getIndocd() { + return indocd; + } + + public void setIndocd(Boolean indocd) { + this.indocd = indocd; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpFormapago.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpFormapago.java new file mode 100644 index 000000000..f51618e41 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpFormapago.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_FORMAPAGO_SEQ", sequenceName = "COM_EMP_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_FORMAPAGO") +public class ComEmpFormapago implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "COMEMPFORMAPAGO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_FORMAPAGO_SEQ") + private Long comempformapagoId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + @Column(name = "ACTIVO") + private boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public Long getComempformapagoId() { + return comempformapagoId; + } + + public void setComempformapagoId(Long comempformapagoId) { + this.comempformapagoId = comempformapagoId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((comempformapagoId == null) ? 0 : comempformapagoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ComEmpFormapago other = (ComEmpFormapago) obj; + if (comempformapagoId == null) { + if (other.comempformapagoId != null) + return false; + } else if (!comempformapagoId.equals(other.comempformapagoId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpTipoEventoExtra.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpTipoEventoExtra.java new file mode 100644 index 000000000..262d645d8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComEmpTipoEventoExtra.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_TIPOEVENTOEXTRA_SEQ", sequenceName = "COM_EMP_TIPOEVENTOEXTRA_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_TIPOEVENTOEXTRA") +public class ComEmpTipoEventoExtra implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "COMEMPTIPOEVENTOEXTRA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_TIPOEVENTOEXTRA_SEQ") + private Long comemptipoeventoextraId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoEventoExtra; + + @Column(name = "ACTIVO") + private boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public Long getComemptipoeventoextraId() { + return comemptipoeventoextraId; + } + + public void setComemptipoeventoextraId(Long comemptipoeventoextraId) { + this.comemptipoeventoextraId = comemptipoeventoextraId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public TipoEventoExtra getTipoEventoExtra() { + return tipoEventoExtra; + } + + public void setTipoEventoExtra(TipoEventoExtra tipoEventoExtra) { + this.tipoEventoExtra = tipoEventoExtra; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((comemptipoeventoextraId == null) ? 0 : comemptipoeventoextraId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ComEmpTipoEventoExtra other = (ComEmpTipoEventoExtra) obj; + if (comemptipoeventoextraId == null) { + if (other.comemptipoeventoextraId != null) + return false; + } else if (!comemptipoeventoextraId.equals(other.comemptipoeventoextraId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComisionistaExterno.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComisionistaExterno.java new file mode 100644 index 000000000..501ab7e7b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ComisionistaExterno.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "COMISIONISTA_EXTERNO_SEQ", sequenceName = "COMISIONISTA_EXTERNO_SEQ", allocationSize = 1) +@Table(name = "COMISIONISTA_EXTERNO") +public class ComisionistaExterno implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISIONISTA_EXTERNO_SEQ") + @Basic(optional = false) + @Column(name = "COMISIONISTAEXTERNO_ID") + private Short comisionistaexternoId; + @Column(name = "DESCCOMISIONISTA") + private String desccomisionista; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ComisionistaExterno() { + } + + public ComisionistaExterno(Short comisionistaexternoId) { + this.comisionistaexternoId = comisionistaexternoId; + } + + public Short getComisionistaexternoId() { + return comisionistaexternoId; + } + + public void setComisionistaexternoId(Short comisionistaexternoId) { + this.comisionistaexternoId = comisionistaexternoId; + } + + public String getDesccomisionista() { + return desccomisionista; + } + + public void setDesccomisionista(String desccomisionista) { + this.desccomisionista = desccomisionista; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (comisionistaexternoId != null ? comisionistaexternoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ComisionistaExterno)) { + return false; + } + ComisionistaExterno other = (ComisionistaExterno) object; + if ((this.comisionistaexternoId == null && other.comisionistaexternoId != null) || (this.comisionistaexternoId != null && !this.comisionistaexternoId.equals(other.comisionistaexternoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDesccomisionista(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Comissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Comissao.java new file mode 100644 index 000000000..f168487d7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Comissao.java @@ -0,0 +1,248 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COMISSAO_SEQ", sequenceName = "COMISSAO_SEQ", allocationSize = 1) +@Table(name = "COMISSAO") +public class Comissao implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISSAO_SEQ") + @Column(name = "COMISSAO_ID") + private Integer comissaoId; + @Column(name = "COMPETENCIA") + private String competencia; + @Column(name = "DATAPAGAMENTO") + @Temporal(TemporalType.TIMESTAMP) + private Date dataPagamento; + @Column(name = "INDPAGO") + private Boolean indPago; + @Column(name = "COMISSAO_BPR") + private BigDecimal comissaoBpr; + @Column(name = "RECEITA_EXCESSOBAGAGEM") + private BigDecimal receitaExcessobagagem; + @Column(name = "RECEITA_SEGUROOPCIONAL") + private BigDecimal receitaSeguroopcional; + @Column(name = "RECEITA_OUTROS") + private BigDecimal receitaOutros; + @Column(name = "DESCONTOS_FIXOS") + private BigDecimal descontosFixos; + @Column(name = "DESCONTOS_EVENTUAIS") + private BigDecimal descontosEventuais; + @Column(name = "ROYATIES") + private BigDecimal royaties; + @Column(name = "ISS_RETIDO") + private BigDecimal issRetido; + @Column(name = "BONIFICACAO_METAS") + private BigDecimal bonificacaoMetas; + @Column(name = "ENTREGAS_PASSAGEM") + private BigDecimal entregasPassagem; + @Column(name = "USUARIOPAGAMENTO_ID") + private Integer usuarioPagamentoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + @Column(name = "EMPRESA_ID") + private Integer empresaId; + + public Comissao() { + super(); + setComissaoBpr(BigDecimal.ZERO); + setReceitaExcessobagagem(BigDecimal.ZERO); + setReceitaSeguroopcional(BigDecimal.ZERO); + setReceitaOutros(BigDecimal.ZERO); + setDescontosFixos(BigDecimal.ZERO); + setDescontosEventuais(BigDecimal.ZERO); + setRoyaties(BigDecimal.ZERO); + setIssRetido(BigDecimal.ZERO); + setBonificacaoMetas(BigDecimal.ZERO); + setEntregasPassagem(BigDecimal.ZERO); + } + + public Integer getComissaoId() { + return comissaoId; + } + + public void setComissaoId(Integer comissaoId) { + this.comissaoId = comissaoId; + } + + public String getCompetencia() { + return competencia; + } + + public void setCompetencia(String competencia) { + this.competencia = competencia; + } + + public Date getDataPagamento() { + return dataPagamento; + } + + public void setDataPagamento(Date dataPagamento) { + this.dataPagamento = dataPagamento; + } + + public Boolean getIndPago() { + return indPago; + } + + public void setIndPago(Boolean indPago) { + this.indPago = indPago; + } + + public BigDecimal getComissaoBpr() { + return comissaoBpr; + } + + public void setComissaoBpr(BigDecimal comissaoBpr) { + this.comissaoBpr = comissaoBpr; + } + + public BigDecimal getReceitaExcessobagagem() { + return receitaExcessobagagem; + } + + public void setReceitaExcessobagagem(BigDecimal receitaExcessobagagem) { + this.receitaExcessobagagem = receitaExcessobagagem; + } + + public BigDecimal getReceitaSeguroopcional() { + return receitaSeguroopcional; + } + + public void setReceitaSeguroopcional(BigDecimal receitaSeguroopcional) { + this.receitaSeguroopcional = receitaSeguroopcional; + } + + public BigDecimal getDescontosFixos() { + return descontosFixos; + } + + public void setDescontosFixos(BigDecimal descontosFixos) { + this.descontosFixos = descontosFixos; + } + + public BigDecimal getDescontosEventuais() { + return descontosEventuais; + } + + public void setDescontosEventuais(BigDecimal descontosEventuais) { + this.descontosEventuais = descontosEventuais; + } + + public BigDecimal getRoyaties() { + return royaties; + } + + public void setRoyaties(BigDecimal royaties) { + this.royaties = royaties; + } + + public BigDecimal getIssRetido() { + return issRetido; + } + + public void setIssRetido(BigDecimal issRetido) { + this.issRetido = issRetido; + } + + public BigDecimal getBonificacaoMetas() { + return bonificacaoMetas; + } + + public void setBonificacaoMetas(BigDecimal bonificacaoMetas) { + this.bonificacaoMetas = bonificacaoMetas; + } + + public BigDecimal getEntregasPassagem() { + return entregasPassagem; + } + + public void setEntregasPassagem(BigDecimal entregasPassagem) { + this.entregasPassagem = entregasPassagem; + } + + public Integer getUsuarioPagamentoId() { + return usuarioPagamentoId; + } + + public void setUsuarioPagamentoId(Integer usuarioPagamentoId) { + this.usuarioPagamentoId = usuarioPagamentoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public BigDecimal getReceitaOutros() { + return receitaOutros; + } + + public void setReceitaOutros(BigDecimal receitaOutros) { + this.receitaOutros = receitaOutros; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CompaniaBancaria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CompaniaBancaria.java new file mode 100644 index 000000000..0907f958a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CompaniaBancaria.java @@ -0,0 +1,180 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "COMPANIA_BANCARIA_SEQ", sequenceName = "COMPANIA_BANCARIA_SEQ", allocationSize = 1) +@Table(name = "COMPANIA_BANCARIA") +public class CompaniaBancaria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "COMPANIABANCARIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMPANIA_BANCARIA_SEQ") + private Integer companiabancariaId; + @Column(name = "CVECOMPANIA") + private String cvecompania; + @Column(name = "CVESUCURSAL") + private String cvesucursal; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "companiaBancaria") + private List merchantBancarioList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "companiaBancaria") + private List usuarioBancarioList; + + + + public CompaniaBancaria() { + } + + public CompaniaBancaria(Integer companiabancariaId) { + this.companiabancariaId = companiabancariaId; + } + + public CompaniaBancaria(Integer companiabancariaId, Boolean activo) { + this.companiabancariaId = companiabancariaId; + this.activo = activo; + } + + public Integer getCompaniabancariaId() { + return companiabancariaId; + } + + public void setCompaniabancariaId(Integer companiabancariaId) { + this.companiabancariaId = companiabancariaId; + } + + public String getCvecompania() { + return cvecompania; + } + + public void setCvecompania(String cvecompania) { + this.cvecompania = cvecompania; + } + + public String getCvesucursal() { + return cvesucursal; + } + + public void setCvesucursal(String cvesucursal) { + this.cvesucursal = cvesucursal; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public List getMerchantBancarioList() { + List tmp = new ArrayList(); + if (merchantBancarioList != null) { + for (MerchantBancario ddab : this.merchantBancarioList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.merchantBancarioList = tmp; + + return tmp; + } + + public void setMerchantBancarioList(List merchantBancarioList) { + this.merchantBancarioList = merchantBancarioList; + } + + public List getUsuarioBancarioList() { + List tmp = new ArrayList(); + if (usuarioBancarioList != null) { + for (UsuarioBancario ddab : this.usuarioBancarioList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.usuarioBancarioList = tmp; + + return tmp; + } + + public void setUsuarioBancarioList(List usuarioBancarioList) { + this.usuarioBancarioList = usuarioBancarioList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (companiabancariaId != null ? companiabancariaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CompaniaBancaria)) { + return false; + } + CompaniaBancaria other = (CompaniaBancaria) object; + if ((this.companiabancariaId == null && other.companiabancariaId != null) || (this.companiabancariaId != null && !this.companiabancariaId.equals(other.companiabancariaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CompaniaBancaria[companiabancariaId=" + companiabancariaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conductor.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conductor.java new file mode 100644 index 000000000..5313cba59 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conductor.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONDUCTOR_SEQ", sequenceName = "CONDUCTOR_SEQ", allocationSize = 1) +@Table(name = "CONDUCTOR") +public class Conductor implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CONDUCTOR_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONDUCTOR_SEQ") + private Integer conductorId; + @Column(name = "NOMBCONDUCTOR") + private String nombconductor; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "conductor") + private List corridaList; + @OneToMany(mappedBy = "conductor1") + private List corridaList1; + @OneToOne + @JoinColumn(name = "EMPLEADO_ID") + private Empleado empleado; + @Column(name = "NOMBPATERNO") + private String nomPaterno; + @Column(name = "NOMBMATERNO") + private String nomMaterno; + + public String getNomMaterno() { + return nomMaterno; + } + + public void setNomMaterno(String nomMaterno) { + this.nomMaterno = nomMaterno; + } + + public String getNomPaterno() { + return nomPaterno; + } + + public void setNomPaterno(String nomPaterno) { + this.nomPaterno = nomPaterno; + } + + public Empleado getEmpleado() { + return empleado; + } + + public void setEmpleado(Empleado empleado) { + this.empleado = empleado; + } + + public Conductor() { + } + + public Conductor(Integer conductorId) { + this.conductorId = conductorId; + } + + public Integer getConductorId() { + return conductorId; + } + + public void setConductorId(Integer conductorId) { + this.conductorId = conductorId; + } + + public String getNombconductor() { + return nombconductor; + } + + public void setNombconductor(String nombconductor) { + this.nombconductor = nombconductor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getCorridaList1() { + return corridaList1; + } + + public void setCorridaList1(List corridaList1) { + this.corridaList1 = corridaList1; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (conductorId != null ? conductorId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Conductor)) { + return false; + } + Conductor other = (Conductor) object; + if ((this.conductorId == null && other.conductorId != null) || (this.conductorId != null && !this.conductorId.equals(other.conductorId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return (this.getEmpleado() != null ? this.getEmpleado().getCveEmpleado() : "") + "-" + this.getNombconductor() + " " + this.getNomPaterno(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conexion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conexion.java new file mode 100644 index 000000000..06a0aed95 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conexion.java @@ -0,0 +1,165 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "CONEXION_SEQ", sequenceName = "CONEXION_SEQ", allocationSize = 1) +@Table(name = "CONEXION") +public class Conexion implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_SEQ") + @Column(name = "CONEXION_ID") + private Long conexionId; + @Column(name = "NUMGRUPO") + private Integer numgrupo; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "CORRIDA_ID") + private Long corridaId; + + public Long getCorridaId() { + return corridaId; + } + + public void setCorridaId(Long corridaId) { + this.corridaId = corridaId; + } + + public Conexion() { + } + + public Conexion(Long conexionId) { + this.conexionId = conexionId; + } + + public Long getConexionId() { + return conexionId; + } + + public void setConexionId(Long conexionId) { + this.conexionId = conexionId; + } + + public Integer getNumgrupo() { + return numgrupo; + } + + public void setNumgrupo(Integer numgrupo) { + this.numgrupo = numgrupo; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (conexionId != null ? conexionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Conexion)) { + return false; + } + Conexion other = (Conexion) object; + if ((this.conexionId == null && other.conexionId != null) || (this.conexionId != null && !this.conexionId.equals(other.conexionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.Conexion[ conexionId=" + conexionId + " ]"; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionConf.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionConf.java new file mode 100644 index 000000000..bbe93f433 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionConf.java @@ -0,0 +1,183 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONEXION_CONF_SEQ", sequenceName = "CONEXION_CONF_SEQ", allocationSize = 1) +@Table(name = "CONEXION_CONF") +public class ConexionConf implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "CONEXIONCONF_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_CONF_SEQ") + private Long conexionConfId; + @ManyToOne + @JoinColumn(name = "CONEXIONCTRL_ID", referencedColumnName = "CONEXIONCTRL_ID") + private ConexionCtrl conexionCtrl; + @Column(name = "GRUPO") + private Integer grupo; + @Column(name = "PORSEC1") + private BigDecimal porSec1; + @Column(name = "PORSEC2") + private BigDecimal porSec2; + @Column(name = "PORSEC3") + private BigDecimal porSec3; + @Column(name = "PORSEC4") + private BigDecimal porSec4; + @Column(name = "TIEMPOMIN") + private Integer tiempoMin; + @Column(name = "TIEMPOMAX") + private Integer tiempoMax; + @Column(name = "INDDISPONIBLE") + private Boolean indisponible; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getConexionConfId() { + return conexionConfId; + } + + public void setConexionConfId(Long conexionConfId) { + this.conexionConfId = conexionConfId; + } + + public ConexionCtrl getConexionCtrl() { + return conexionCtrl; + } + + public void setConexionCtrl(ConexionCtrl conexionCtrl) { + this.conexionCtrl = conexionCtrl; + } + + public Integer getGrupo() { + return grupo; + } + + public void setGrupo(Integer grupo) { + this.grupo = grupo; + } + + public BigDecimal getPorSec1() { + return porSec1; + } + + public void setPorSec1(BigDecimal porSec1) { + this.porSec1 = porSec1; + } + + public BigDecimal getPorSec2() { + return porSec2; + } + + public void setPorSec2(BigDecimal porSec2) { + this.porSec2 = porSec2; + } + + public BigDecimal getPorSec3() { + return porSec3; + } + + public void setPorSec3(BigDecimal porSec3) { + this.porSec3 = porSec3; + } + + public BigDecimal getPorSec4() { + return porSec4; + } + + public void setPorSec4(BigDecimal porSec4) { + this.porSec4 = porSec4; + } + + public Integer getTiempoMin() { + return tiempoMin; + } + + public void setTiempoMin(Integer tiempoMin) { + this.tiempoMin = tiempoMin; + } + + public Integer getTiempoMax() { + return tiempoMax; + } + + public void setTiempoMax(Integer tiempoMax) { + this.tiempoMax = tiempoMax; + } + + public Boolean getIndisponible() { + return indisponible; + } + + public void setIndisponible(Boolean indisponible) { + this.indisponible = indisponible; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conexionConfId == null) ? 0 : conexionConfId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConexionConf other = (ConexionConf) obj; + if (conexionConfId == null) { + if (other.conexionConfId != null) + return false; + } else if (!conexionConfId.equals(other.conexionConfId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java new file mode 100644 index 000000000..f44095e95 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "CONEXION_CTRL_SEQ", sequenceName = "CONEXION_CTRL_SEQ", allocationSize = 1) +@Table(name = "CONEXION_CTRL") +public class ConexionCtrl implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_CTRL_SEQ") + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + @Column(name = "INDFIXA") + private Integer indfixa; + + public Integer getIndfixa() { + return indfixa; + } + + public void setIndfixa(Integer indfixa) { + this.indfixa = indfixa; + } + + public ConexionCtrl() { + } + + public ConexionCtrl(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (conexionctrlId != null ? conexionctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof ConexionCtrl)) { + return false; + } + ConexionCtrl other = (ConexionCtrl) object; + if ((this.conexionctrlId == null && other.conexionctrlId != null) || (this.conexionctrlId != null && !this.conexionctrlId.equals(other.conexionctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ConexionCtrl[ conexionctrlId=" + conexionctrlId + " ]"; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrlTemp.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrlTemp.java new file mode 100644 index 000000000..9f714e021 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrlTemp.java @@ -0,0 +1,126 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "CONEXION_CTRL_SEQ", sequenceName = "CONEXION_CTRL_SEQ", allocationSize = 1) +@Table(name = "CONEXION_CTRL_TEMP") +public class ConexionCtrlTemp implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_CTRL_SEQ") + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + + public ConexionCtrlTemp() { + } + + public ConexionCtrlTemp(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (conexionctrlId != null ? conexionctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConexionCtrlTemp)) { + return false; + } + ConexionCtrlTemp other = (ConexionCtrlTemp) object; + if ((this.conexionctrlId == null && other.conexionctrlId != null) || (this.conexionctrlId != null && !this.conexionctrlId.equals(other.conexionctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ConexionCtrlTemp[ conexionctrlId=" + conexionctrlId + " ]"; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcion.java new file mode 100644 index 000000000..e3cf9013c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcion.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONEXION_EXCEPCION_SEQ", sequenceName = "CONEXION_EXCEPCION_SEQ", allocationSize = 1) +@Table(name = "CONEXION_EXCEPCION") +public class ConexionExcepcion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_EXCEPCION_SEQ") + @Column(name = "CONEXIONEXCEPCION_ID") + private Long conexionExcepcionId; + @Column(name = "NUMCORRIDA") + private Integer numcorrida; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ConexionExcepcion() { + } + + public ConexionExcepcion(Long conexionExcepcionId) { + this.conexionExcepcionId = conexionExcepcionId; + } + + public ConexionExcepcion(Long conexionExcepcionId, Integer numcorrida, Long conexionctrlId, Boolean activo, Date fecmodif, Integer usuarioId) { + this.conexionExcepcionId = conexionExcepcionId; + this.numcorrida = numcorrida; + this.conexionctrlId = conexionctrlId; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Long getConexionExcepcionId() { + return conexionExcepcionId; + } + + public void setConexionExcepcionId(Long conexionExcepcionId) { + this.conexionExcepcionId = conexionExcepcionId; + } + + public Integer getNumcorrida() { + return numcorrida; + } + + public void setNumcorrida(Integer numcorrida) { + this.numcorrida = numcorrida; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conexionExcepcionId == null) ? 0 : conexionExcepcionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConexionExcepcion other = (ConexionExcepcion) obj; + if (conexionExcepcionId == null) { + if (other.conexionExcepcionId != null) + return false; + } else if (!conexionExcepcionId.equals(other.conexionExcepcionId)) + return false; + return true; + } + + @Override + public String toString() { + return "ConexionExcepcion [conexionExcepcionId=" + conexionExcepcionId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcionRuta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcionRuta.java new file mode 100644 index 000000000..5baffac0c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcionRuta.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONEXION_EXCEPCION_RUTA_SEQ", sequenceName = "CONEXION_EXCEPCION_RUTA_SEQ", allocationSize = 1) +@Table(name = "CONEXION_EXCEPCION_RUTA") +public class ConexionExcepcionRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_EXCEPCION_RUTA_SEQ") + @Column(name = "CONEXIONEXCEPCIONRUTA_ID") + private Long conexionExcepcionRutaId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Long getConexionExcepcionRutaId() { + return conexionExcepcionRutaId; + } + public void setConexionExcepcionRutaId(Long conexionExcepcionRutaId) { + this.conexionExcepcionRutaId = conexionExcepcionRutaId; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Long getConexionctrlId() { + return conexionctrlId; + } + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionTemp.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionTemp.java new file mode 100644 index 000000000..503fe3609 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConexionTemp.java @@ -0,0 +1,156 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@Table(name = "CONEXION_TEMP") +@SequenceGenerator(name = "CONEXION_SEQ", sequenceName = "CONEXION_SEQ", allocationSize = 1) +public class ConexionTemp implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_SEQ") + @Column(name = "CONEXION_ID") + private Long conexionId; + @Column(name = "NUMGRUPO") + private Integer numgrupo; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + + public ConexionTemp() { + } + + public ConexionTemp(Long conexionId) { + this.conexionId = conexionId; + } + + public Long getConexionId() { + return conexionId; + } + + public void setConexionId(Long conexionId) { + this.conexionId = conexionId; + } + + public Integer getNumgrupo() { + return numgrupo; + } + + public void setNumgrupo(Integer numgrupo) { + this.numgrupo = numgrupo; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (conexionId != null ? conexionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConexionTemp)) { + return false; + } + ConexionTemp other = (ConexionTemp) object; + if ((this.conexionId == null && other.conexionId != null) || (this.conexionId != null && !this.conexionId.equals(other.conexionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ConexionTemp[ conexionId=" + conexionId + " ]"; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoCanalVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoCanalVenta.java new file mode 100644 index 000000000..7905b9619 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoCanalVenta.java @@ -0,0 +1,314 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_CANALVENTA_SEQ", sequenceName = "CONF_RESTRICAO_CANALVENTA_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_CANALVENTA") +public class ConfRestricaoCanalVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_CANALVENTA_SEQ") + @Column(name = "CONFRESTRICAOCANALVENTA_ID") + private Integer confRestricaoCanalVentaId; + @Column(name = "DESCCONFRESTRICAOCANALVENTA") + private String descConfRestricaoCanalVenta; + @OneToOne + @JoinColumn(name = "TIPOPTOVTA_ID") + private TipoPuntoVenta tipoPuntoVenta; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @Column(name = "TEMPOPERMITIR") + private Date tempoPermitir; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "FECCORRIDA") + private Date fecCorrida; + @Column(name = "SEGUNDA") + private Boolean segunda; + @Column(name = "TERCA") + private Boolean terca; + @Column(name = "QUARTA") + private Boolean quarta; + @Column(name = "QUINTA") + private Boolean quinta; + @Column(name = "SEXTA") + private Boolean sexta; + @Column(name = "SABADO") + private Boolean sabado; + @Column(name = "DOMINGO") + private Boolean domingo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List lsConfRestricaoExcecao; + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List lsConfRestricaoPtovta; + @Column(name = "INDEXIBECONSULTAVENDAWEB") + private Boolean indexibeconsultavendaweb; + + public ConfRestricaoCanalVenta() { + super(); + indexibeconsultavendaweb = false; + } + + public Integer getConfRestricaoCanalVentaId() { + return confRestricaoCanalVentaId; + } + + public void setConfRestricaoCanalVentaId(Integer confRestricaoCanalVentaId) { + this.confRestricaoCanalVentaId = confRestricaoCanalVentaId; + } + + public String getDescConfRestricaoCanalVenta() { + return descConfRestricaoCanalVenta; + } + + public void setDescConfRestricaoCanalVenta(String descConfRestricaoCanalVenta) { + this.descConfRestricaoCanalVenta = descConfRestricaoCanalVenta; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Date getTempoPermitir() { + return tempoPermitir; + } + + public void setTempoPermitir(Date tempoPermitir) { + this.tempoPermitir = tempoPermitir; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFecCorrida() { + return fecCorrida; + } + + public void setFecCorrida(Date fecCorrida) { + this.fecCorrida = fecCorrida; + } + + public Boolean getSegunda() { + return segunda; + } + + public void setSegunda(Boolean segunda) { + this.segunda = segunda; + } + + public Boolean getTerca() { + return terca; + } + + public void setTerca(Boolean terca) { + this.terca = terca; + } + + public Boolean getQuarta() { + return quarta; + } + + public void setQuarta(Boolean quarta) { + this.quarta = quarta; + } + + public Boolean getQuinta() { + return quinta; + } + + public void setQuinta(Boolean quinta) { + this.quinta = quinta; + } + + public Boolean getSexta() { + return sexta; + } + + public void setSexta(Boolean sexta) { + this.sexta = sexta; + } + + public Boolean getSabado() { + return sabado; + } + + public void setSabado(Boolean sabado) { + this.sabado = sabado; + } + + public Boolean getDomingo() { + return domingo; + } + + public void setDomingo(Boolean domingo) { + this.domingo = domingo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public List getLsConfRestricaoExcecao() { + if (this.lsConfRestricaoExcecao != null) { + List lsTemp = new ArrayList(); + + for (ConfRestricaoExcecao cre : this.lsConfRestricaoExcecao) { + if (cre.getActivo() == Boolean.TRUE) { + lsTemp.add(cre); + } + } + + lsConfRestricaoExcecao = lsTemp; + return lsConfRestricaoExcecao; + } + + return null; + } + + public void setLsConfRestricaoExcecao(List lsConfRestricaoExcecao) { + this.lsConfRestricaoExcecao = lsConfRestricaoExcecao; + } + + public List getLsConfRestricaoPtovta() { + if (this.lsConfRestricaoPtovta != null) { + List lsTemp = new ArrayList(); + + for (ConfRestricaoPtovta cre : this.lsConfRestricaoPtovta) { + if (cre.getActivo() == Boolean.TRUE) { + lsTemp.add(cre); + } + } + + lsConfRestricaoPtovta = lsTemp; + return lsConfRestricaoPtovta; + } + + return null; + } + + public void setLsConfRestricaoPtovta(List lsConfRestricaoPtovta) { + this.lsConfRestricaoPtovta = lsConfRestricaoPtovta; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((confRestricaoCanalVentaId == null) ? 0 : confRestricaoCanalVentaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfRestricaoCanalVenta other = (ConfRestricaoCanalVenta) obj; + if (confRestricaoCanalVentaId == null) { + if (other.confRestricaoCanalVentaId != null) + return false; + } else if (!confRestricaoCanalVentaId.equals(other.confRestricaoCanalVentaId)) + return false; + return true; + } + + public Boolean getIndexibeconsultavendaweb() { + return indexibeconsultavendaweb; + } + + public void setIndexibeconsultavendaweb(Boolean indexibeconsultavendaweb) { + this.indexibeconsultavendaweb = indexibeconsultavendaweb; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoExcecao.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoExcecao.java new file mode 100644 index 000000000..cb1b09b61 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoExcecao.java @@ -0,0 +1,115 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_EXCECAO_SEQ", sequenceName = "CONF_RESTRICAO_EXCECAO_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_EXCECAO") +public class ConfRestricaoExcecao implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CONFRESTRICAOEXCECAO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_EXCECAO_SEQ") + private Integer confRestricaoExcecaoId; + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + @Column(name = "FECEXCECAO") + private Date fecExcecao; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getConfRestricaoExcecaoId() { + return confRestricaoExcecaoId; + } + + public void setConfRestricaoExcecaoId(Integer confRestricaoExcecaoId) { + this.confRestricaoExcecaoId = confRestricaoExcecaoId; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + public Date getFecExcecao() { + return fecExcecao; + } + + public void setFecExcecao(Date fecExcecao) { + this.fecExcecao = fecExcecao; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((confRestricaoExcecaoId == null) ? 0 : confRestricaoExcecaoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfRestricaoExcecao other = (ConfRestricaoExcecao) obj; + if (confRestricaoExcecaoId == null) { + if (other.confRestricaoExcecaoId != null) + return false; + } else if (!confRestricaoExcecaoId.equals(other.confRestricaoExcecaoId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoPtovta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoPtovta.java new file mode 100644 index 000000000..947419452 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoPtovta.java @@ -0,0 +1,122 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_PTOVTA_SEQ", sequenceName = "CONF_RESTRICAO_PTOVTA_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_PTOVTA") +public class ConfRestricaoPtovta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_PTOVTA_SEQ") + @Column(name = "CONFRESTRICAOPTOVTA_ID") + private Integer confRestricaoPtovtaId; + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getConfRestricaoPtovtaId() { + return confRestricaoPtovtaId; + } + + public void setConfRestricaoPtovtaId(Integer confRestricaoPtovtaId) { + this.confRestricaoPtovtaId = confRestricaoPtovtaId; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((confRestricaoPtovtaId == null) ? 0 : confRestricaoPtovtaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfRestricaoPtovta other = (ConfRestricaoPtovta) obj; + if (confRestricaoPtovtaId == null) { + if (other.confRestricaoPtovtaId != null) + return false; + } else if (!confRestricaoPtovtaId.equals(other.confRestricaoPtovtaId)) + return false; + return true; + } + + @Override + public String toString() { + return "ConfRestricaoPtovta [confRestricaoPtovtaId=" + confRestricaoPtovtaId + ", confRestricaoCanalVenta=" + confRestricaoCanalVenta + ", puntoVenta=" + puntoVenta + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conferencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conferencia.java new file mode 100644 index 000000000..688de9ab8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Conferencia.java @@ -0,0 +1,256 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import com.rjconsultores.ventaboletos.enums.comissao.CoresConferencia; + +@Entity +@Table(name = "CONFERENCIA") +@SequenceGenerator(name = "CONFERENCIA_SEQ", sequenceName = "CONFERENCIA_SEQ", allocationSize = 1) +public class Conferencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFERENCIA_SEQ") + @Column(name = "CONFERENCIA_ID") + private Long conferenciaId; + + @Temporal(TemporalType.DATE) + @Column(name = "DATAMOVIMENTO") + private Date datamovimento; + + @Column(name = "INDBOLETOGERADO") + private Boolean indboletogerado; + + @Column(name = "INDCONFERIDO") + private Boolean indconferido; + + @Column(name = "INDPENDENCIA") + private Boolean indpendencia; + + @Column(name = "INDSEMMOVIMENTO") + private Boolean indsemmovimento; + + @Column(name = "INDMALOTERECEBIDO") + private Boolean indmaloterecebido; + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "DATAMALOTE") + private Date datamalote; + + @Column(name = "USUARIO_MALOTE_ID") + private Integer usuarioMaloteId; + + @Transient + private CoresConferencia cor; + + @Transient + private String numfoliosistema; + + @Transient + private boolean semPendenciaConferencia; + + public Conferencia() { + super(); + this.indboletogerado = Boolean.FALSE; + this.indconferido = Boolean.FALSE; + this.indpendencia = Boolean.FALSE; + this.indsemmovimento = Boolean.FALSE; + this.indmaloterecebido = Boolean.FALSE; + } + + public Long getConferenciaId() { + return conferenciaId; + } + + public void setConferenciaId(Long conferenciaId) { + this.conferenciaId = conferenciaId; + } + + public Date getDatamovimento() { + return datamovimento; + } + + public void setDatamovimento(Date datamovimento) { + this.datamovimento = datamovimento; + } + + public Boolean getIndboletogerado() { + return indboletogerado; + } + + public void setIndboletogerado(Boolean indboletogerado) { + this.indboletogerado = indboletogerado; + } + + public Boolean getIndconferido() { + return indconferido; + } + + public void setIndconferido(Boolean indconferido) { + this.indconferido = indconferido; + } + + public Boolean getIndpendencia() { + return indpendencia; + } + + public void setIndpendencia(Boolean indpendencia) { + this.indpendencia = indpendencia; + } + + public Boolean getIndsemmovimento() { + return indsemmovimento; + } + + public void setIndsemmovimento(Boolean indsemmovimento) { + this.indsemmovimento = indsemmovimento; + } + + public Boolean getIndmaloterecebido() { + return indmaloterecebido; + } + + public void setIndmaloterecebido(Boolean indmaloterecebido) { + this.indmaloterecebido = indmaloterecebido; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conferenciaId == null) ? 0 : conferenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + Conferencia other = (Conferencia) obj; + if (conferenciaId == null) { + if (other.conferenciaId != null) + return false; + } else if (!conferenciaId.equals(other.conferenciaId)) + return false; + return true; + } + + public CoresConferencia getCor() { + return cor; + } + + public void setCor(CoresConferencia cor) { + this.cor = cor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getNumfoliosistema() { + return numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public Date getDatamalote() { + return datamalote; + } + + public void setDatamalote(Date datamalote) { + this.datamalote = datamalote; + } + + public Integer getUsuarioMaloteId() { + return usuarioMaloteId; + } + + public void setUsuarioMaloteId(Integer usuarioMaloteId) { + this.usuarioMaloteId = usuarioMaloteId; + } + + public boolean isSemPendenciaConferencia() { + return semPendenciaConferencia; + } + + public void setSemPendenciaConferencia(boolean semPendenciaConferencia) { + this.semPendenciaConferencia = semPendenciaConferencia; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfigRestriccionPago.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfigRestriccionPago.java new file mode 100644 index 000000000..1e8fa5dc1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConfigRestriccionPago.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONFIG_RESTRICCION_PAGO_SEQ", sequenceName = "CONFIG_RESTRICCION_PAGO_SEQ",allocationSize=1) +@Table(name = "CONFIG_RESTRICCION_PAGO") +public class ConfigRestriccionPago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFIG_RESTRICCION_PAGO_SEQ") + @Column(name = "CONFIGRESTRICCION_ID") + private Integer configrestriccionId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESTRICCION_ID", referencedColumnName = "RESTRICCION_ID") + @ManyToOne + private RestriccionPago restriccion; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + + public ConfigRestriccionPago() { + } + + public ConfigRestriccionPago(Integer configrestriccionId) { + this.configrestriccionId = configrestriccionId; + } + + public Integer getConfigrestriccionId() { + return configrestriccionId; + } + + public void setConfigrestriccionId(Integer configrestriccionId) { + this.configrestriccionId = configrestriccionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public RestriccionPago getRestriccion() { + return restriccion; + } + + public void setRestriccion(RestriccionPago restriccion) { + this.restriccion = restriccion; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (configrestriccionId != null ? configrestriccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConfigRestriccionPago)) { + return false; + } + ConfigRestriccionPago other = (ConfigRestriccionPago) object; + if ((this.configrestriccionId == null && other.configrestriccionId != null) || (this.configrestriccionId != null && !this.configrestriccionId.equals(other.configrestriccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago[configrestriccionId=" + configrestriccionId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Constante.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Constante.java new file mode 100644 index 000000000..a834a9c57 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Constante.java @@ -0,0 +1,156 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONSTANTE_SEQ", sequenceName = "CONSTANTE_SEQ", allocationSize = 1) +@Table(name = "CONSTANTE") +public class Constante implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONSTANTE_SEQ") + @Column(name = "CONSTANTE_ID") + private Integer constanteId; + @Column(name = "NOMBCONSTANTE") + private String nombconstante; + @Column(name = "DESCCONSTANTE") + private String descconstante; + @Column(name = "INDTIPOCONSTANTE") + private String indtipoconstante; + @Column(name = "VALORCONSTANTE") + private String valorconstante; + @Column(name = "INDMANTENIMIENTOUSUARIO") + private Boolean indmantenimientousuario; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Constante() { + } + + public Constante(Integer constanteId) { + this.constanteId = constanteId; + } + + public Integer getConstanteId() { + return constanteId; + } + + public void setConstanteId(Integer constanteId) { + this.constanteId = constanteId; + } + + public String getNombconstante() { + return nombconstante; + } + + public void setNombconstante(String nombconstante) { + this.nombconstante = nombconstante; + } + + public String getDescconstante() { + return descconstante; + } + + public void setDescconstante(String descconstante) { + this.descconstante = descconstante; + } + + public String getIndtipoconstante() { + return indtipoconstante; + } + + public void setIndtipoconstante(String indtipoconstante) { + this.indtipoconstante = indtipoconstante; + } + + public String getValorconstante() { + return valorconstante; + } + + public void setValorconstante(String valorconstante) { + this.valorconstante = valorconstante; + } + + public Boolean getIndmantenimientousuario() { + return indmantenimientousuario; + } + + public void setIndmantenimientousuario(Boolean indmantenimientousuario) { + this.indmantenimientousuario = indmantenimientousuario; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (constanteId != null ? constanteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Constante)) { + return false; + } + Constante other = (Constante) object; + if ((this.constanteId == null && other.constanteId != null) || (this.constanteId != null && !this.constanteId.equals(other.constanteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Constante[constanteId=" + constanteId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ContaCorrentePtoVta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ContaCorrentePtoVta.java new file mode 100644 index 000000000..f60e1ad0f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ContaCorrentePtoVta.java @@ -0,0 +1,384 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CONTA_CORRENTE_PTOVTA") +@SequenceGenerator(name = "CONTA_CORRENTE_PTOVTA_SEQ", sequenceName = "CONTA_CORRENTE_PTOVTA_SEQ", allocationSize = 1) +public class ContaCorrentePtoVta implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONTA_CORRENTE_PTOVTA_SEQ") + @Column(name = "CONTACORRENTEPTOVTA_ID") + private Long contaCorrentePtoVtaId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Temporal(TemporalType.DATE) + @Column(name = "FECHOROPERACION") + private Date fecHorOperacion; + + @Column(name = "DESCOPERACION") + private String descOperacion; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TURNO_ID") + private Turno turno; + + @Temporal(TemporalType.DATE) + @Column(name = "FECCORTE") + private Date fecCorte; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOOPERACIONCC_ID") + private TipoOperacionCC tipoOperacionCC; + + @Column(name = "IMPORTE") + private BigDecimal importe; + + @Column(name = "IMPORTETARIFA") + private BigDecimal importeTotalTarifa; + + @Column(name = "IMPORTEPEDAGIO") + private BigDecimal importeTotalPedagio; + + @Column(name = "IMPORTETAXAEMBARQUE") + private BigDecimal importeTotalTasaAbordaje; + + @Column(name = "IMPORTESEGURO") + private BigDecimal importeTotalSeguro; + + @Column(name = "IMPORTEINGRESO") + private BigDecimal importeTotalIngreso; + + @Column(name = "IMPORTEEGRESO") + private BigDecimal importeTotalEgreso; + + @Column(name = "IMPORTEDEVOLUCION") + private BigDecimal importeTotalDevolucion; + + @Column(name = "IMPORTETROCA") + private BigDecimal importeTotalTransferencia; + + @Column(name = "IMPORTETOTALEFECTIVO") + private BigDecimal importeTotalEfectivo; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIOMODIF_ID") + private Integer usuarioModifId; + + @Column(name = "TOTALVENTA_SEGOPCIONAL") + private BigDecimal totalVentaSegOpcional; + + @Column(name = "TOTALCANC_SEGOPCIONAL") + private BigDecimal totalCancSegOpcional; + + @Column(name = "FECHAMENTOCNTCORRENTE_ID") + private Long fechamentocntcorrenteId; + + @Column(name = "IND_COMISSAO") + private Boolean indComissao; + + public ContaCorrentePtoVta() { + super(); + } + + public ContaCorrentePtoVta(Long contaCorrentePtoVtaId) { + this(); + this.contaCorrentePtoVtaId = contaCorrentePtoVtaId; + } + + public Long getContaCorrentePtoVtaId() { + return contaCorrentePtoVtaId; + } + + public void setContaCorrentePtoVtaId(Long contaCorrentePtoVtaId) { + this.contaCorrentePtoVtaId = contaCorrentePtoVtaId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecHorOperacion() { + return fecHorOperacion; + } + + public void setFecHorOperacion(Date fecHorOperacion) { + this.fecHorOperacion = fecHorOperacion; + } + + public String getDescOperacion() { + return descOperacion; + } + + public void setDescOperacion(String descOperacion) { + this.descOperacion = descOperacion; + } + + public Turno getTurno() { + return turno; + } + + public void setTurno(Turno turno) { + this.turno = turno; + } + + public Date getFecCorte() { + return fecCorte; + } + + public void setFecCorte(Date fecCorte) { + this.fecCorte = fecCorte; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public TipoOperacionCC getTipoOperacionCC() { + return tipoOperacionCC; + } + + public void setTipoOperacionCC(TipoOperacionCC tipoOperacionCC) { + this.tipoOperacionCC = tipoOperacionCC; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioModifId() { + return usuarioModifId; + } + + public void setUsuarioModifId(Integer usuarioModifId) { + this.usuarioModifId = usuarioModifId; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public BigDecimal getImporteTotalTarifa() { + return importeTotalTarifa; + } + + public void setImporteTotalTarifa(BigDecimal importeTotalTarifa) { + this.importeTotalTarifa = importeTotalTarifa; + } + + public BigDecimal getImporteTotalPedagio() { + return importeTotalPedagio; + } + + public void setImporteTotalPedagio(BigDecimal importeTotalPedagio) { + this.importeTotalPedagio = importeTotalPedagio; + } + + public BigDecimal getImporteTotalTasaAbordaje() { + return importeTotalTasaAbordaje; + } + + public void setImporteTotalTasaAbordaje(BigDecimal importeTotalTasaAbordaje) { + this.importeTotalTasaAbordaje = importeTotalTasaAbordaje; + } + + public BigDecimal getImporteTotalSeguro() { + return importeTotalSeguro; + } + + public void setImporteTotalSeguro(BigDecimal importeTotalSeguro) { + this.importeTotalSeguro = importeTotalSeguro; + } + + public BigDecimal getImporteTotalIngreso() { + return importeTotalIngreso; + } + + public void setImporteTotalIngreso(BigDecimal importeTotalIngreso) { + this.importeTotalIngreso = importeTotalIngreso; + } + + public BigDecimal getImporteTotalEgreso() { + return importeTotalEgreso; + } + + public void setImporteTotalEgreso(BigDecimal importeTotalEgreso) { + this.importeTotalEgreso = importeTotalEgreso; + } + + public BigDecimal getImporteTotalDevolucion() { + return importeTotalDevolucion; + } + + public void setImporteTotalDevolucion(BigDecimal importeTotalDevolucion) { + this.importeTotalDevolucion = importeTotalDevolucion; + } + + public BigDecimal getImporteTotalTransferencia() { + return importeTotalTransferencia; + } + + public void setImporteTotalTransferencia(BigDecimal importeTotalTransferencia) { + this.importeTotalTransferencia = importeTotalTransferencia; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((contaCorrentePtoVtaId == null) ? 0 : contaCorrentePtoVtaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ContaCorrentePtoVta other = (ContaCorrentePtoVta) obj; + if (contaCorrentePtoVtaId == null) { + if (other.contaCorrentePtoVtaId != null) + return false; + } else if (!contaCorrentePtoVtaId.equals(other.contaCorrentePtoVtaId)) + return false; + + return true; + } + + @Override + public String toString() { + try { + return "ContaCorrentePtoVta [contaCorrentePtoVtaId=" + + contaCorrentePtoVtaId + ", puntoVenta=" + puntoVenta.getPuntoventaId() + + ", empresa=" + empresa.getEmpresaId() + ", fecHorOperacion=" + + fecHorOperacion + ", descOperacion=" + descOperacion + + ", turno=" + turno.getTurnoId() + ", fecCorte=" + fecCorte + ", usuario=" + + usuario.getUsuarioId() + ", tipoOperacionCC=" + tipoOperacionCC.getTipoOperacionCCId() + + ", importe=" + importe + ", importeTotalTarifa=" + + importeTotalTarifa + ", importeTotalPedagio=" + + importeTotalPedagio + ", importeTotalTasaAbordaje=" + + importeTotalTasaAbordaje + ", importeTotalSeguro=" + + importeTotalSeguro + ", importeTotalIngreso=" + + importeTotalIngreso + ", importeTotalEgreso=" + + importeTotalEgreso + ", importeTotalDevolucion=" + + importeTotalDevolucion + ", importeTotalTransferencia=" + + importeTotalTransferencia + ", activo=" + activo + + ", fecmodif=" + fecmodif + ", usuarioModifId=" + + usuarioModifId + "]"; + } catch (Throwable e) { + return super.toString(); + } + } + + public BigDecimal getTotalVentaSegOpcional() { + return totalVentaSegOpcional; + } + + public void setTotalVentaSegOpcional(BigDecimal totalVentaSegOpcional) { + this.totalVentaSegOpcional = totalVentaSegOpcional; + } + + public BigDecimal getTotalCancSegOpcional() { + return totalCancSegOpcional; + } + + public void setTotalCancSegOpcional(BigDecimal totalCancSegOpcional) { + this.totalCancSegOpcional = totalCancSegOpcional; + } + + public BigDecimal getImporteTotalEfectivo() { + return importeTotalEfectivo; + } + + public void setImporteTotalEfectivo(BigDecimal importeTotalEfectivo) { + this.importeTotalEfectivo = importeTotalEfectivo; + } + + public Long getFechamentocntcorrenteId() { + return fechamentocntcorrenteId; + } + + public void setFechamentocntcorrenteId(Long fechamentocntcorrenteId) { + this.fechamentocntcorrenteId = fechamentocntcorrenteId; + } + + public Boolean getIndComissao() { + return indComissao; + } + + public void setIndComissao(Boolean indComissao) { + this.indComissao = indComissao; + } + + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ControleEstoqueMigracao.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ControleEstoqueMigracao.java new file mode 100644 index 000000000..12e8e5e28 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ControleEstoqueMigracao.java @@ -0,0 +1,81 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoCentral generated by hbm2java + */ +@Entity +@Table(name = "CTRL_EST_MIGRACAO") +public class ControleEstoqueMigracao implements java.io.Serializable { + + private Long ctrlestmigracaoId; + private PuntoVenta puntoventa; + private Date fecmodif; + private Integer usuarioId; + + public ControleEstoqueMigracao() { + } + + public ControleEstoqueMigracao(PuntoVenta _puntoventa, Date _fecmodif, Integer _usuarioId) { + puntoventa = _puntoventa; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @SequenceGenerator(name = "CTRL_EST_MIGRACAO_SEQ", sequenceName = "CTRL_EST_MIGRACAO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CTRL_EST_MIGRACAO_SEQ") + @Column(name = "CTRLESTMIGRACAO_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getCtrlestmigracaoId() { + return ctrlestmigracaoId; + } + + public void setCtrlestmigracaoId(Long ctrlestmigracaoId) { + this.ctrlestmigracaoId = ctrlestmigracaoId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Convenio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Convenio.java new file mode 100644 index 000000000..c45c1ee52 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Convenio.java @@ -0,0 +1,361 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONVENIO_SEQ", sequenceName = "CONVENIO_SEQ", allocationSize = 1) +@Table(name = "CONVENIO") +public class Convenio implements Serializable { + + public static final Short IMPRIME_PRECO_TOTAL = 1; + public static final Short IMPRIME_PRECO_MENOS_DESCONTO = 2; + public static final Short IMPRIME_DESCONTO = 3; + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_SEQ") + @Basic(optional = false) + @Column(name = "CONVENIO_ID") + private Integer convenioId; + + @Column(name = "DESCCONVENIO") + private String descconvenio; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "CVECONVENIO") + private String cveconvenio; + + @Column(name = "VALIDAFOLIO") + private Boolean validafolio; + + @Column(name = "IMPRIMEPRECIO") + private Short imprimeprecio; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + private List convenioDetList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioTramoList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioUsuarioList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioPuntoVentaList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioEmpresaList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioRutaList; + + @Column(name = "FECVENTAINI") + @Temporal(TemporalType.TIMESTAMP) + private Date fecVentaInicial; + + @Column(name = "FECVENTAFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fecVentaFinal; + + @Column(name = "FECVIAJEINI") + @Temporal(TemporalType.TIMESTAMP) + private Date fecViajeInicial; + + @Column(name = "FECVIAJEFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fecViajeFinal; + + @Column(name = "INDDESCUENTONORMAL") + private Integer indDescuentoNormal; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + private Cliente cliente; + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + + public Convenio() { + } + + public Convenio(Integer convenioId) { + this.convenioId = convenioId; + } + + public Integer getConvenioId() { + return convenioId; + } + + public void setConvenioId(Integer convenioId) { + this.convenioId = convenioId; + } + + public String getDescconvenio() { + return descconvenio; + } + + public void setDescconvenio(String descconvenio) { + this.descconvenio = descconvenio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getCveconvenio() { + return cveconvenio; + } + + public void setCveconvenio(String cveconvenio) { + this.cveconvenio = cveconvenio; + } + + public Boolean getValidafolio() { + return validafolio; + } + + public void setValidafolio(Boolean validafolio) { + this.validafolio = validafolio; + } + + public Short getImprimeprecio() { + return imprimeprecio; + } + + public void setImprimeprecio(Short imprimeprecio) { + this.imprimeprecio = imprimeprecio; + } + + public List getConvenioDetList() { + List tmp = new ArrayList(); + if (convenioDetList != null) { + for (ConvenioDet cd : this.convenioDetList) { + if (cd.getActivo()) { + tmp.add(cd); + } + } + } + + return tmp; + } + + public void setConvenioDetList(List convenioDetList) { + this.convenioDetList = convenioDetList; + } + + public List getConvenioTramoList() { + List tempList = new ArrayList(); + + if (convenioTramoList != null) { + for (ConvenioTramo convenioTramo : this.convenioTramoList) { + if(convenioTramo.getActivo()) { + tempList.add(convenioTramo); + } + } + } + + return tempList; + } + + public List getConvenioUsuarioList() { + List tempList = new ArrayList(); + + if (convenioUsuarioList != null) { + for (ConvenioUsuario convenioUsuario : this.convenioUsuarioList) { + if (convenioUsuario.getActivo()) { + tempList.add(convenioUsuario); + } + } + } + + return tempList; + } + + public List getConvenioPuntoVentaList() { + List tempList = new ArrayList(); + + if (convenioPuntoVentaList != null) { + for (ConvenioPuntoVenta convenioPuntoVenta : this.convenioPuntoVentaList) { + if (convenioPuntoVenta.getActivo()) { + tempList.add(convenioPuntoVenta); + } + } + } + + return tempList; + } + + public void setConvenioPuntoVentaList(List convenioPuntoVentaList) { + this.convenioPuntoVentaList = convenioPuntoVentaList; + } + + public List getConvenioEmpresaList() { + List tempList = new ArrayList(); + + if (convenioEmpresaList != null) { + for (ConvenioEmpresa convenioEmpresa : this.convenioEmpresaList) { + if (convenioEmpresa.getActivo()) { + tempList.add(convenioEmpresa); + } + } + } + + return tempList; + } + + public List getConvenioRutaList() { + List tempList = new ArrayList(); + + if (convenioRutaList != null) { + for (ConvenioRuta convenioRuta : this.convenioRutaList) { + if (convenioRuta.getActivo()) { + tempList.add(convenioRuta); + } + } + } + + return tempList; + } + + public void setConvenioRutaList(List convenioRutaList) { + this.convenioRutaList = convenioRutaList; + } + + public void setConvenioEmpresaList(List convenioEmpresaList) { + this.convenioEmpresaList = convenioEmpresaList; + } + + public void setConvenioUsuarioList(List convenioUsuarioList) { + this.convenioUsuarioList = convenioUsuarioList; + } + + public void setConvenioTramoList(List convenioTramoList) { + this.convenioTramoList = convenioTramoList; + } + + public Date getFecVentaInicial() { + return fecVentaInicial; + } + + public void setFecVentaInicial(Date fecVentaInicial) { + this.fecVentaInicial = fecVentaInicial; + } + + public Date getFecVentaFinal() { + return fecVentaFinal; + } + + public void setFecVentaFinal(Date fecVentaFinal) { + this.fecVentaFinal = fecVentaFinal; + } + + public Date getFecViajeInicial() { + return fecViajeInicial; + } + + public void setFecViajeInicial(Date fecViajeInicial) { + this.fecViajeInicial = fecViajeInicial; + } + + public Date getFecViajeFinal() { + return fecViajeFinal; + } + + public void setFecViajeFinal(Date fecViajeFinal) { + this.fecViajeFinal = fecViajeFinal; + } + + public Integer getIndDescuentoNormal() { + return indDescuentoNormal; + } + + public void setIndDescuentoNormal(Integer indDescuentoNormal) { + this.indDescuentoNormal = indDescuentoNormal; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioId != null ? convenioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Convenio)) { + return false; + } + Convenio other = (Convenio) object; + if ((this.convenioId == null && other.convenioId != null) || (this.convenioId != null && !this.convenioId.equals(other.convenioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Convenio[convenioId=" + convenioId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java new file mode 100644 index 000000000..ca90859e1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java @@ -0,0 +1,181 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONVENIO_DET_SEQ", sequenceName = "CONVENIO_DET_SEQ", allocationSize = 1) +@Table(name = "CONVENIO_DET") +public class ConvenioDet implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_DET_SEQ") + @Basic(optional = false) + @Column(name = "CONVENIODET_ID") + private Integer conveniodetId; + + @Column(name = "PORCDESCUENTO") /* Refere-se ao desconto na tarifa */ + private BigDecimal porcdescuento; + @Column(name = "PORCDESCUENTOTAXAEMBARQUE") + private BigDecimal porcDescuentoTaxaEmbarque; + @Column(name = "PORCDESCUENTOPEDAGIO") + private BigDecimal porcDescuentoPedagio; + @Column(name = "PORCDESCUENTOSEGURO") + private BigDecimal porcDescuentoSeguro; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NUMFOLIOINICIAL") + private Long numfolioinicial; + @Column(name = "NUMFOLIOFINAL") + private Long numfoliofinal; + @Column(name = "QUANTIDADE") + private Long quantidade; + + public ConvenioDet() { + } + + public ConvenioDet(Integer conveniodetId) { + this.conveniodetId = conveniodetId; + } + + public Integer getConveniodetId() { + return conveniodetId; + } + + public void setConveniodetId(Integer conveniodetId) { + this.conveniodetId = conveniodetId; + } + + public BigDecimal getPorcdescuento() { + return porcdescuento; + } + + public void setPorcdescuento(BigDecimal porcdescuento) { + this.porcdescuento = porcdescuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Long getNumfolioinicial() { + return numfolioinicial; + } + + public void setNumfolioinicial(Long numfolioinicio) { + this.numfolioinicial = numfolioinicio; + } + + public Long getNumfoliofinal() { + return numfoliofinal; + } + + public void setNumfoliofinal(Long numfoliofinal) { + this.numfoliofinal = numfoliofinal; + } + + public BigDecimal getPorcDescuentoTaxaEmbarque() { + return porcDescuentoTaxaEmbarque; + } + + public void setPorcDescuentoTaxaEmbarque(BigDecimal porcDescuentoTaxaEmbarque) { + this.porcDescuentoTaxaEmbarque = porcDescuentoTaxaEmbarque; + } + + public BigDecimal getPorcDescuentoPedagio() { + return porcDescuentoPedagio; + } + + public void setPorcDescuentoPedagio(BigDecimal porcDescuentoPedagio) { + this.porcDescuentoPedagio = porcDescuentoPedagio; + } + + public BigDecimal getPorcDescuentoSeguro() { + return porcDescuentoSeguro; + } + + public void setPorcDescuentoSeguro(BigDecimal porcDescuentoSeguro) { + this.porcDescuentoSeguro = porcDescuentoSeguro; + } + + public Long getQuantidade() { + return quantidade; + } + + public void setQuantidade(Long quantidade) { + this.quantidade = quantidade; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (conveniodetId != null ? conveniodetId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioDet)) { + return false; + } + + ConvenioDet other = (ConvenioDet) object; + if ((this.conveniodetId == null && other.conveniodetId != null) || (this.conveniodetId != null && !this.conveniodetId.equals(other.conveniodetId))) { + return false; + } + + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioDet[conveniodetId=" + conveniodetId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java new file mode 100644 index 000000000..675ce5a87 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_EMPRESA_SEQ", sequenceName="CONVENIO_EMPRESA_SEQ", allocationSize=1) +@Table(name="CONVENIO_EMPRESA") +public class ConvenioEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_EMPRESA_SEQ") + @Column(name = "CONVENIOEMPRESA_ID") + private Integer convenioEmpresaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public Integer getConvenioEmpresaId() { + return convenioEmpresaId; + } + public void setConvenioEmpresaId(Integer convenioEmpresaId) { + this.convenioEmpresaId = convenioEmpresaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Convenio getConvenio() { + return convenio; + } + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioEmpresaId != null ? convenioEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioEmpresa)) { + return false; + } + ConvenioEmpresa other = (ConvenioEmpresa) object; + if ((this.convenioEmpresaId == null && other.convenioEmpresaId != null) || (this.convenioEmpresaId != null && !this.convenioEmpresaId.equals(other.convenioEmpresaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioEmpresa[convenioEmpresaId=" + convenioEmpresaId + "]"; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioPuntoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioPuntoVenta.java new file mode 100644 index 000000000..f912b818d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioPuntoVenta.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_PTOVTA_SEQ", sequenceName="CONVENIO_PTOVTA_SEQ", allocationSize=1) +@Table(name="CONVENIO_PTOVTA") +public class ConvenioPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_PTOVTA_SEQ") + @Column(name = "CONVENIOPTOVTA_ID") + private Integer convenioPuntoVentaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioPuntoVentaId != null ? convenioPuntoVentaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioPuntoVenta)) { + return false; + } + ConvenioPuntoVenta other = (ConvenioPuntoVenta) object; + if ((this.convenioPuntoVentaId == null && other.convenioPuntoVentaId != null) || (this.convenioPuntoVentaId != null && !this.convenioPuntoVentaId.equals(other.convenioPuntoVentaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioPuntoVenta[convenioPuntoVentaId=" + convenioPuntoVentaId + "]"; + } + + public Integer getConvenioPuntoVentaId() { + return convenioPuntoVentaId; + } + + public void setConvenioPuntoVentaId(Integer convenioPuntoVentaId) { + this.convenioPuntoVentaId = convenioPuntoVentaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Convenio getConvenio() { + return convenio; + } + + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java new file mode 100644 index 000000000..5a93bc136 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_RUTA_SEQ", sequenceName="CONVENIO_RUTA_SEQ", allocationSize=1) +@Table(name="CONVENIO_RUTA") +public class ConvenioRuta implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_RUTA_SEQ") + @Column(name = "CONVENIORUTA_ID") + private Integer convenioRutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + public Integer getConvenioRutaId() { + return convenioRutaId; + } + public void setConvenioRutaId(Integer convenioRutaId) { + this.convenioRutaId = convenioRutaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Convenio getConvenio() { + return convenio; + } + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioRutaId != null ? convenioRutaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioRuta)) { + return false; + } + ConvenioRuta other = (ConvenioRuta) object; + if ((this.convenioRutaId == null && other.convenioRutaId != null) || (this.convenioRutaId != null && !this.convenioRutaId.equals(other.convenioRutaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioRuta[convenioRutaId=" + convenioRutaId + "]"; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioTramo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioTramo.java new file mode 100644 index 000000000..9521bfff9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioTramo.java @@ -0,0 +1,142 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_TRAMO_SEQ", sequenceName="CONVENIO_TRAMO_SEQ", allocationSize=1) +@Table(name="CONVENIO_TRAMO") +public class ConvenioTramo implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_TRAMO_SEQ") + @Column(name = "CONVENIOTRAMO_ID") + private Integer convenioTramoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaOrigem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaDestino; + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ConvenioTramo other = (ConvenioTramo) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.convenio != other.convenio && (this.convenio == null || !this.convenio.equals(other.convenio))) { + return false; + } + if (this.paradaOrigem != other.paradaOrigem && (this.paradaOrigem == null || !this.paradaOrigem.equals(other.paradaOrigem))) { + return false; + } + if (this.paradaDestino != other.paradaDestino && (this.paradaDestino == null || !this.paradaDestino.equals(other.paradaDestino))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 73 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 73 * hash + (this.convenio != null ? this.convenio.hashCode() : 0); + hash = 73 * hash + (this.paradaOrigem != null ? this.paradaOrigem.hashCode() : 0); + hash = 73 * hash + (this.paradaDestino != null ? this.paradaDestino.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioTramo[conveniaTramoId=" + convenioTramoId + "]"; + } + + public Integer getConvenioTramoId() { + return convenioTramoId; + } + + public void setConvenioTramoId(Integer convenioTramoId) { + this.convenioTramoId = convenioTramoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Convenio getConvenio() { + return convenio; + } + + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + + public Parada getParadaOrigem() { + return paradaOrigem; + } + + public void setParadaOrigem(Parada paradaOrigem) { + this.paradaOrigem = paradaOrigem; + } + + public Parada getParadaDestino() { + return paradaDestino; + } + + public void setParadaDestino(Parada paradaDestino) { + this.paradaDestino = paradaDestino; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioUsuario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioUsuario.java new file mode 100644 index 000000000..8d4e2ec6b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ConvenioUsuario.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_USUARIO_SEQ", sequenceName="CONVENIO_USUARIO_SEQ", allocationSize=1) +@Table(name="CONVENIO_USUARIO") +public class ConvenioUsuario implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_USUARIO_SEQ") + @Column(name = "CONVENIOUSUARIO_ID") + private Integer convenioUsuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "USUARIOCONVENIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuario; + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioUsuarioId != null ? convenioUsuarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioUsuario)) { + return false; + } + ConvenioUsuario other = (ConvenioUsuario) object; + if ((this.convenioUsuarioId == null && other.convenioUsuarioId != null) || (this.convenioUsuarioId != null && !this.convenioUsuarioId.equals(other.convenioUsuarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioUsuario[convenioUsuarioId=" + convenioUsuarioId + "]"; + } + + public Integer getConvenioUsuarioId() { + return convenioUsuarioId; + } + + public void setConvenioUsuarioId(Integer convenioUsuarioId) { + this.convenioUsuarioId = convenioUsuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Convenio getConvenio() { + return convenio; + } + + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Corrida.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Corrida.java new file mode 100644 index 000000000..4dfce1f1f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Corrida.java @@ -0,0 +1,538 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "CORRIDA") +public class Corrida implements Serializable { + + private static final long serialVersionUID = 1L; + + @Embeddable + public static class Id implements Serializable { + + private static final long serialVersionUID = 1L; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "FECCORRIDA") + @Temporal(TemporalType.DATE) + private Date feccorrida; + + public Id() { + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFeccorrida() { + return feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + @Override + public String toString() { + SimpleDateFormat sf = new SimpleDateFormat("dd/MM HH:mm"); + return corridaId + " Hora:" + sf.format(feccorrida); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((corridaId == null) ? 0 : corridaId.hashCode()); + result = prime * result + ((feccorrida == null) ? 0 : feccorrida.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Id other = (Id) obj; + if (corridaId == null) { + if (other.corridaId != null) + return false; + } else if (!corridaId.equals(other.corridaId)) + return false; + if (feccorrida == null) { + if (other.feccorrida != null) + return false; + } else if (!feccorrida.equals(other.feccorrida)) + return false; + return true; + } + } + + @EmbeddedId + private Id id = new Id(); + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalida; + @Column(name = "INDSTATUSCORRIDA") + private String indstatuscorrida; + @Column(name = "FECHORTARJETAVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fechortarjetaviaje; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + private Autobus autobus; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CONDUCTOR1_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor; + @JoinColumn(name = "CONDUCTOR2_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor1; + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID", insertable = false, updatable = false) + @ManyToOne(optional = false) + private CorridaCtrl corridaCtrl; + @OneToMany(mappedBy = "corrida", cascade = CascadeType.ALL) + private List corridaTramoList; + @JoinColumn(name = "EMPRESACORRIDA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "EMPRESAINGRESO_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa1; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "NODO_ID", referencedColumnName = "NODO_ID") + @ManyToOne + private Nodo nodo; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "ZONA_ID", referencedColumnName = "ZONA_ID") + @ManyToOne + private Zona zona; + @OneToOne + @JoinColumn(name = "ROLOPERATIVO_ID") + private RolOperativo rolOperativo; + @Column(name = "CANTPARADOS") + private Short cantParados; + @Column(name = "TIPOSERVICIO_ID") + private Short tipoServicio; + @Column(name = "fechorsalidaoriginal") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginal; + @OneToOne + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "esquemacorrida_id", referencedColumnName = "esquemacorrida_id") + private EsquemaCorrida esquemaCorrida; + @Column(name = "indtipoventa") + private String indTipoVenta; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @ManyToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDAREBOTE_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDAREBOTE", referencedColumnName = "FECCORRIDA") }) + @NotFound(action = NotFoundAction.IGNORE) + private Corrida corridaRebote; + @ManyToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA2_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA2", referencedColumnName = "FECCORRIDA") }) + @NotFound(action = NotFoundAction.IGNORE) + private Corrida corridaPiso; + @JoinColumn(name = "DIVISIONINGRESO_ID", referencedColumnName = "DIVISION_ID") + @ManyToOne + private Division division; + @Column(name = "NUMPISO") + private Integer numPiso; + + @Column(name = "fechorsalidaoriginalh") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginalH; + + @Column(name = "ESQUEMAAGRUPACION_ID") + private Integer esquemaAgrupacionId; + + @Column(name = "CODPRODUTOFISCAL") + private String codProdutoFiscal; + + @Column(name = "INFOCORRIDA") + private String infoCorrida; + + public String getIndTipoVenta() { + return indTipoVenta; + } + + public void setIndTipoVenta(String indTipoVenta) { + this.indTipoVenta = indTipoVenta; + } + + public Date getFechorSalidaOriginal() { + return fechorSalidaOriginal; + } + + public void setFechorSalidaOriginal(Date fechorSalidaOriginal) { + if (fechorSalidaOriginal != null) { + fechorSalidaOriginal = DateUtil.normalizar(fechorSalidaOriginal); + } + this.fechorSalidaOriginal = fechorSalidaOriginal; + } + + public EsquemaCorrida getEsquemaCorrida() { + return esquemaCorrida; + } + + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } + + public Corrida() { + } + + public Corrida(Integer corridaId, Date feccorrida) { + this.id.setCorridaId(corridaId); + this.id.setFeccorrida(feccorrida); + } + + public Corrida(Marca marca, Integer corridaId, Parada origen, Parada destino, ClaseServicio claseServicio, Date horario) { + this.id = new Id(); + this.id.setCorridaId(corridaId); + this.setFechorsalida(horario); + this.origem = origen; + this.destino = destino; + this.claseServicio = claseServicio; + this.marca = marca; + } + + public Corrida(Integer corridaId, Parada origen, Parada destino) { + this.id = new Id(); + this.id.setCorridaId(corridaId); + this.origem = origen; + this.destino = destino; + } + + public Id getId() { + return id; + } + + public void setId(Id id) { + this.id = id; + } + + public List getCorridaTramoList() { + return corridaTramoList; + } + + public void setCorridaTramoList(List corridaTramoList) { + this.corridaTramoList = corridaTramoList; + } + + public Date getFechorsalida() { + return fechorsalida; + } + + public void setFechorsalida(Date fechorsalida) { + if (fechorsalida != null) { + fechorsalida = DateUtil.normalizar(fechorsalida); + } + this.fechorsalida = fechorsalida; + } + + public String getIndstatuscorrida() { + return indstatuscorrida; + } + + public void setIndstatuscorrida(String indstatuscorrida) { + this.indstatuscorrida = indstatuscorrida; + } + + public Date getFechortarjetaviaje() { + return fechortarjetaviaje; + } + + public void setFechortarjetaviaje(Date fechortarjetaviaje) { + this.fechortarjetaviaje = fechortarjetaviaje; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Conductor getConductor() { + return conductor; + } + + public void setConductor(Conductor conductor) { + this.conductor = conductor; + } + + public Conductor getConductor1() { + return conductor1; + } + + public void setConductor1(Conductor conductor1) { + this.conductor1 = conductor1; + } + + public CorridaCtrl getCorridaCtrl() { + return corridaCtrl; + } + + public void setCorridaCtrl(CorridaCtrl corridaCtrl) { + this.corridaCtrl = corridaCtrl; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Empresa getEmpresa1() { + return empresa1; + } + + public void setEmpresa1(Empresa empresa1) { + this.empresa1 = empresa1; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Zona getZona() { + return zona; + } + + public void setZona(Zona zona) { + this.zona = zona; + } + + public RolOperativo getRolOperativo() { + return rolOperativo; + } + + public void setRolOperativo(RolOperativo rolOperativo) { + this.rolOperativo = rolOperativo; + } + + public Short getCantParados() { + return cantParados; + } + + public void setCantParados(Short cantParados) { + this.cantParados = cantParados; + } + + public Short getTipoServicio() { + return tipoServicio; + } + + public void setTipoServicio(Short tipoServicio) { + this.tipoServicio = tipoServicio; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Corrida getCorridaRebote() { + return corridaRebote; + } + + public void setCorridaRebote(Corrida corridaRebote) { + this.corridaRebote = corridaRebote; + } + + public Division getDivision() { + return division; + } + + public void setDivision(Division division) { + this.division = division; + } + + public Corrida getCorridaPiso() { + return corridaPiso; + } + + public void setCorridaPiso(Corrida corridaPiso) { + this.corridaPiso = corridaPiso; + } + + public Integer getNumPiso() { + return numPiso; + } + + public void setNumPiso(Integer numPiso) { + this.numPiso = numPiso; + } + + public Date getFechorSalidaOriginalH() { + return fechorSalidaOriginalH; + } + + public void setFechorSalidaOriginalH(Date fechorSalidaOriginalH) { + this.fechorSalidaOriginalH = fechorSalidaOriginalH; + } + + public Integer getEsquemaAgrupacionId() { + return esquemaAgrupacionId; + } + + public void setEsquemaAgrupacionId(Integer esquemaAgrupacionId) { + this.esquemaAgrupacionId = esquemaAgrupacionId; + } + + public String getCodProdutoFiscal() { + return codProdutoFiscal; + } + + public void setCodProdutoFiscal(String codProdutoFiscal) { + this.codProdutoFiscal = codProdutoFiscal; + } + + public String getInfoCorrida() { + return infoCorrida; + } + + public void setInfoCorrida(String infoCorrida) { + this.infoCorrida = infoCorrida; + } + + @Override + public String toString() { + return id.toString(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CorridaCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CorridaCtrl.java new file mode 100644 index 000000000..a45f30c47 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CorridaCtrl.java @@ -0,0 +1,170 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "CORRIDA_CTRL") +public class CorridaCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "HORARIO") + @Temporal(TemporalType.TIME) + private Date horario; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @Column(name = "INDPISOEXTRA") + private Boolean pisoExtra; + + public CorridaCtrl() { + } + + public Boolean getPisoExtra() { + return pisoExtra; + } + + public void setPisoExtra(Boolean pisoExtra) { + this.pisoExtra = pisoExtra; + } + + public CorridaCtrl(Integer corridaId) { + this.corridaId = corridaId; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getHorario() { + return horario; + } + + public void setHorario(Date horario) { + this.horario = horario; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (corridaId != null ? corridaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CorridaCtrl)) { + return false; + } + CorridaCtrl other = (CorridaCtrl) object; + if ((this.corridaId == null && other.corridaId != null) || (this.corridaId != null && !this.corridaId.equals(other.corridaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.CorridaCtrl[corridaId=" + corridaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CorridaTramo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CorridaTramo.java new file mode 100644 index 000000000..b5be4b6e9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CorridaTramo.java @@ -0,0 +1,376 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.SequenceGenerator; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CORRIDA_TRAMO_SEQ", sequenceName = "CORRIDA_TRAMO_SEQ", allocationSize = 1) +@Table(name = "CORRIDA_TRAMO") +public class CorridaTramo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CORRIDATRAMO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORRIDA_TRAMO_SEQ") + private Integer corridatramoId; + @OneToOne + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA", referencedColumnName = "FECCORRIDA") }) + private Corrida corrida; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalida; + @Column(name = "FECHORLLEGADA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorllegada; + @Column(name = "FECHORTARJETAVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fechortarjetaviaje; + @Column(name = "USUARIOTARJETAVIAJE_ID") + private Integer usuariotarjetaviajeId; + @Column(name = "NUMSECORIGEN") + private Short numsecorigen; + @Column(name = "NUMSECDESTINO") + private Short numsecdestino; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "NODO_ID", referencedColumnName = "NODO_ID") + @ManyToOne + private Nodo nodo; + @JoinColumn(name = "CONDUCTOR1_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor; + @JoinColumn(name = "CONDUCTOR2_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor1; + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + @ManyToOne + private Autobus autobus; + @Column(name = "fechorsalidaoriginal") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginal; + @Column(name = "TIEMPOESTANCIA") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date tiempoEstancia; + @Column(name = "INDMANTTARJETA") + private Boolean indmanttarjeta; + @Column(name = "FOLIOTARJETAVIAJE") + private String folioTarjeta; + @Column(name = "PLATAFORMA") + private String plataforma; + + @Column(name = "FECHORSALIDAH") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalidaH; + @Column(name = "FECHORLLEGADAH") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorllegadaH; + + @Column(name = "fechorsalidaoriginalh") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginalH; + + public Boolean getIndmanttarjeta() { + return indmanttarjeta; + } + + public void setIndmanttarjeta(Boolean indmanttarjeta) { + this.indmanttarjeta = indmanttarjeta; + } + + public Date getTiempoEstancia() { + return tiempoEstancia; + } + + public void setTiempoEstancia(Date tiempoEstancia) { + this.tiempoEstancia = tiempoEstancia; + } + + public CorridaTramo() { + } + + public CorridaTramo(Integer corridatramoId) { + this.corridatramoId = corridatramoId; + } + + public Date getFechorSalidaOriginal() { + return fechorSalidaOriginal; + } + + public void setFechorSalidaOriginal(Date fechorSalidaOriginal) { + if (fechorSalidaOriginal != null) { + fechorSalidaOriginal = DateUtil.normalizar(fechorSalidaOriginal); + } + this.fechorSalidaOriginal = fechorSalidaOriginal; + } + + public Integer getCorridatramoId() { + return corridatramoId; + } + + public void setCorridatramoId(Integer corridatramoId) { + this.corridatramoId = corridatramoId; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Date getFechorsalida() { + return fechorsalida; + } + + public void setFechorsalida(Date fechorsalida) { + if (fechorsalida != null) { + fechorsalida = DateUtil.normalizar(fechorsalida); + } + this.fechorsalida = fechorsalida; + } + + public Date getFechorllegada() { + return fechorllegada; + } + + public void setFechorllegada(Date fechorllegada) { + if (fechorllegada != null) { + fechorllegada = DateUtil.normalizar(fechorllegada); + } + this.fechorllegada = fechorllegada; + } + + public Date getFechortarjetaviaje() { + return fechortarjetaviaje; + } + + public void setFechortarjetaviaje(Date fechortarjetaviaje) { + this.fechortarjetaviaje = fechortarjetaviaje; + } + + public Integer getUsuariotarjetaviajeId() { + return usuariotarjetaviajeId; + } + + public void setUsuariotarjetaviajeId(Integer usuariotarjetaviajeId) { + this.usuariotarjetaviajeId = usuariotarjetaviajeId; + } + + public Short getNumsecorigen() { + return numsecorigen; + } + + public void setNumsecorigen(Short numsecorigen) { + this.numsecorigen = numsecorigen; + } + + public Short getNumsecdestino() { + return numsecdestino; + } + + public void setNumsecdestino(Short numsecdestino) { + this.numsecdestino = numsecdestino; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public com.rjconsultores.ventaboletos.entidad.Parada getDestino() { + return destino; + } + + public void setDestino(com.rjconsultores.ventaboletos.entidad.Parada destino) { + this.destino = destino; + } + + public com.rjconsultores.ventaboletos.entidad.Parada getOrigem() { + return origem; + } + + public void setOrigem(com.rjconsultores.ventaboletos.entidad.Parada origem) { + this.origem = origem; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Conductor getConductor() { + return conductor; + } + + public void setConductor(Conductor conductor) { + this.conductor = conductor; + } + + public Conductor getConductor1() { + return conductor1; + } + + public void setConductor1(Conductor conductor1) { + this.conductor1 = conductor1; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public String getFolioTarjeta() { + return folioTarjeta; + } + + public void setFolioTarjeta(String folioTarjeta) { + this.folioTarjeta = folioTarjeta; + } + + public String getPlataforma() { + return plataforma; + } + + public void setPlataforma(String plataforma) { + this.plataforma = plataforma; + } + + public Date getFechorsalidaH() { + return fechorsalidaH; + } + + public void setFechorsalidaH(Date fechorsalidaH) { + this.fechorsalidaH = fechorsalidaH; + } + + public Date getFechorllegadaH() { + return fechorllegadaH; + } + + public void setFechorllegadaH(Date fechorllegadaH) { + this.fechorllegadaH = fechorllegadaH; + } + + public Date getFechorSalidaOriginalH() { + return fechorSalidaOriginalH; + } + + public void setFechorSalidaOriginalH(Date fechorSalidaOriginalH) { + this.fechorSalidaOriginalH = fechorSalidaOriginalH; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (corridatramoId != null ? corridatramoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof CorridaTramo)) { + return false; + } + CorridaTramo other = (CorridaTramo) object; + if ((this.corridatramoId == null && other.corridatramoId != null) || (this.corridatramoId != null && !this.corridatramoId.equals(other.corridatramoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.CorridaTramo[corridatramoId=" + corridatramoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Cortesia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Cortesia.java new file mode 100644 index 000000000..7e7a2ac89 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Cortesia.java @@ -0,0 +1,260 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "CORTESIA_SEQ", sequenceName = "CORTESIA_SEQ", allocationSize = 1) +@Table(name = "CORTESIA") +public class Cortesia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORTESIA_SEQ") + @Column(name = "CORTESIA_ID") + private Integer cortesiaId; + @Column(name = "DESCCORREO") + private String descCorreo; + @Column(name = "INDTIPOVIAJE") + private String indtipoviaje; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicio; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinal; + @Column(name = "NDSTATUS") + private String ndstatus; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPLEADO_ID") + @OneToOne + private Empleado empleado; + @JoinColumn(name = "TIPOCORTESIA_ID", referencedColumnName = "TIPOCORTESIA_ID") + @ManyToOne + private TipoCortesia tipoCortesia; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "MOTIVOVIAJE_ID", referencedColumnName = "MOTIVOVIAJE_ID") + @ManyToOne + private MotivoViaje motivoViaje; + @OneToMany(mappedBy = "cortesia", cascade = CascadeType.ALL) + @LazyCollection(value = LazyCollectionOption.FALSE) + private List cortesiaBeneficiarioList; + + public MotivoViaje getMotivoViaje() { + return motivoViaje; + } + + public void setMotivoViaje(MotivoViaje motivoViaje) { + this.motivoViaje = motivoViaje; + } + + public List getCortesiaBeneficiarioList() { + List cb = new ArrayList(); + if (cortesiaBeneficiarioList != null) { + for (CortesiaBeneficiario ctb : this.cortesiaBeneficiarioList) { + if (ctb.getActivo() == Boolean.TRUE) { + cb.add(ctb); + } + } + } + + this.cortesiaBeneficiarioList = cb; + + return cb; + } + + public void setCortesiaBeneficiarioList(List cortesiaBeneficiarioList) { + this.cortesiaBeneficiarioList = cortesiaBeneficiarioList; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Integer getCortesiaId() { + return cortesiaId; + } + + public void setCortesiaId(Integer cortesiaId) { + this.cortesiaId = cortesiaId; + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Empleado getEmpleado() { + return empleado; + } + + public void setEmpleado(Empleado empleado) { + this.empleado = empleado; + } + + public Date getFecfinal() { + return fecfinal; + } + + public void setFecfinal(Date fecfinal) { + this.fecfinal = fecfinal; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public String getIndtipoviaje() { + return indtipoviaje; + } + + public void setIndtipoviaje(String indtipoviaje) { + this.indtipoviaje = indtipoviaje; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public String getNdstatus() { + return ndstatus; + } + + public void setNdstatus(String ndstatus) { + this.ndstatus = ndstatus; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public TipoCortesia getTipoCortesia() { + return tipoCortesia; + } + + public void setTipoCortesia(TipoCortesia tipoCortesia) { + this.tipoCortesia = tipoCortesia; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cortesiaId != null ? cortesiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Cortesia)) { + return false; + } + Cortesia other = (Cortesia) object; + if ((this.cortesiaId == null && other.cortesiaId != null) || (this.cortesiaId != null && !this.cortesiaId.equals(other.cortesiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Cortesia[cortesiaId=" + cortesiaId + "]"; + //return this.getEmpleado() + getDescCorreo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CortesiaBeneficiario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CortesiaBeneficiario.java new file mode 100644 index 000000000..3bdb744f2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CortesiaBeneficiario.java @@ -0,0 +1,186 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "CORTESIA_BENEFICIARIO_SEQ", sequenceName = "CORTESIA_BENEFICIARIO_SEQ", allocationSize = 1) +@Table(name = "CORTESIA_BENEFICIARIO") +public class CortesiaBeneficiario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORTESIA_BENEFICIARIO_SEQ") + @Column(name = "CORTESIABENEFICIARIO_ID") + private Integer cortesiaBeneficiarioId; + @Column(name = "NOMBBENEF") + private String nombBenef; + @Column(name = "NOMBPATERNO") + private String nombPaterno; + @Column(name = "NOMBMATERNO") + private String nombMaterno; + @Column(name = "INDTIPOBENEF") + private String indtipobenef; + @Column(name = "FECUTILIZACIONIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecUtilizacionIda; + @Column(name = "FECUTILIZACIONREGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecUtilizacionRegreso; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CORTESIA_ID", referencedColumnName = "CORTESIA_ID") + @ManyToOne + private Cortesia cortesia; + @JoinColumn(name = "TIPOCORTESIADESCUENTO_ID", referencedColumnName = "TIPOCORTESIADESCUENTO_ID") + @ManyToOne + private TipoCortesiaDescuento descuento; + + public TipoCortesiaDescuento getDescuento() { + return descuento; + } + + public void setDescuento(TipoCortesiaDescuento descuento) { + this.descuento = descuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Cortesia getCortesia() { + return cortesia; + } + + public void setCortesia(Cortesia cortesia) { + this.cortesia = cortesia; + } + + public Integer getCortesiaBeneficiarioId() { + return cortesiaBeneficiarioId; + } + + public void setCortesiaBeneficiarioId(Integer cortesiaBeneficiarioId) { + this.cortesiaBeneficiarioId = cortesiaBeneficiarioId; + } + + public Date getFecUtilizacionIda() { + return fecUtilizacionIda; + } + + public void setFecUtilizacionIda(Date fecUtilizacionIda) { + this.fecUtilizacionIda = fecUtilizacionIda; + } + + public Date getFecUtilizacionRegreso() { + return fecUtilizacionRegreso; + } + + public void setFecUtilizacionRegreso(Date fecUtilizacionRegreso) { + this.fecUtilizacionRegreso = fecUtilizacionRegreso; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public String getNombBenef() { + return nombBenef; + } + + public void setNombBenef(String nombBenef) { + this.nombBenef = nombBenef; + } + + public String getNombMaterno() { + return nombMaterno; + } + + public void setNombMaterno(String nombMaterno) { + this.nombMaterno = nombMaterno; + } + + public String getNombPaterno() { + return nombPaterno; + } + + public void setNombPaterno(String nombPaterno) { + this.nombPaterno = nombPaterno; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getIndtipobenef() { + return indtipobenef; + } + + public void setIndtipobenef(String indtipobenef) { + this.indtipobenef = indtipobenef; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cortesiaBeneficiarioId != null ? cortesiaBeneficiarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CortesiaBeneficiario)) { + return false; + } + CortesiaBeneficiario other = (CortesiaBeneficiario) object; + if ((this.cortesiaBeneficiarioId == null && other.cortesiaBeneficiarioId != null) || (this.cortesiaBeneficiarioId != null && !this.cortesiaBeneficiarioId.equals(other.cortesiaBeneficiarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario[cortesiaBeneficiarioId=" + cortesiaBeneficiarioId + "]"; + //return this.getNombBenef(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CortesiaDireccion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CortesiaDireccion.java new file mode 100644 index 000000000..a26391f74 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CortesiaDireccion.java @@ -0,0 +1,177 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + * + */ +@Entity +@SequenceGenerator(name = "CORTESIA_DIRECCION_SEQ", sequenceName = "CORTESIA_DIRECCION_SEQ", allocationSize = 1) +@Table(name = "CORTESIA_DIRECCION") +public class CortesiaDireccion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORTESIA_DIRECCION_SEQ") + @Column(name = "CORTESIADIRECCION_ID") + private Integer cortesiaDireccionId; + @Column(name = "NUMFOLIOINICIO") + private Integer numFolioInicio; + @Column(name = "NUMFOLIOFIN") + private Integer numFolioFin; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecInicioV; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecFinV; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOCORTESIADESCUENTO_ID", referencedColumnName = "TIPOCORTESIADESCUENTO_ID") + @ManyToOne + private TipoCortesiaDescuento tipocortesiaDescuento; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public TipoCortesiaDescuento getTipocortesiaDescuento() { + return tipocortesiaDescuento; + } + + public void setTipocortesiaDescuento(TipoCortesiaDescuento tipocortesiaDescuento) { + this.tipocortesiaDescuento = tipocortesiaDescuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getCortesiaDireccionId() { + return cortesiaDireccionId; + } + + public void setCortesiaDireccionId(Integer cortesiaDireccionId) { + this.cortesiaDireccionId = cortesiaDireccionId; + } + + public Date getFecFinV() { + return fecFinV; + } + + public void setFecFinV(Date fecFinV) { + this.fecFinV = fecFinV; + } + + public Date getFecInicioV() { + return fecInicioV; + } + + public void setFecInicioV(Date fecInicioV) { + this.fecInicioV = fecInicioV; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getNumFolioFin() { + return numFolioFin; + } + + public void setNumFolioFin(Integer numFolioFin) { + this.numFolioFin = numFolioFin; + } + + public Integer getNumFolioInicio() { + return numFolioInicio; + } + + public void setNumFolioInicio(Integer numFolioInicio) { + this.numFolioInicio = numFolioInicio; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cortesiaDireccionId != null ? cortesiaDireccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof CortesiaDireccion)) { + return false; + } + CortesiaDireccion other = (CortesiaDireccion) obj; + if ((this.cortesiaDireccionId == null && other.cortesiaDireccionId != null) || (this.cortesiaDireccionId != null && !this.cortesiaDireccionId.equals(other.cortesiaDireccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CortesiaDireccion[cortesiaDireccionId=" + cortesiaDireccionId + "]"; + //return this.getDescTipo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CuponConvenio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CuponConvenio.java new file mode 100644 index 000000000..90c16412f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CuponConvenio.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "CUPON_CONVENIO_SEQ", sequenceName = "CUPON_CONVENIO_SEQ", allocationSize = 1) +@Table(name = "CUPON_CONVENIO") +public class CuponConvenio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUPON_CONVENIO_SEQ") + @Column(name = "CUPONCONVENIO_ID") + private Integer cuponConvenioID; + @Column(name = "NUMFOLIOINICIO") + private Integer folioInicio; + @Column(name = "NUMFOLIOFINAL") + private Integer folioFinal; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOCONVENIO_ID", referencedColumnName = "TIPOCONVENIO_ID") + @ManyToOne + private TipoConvenio tipoConvenio; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getCuponConvenioID() { + return cuponConvenioID; + } + + public void setCuponConvenioID(Integer cuponConvenioID) { + this.cuponConvenioID = cuponConvenioID; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getFolioFinal() { + return folioFinal; + } + + public void setFolioFinal(Integer folioFinal) { + this.folioFinal = folioFinal; + } + + public Integer getFolioInicio() { + return folioInicio; + } + + public void setFolioInicio(Integer folioInicio) { + this.folioInicio = folioInicio; + } + + public TipoConvenio getTipoConvenio() { + return tipoConvenio; + } + + public void setTipoConvenio(TipoConvenio tipoConvenio) { + this.tipoConvenio = tipoConvenio; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cuponConvenioID != null ? cuponConvenioID.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CuponConvenio)) { + return false; + } + CuponConvenio other = (CuponConvenio) object; + if ((this.cuponConvenioID == null && other.cuponConvenioID != null) || (this.cuponConvenioID != null && !this.cuponConvenioID.equals(other.cuponConvenioID))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.CuponConvenio[cuponConvenioID=" + cuponConvenioID + "]"; + return this.getTipoConvenio().getDescTipo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CuponSecretaria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CuponSecretaria.java new file mode 100644 index 000000000..f9c3ce06d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CuponSecretaria.java @@ -0,0 +1,178 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "CUPON_SECRETARIA") +@SequenceGenerator(name = "CUPON_SECRETARIA_SEQ", sequenceName = "CUPON_SECRETARIA_SEQ", allocationSize = 1) +public class CuponSecretaria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUPON_SECRETARIA_SEQ") + @Column(name = "CUPONSECRETARIA_ID") + private Integer cuponsecretariaId; + @Column(name = "NUMFOLIOINICIO") + private Long numfolioinicio; + @Column(name = "NUMFOLIOFINAL") + private Long numfoliofinal; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "PORCDESCUENTO") + private BigDecimal porcdescuento; + + @Column(name = "PORCDESCUENTOOUTROS") + private BigDecimal porcdescuentooutros; + @Column(name = "PORCDESCUENTOPEDAGIO") + private BigDecimal porcdescuentopedagio; + @Column(name = "PORCDESCUENTOSEGURO") + private BigDecimal porcdescuentoseguro; + @Column(name = "PORCDESCUENTOTAXAEMBARQUE") + private BigDecimal porcdescuentotaxaembarque; + + public CuponSecretaria() { + } + + public CuponSecretaria(Integer cuponsecretariaId) { + this.cuponsecretariaId = cuponsecretariaId; + } + + public Integer getCuponsecretariaId() { + return cuponsecretariaId; + } + + public void setCuponsecretariaId(Integer cuponsecretariaId) { + this.cuponsecretariaId = cuponsecretariaId; + } + + public Long getNumfolioinicio() { + return numfolioinicio; + } + + public void setNumfolioinicio(Long numfolioinicio) { + this.numfolioinicio = numfolioinicio; + } + + public Long getNumfoliofinal() { + return numfoliofinal; + } + + public void setNumfoliofinal(Long numfoliofinal) { + this.numfoliofinal = numfoliofinal; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public BigDecimal getPorcdescuento() { + return porcdescuento; + } + + public void setPorcdescuento(BigDecimal porcdescuento) { + this.porcdescuento = porcdescuento; + } + + public BigDecimal getPorcdescuentooutros() { + return porcdescuentooutros; + } + + public void setPorcdescuentooutros(BigDecimal porcdescuentooutros) { + this.porcdescuentooutros = porcdescuentooutros; + } + + public BigDecimal getPorcdescuentopedagio() { + return porcdescuentopedagio; + } + + public void setPorcdescuentopedagio(BigDecimal porcdescuentopedagio) { + this.porcdescuentopedagio = porcdescuentopedagio; + } + + public BigDecimal getPorcdescuentoseguro() { + return porcdescuentoseguro; + } + + public void setPorcdescuentoseguro(BigDecimal porcdescuentoseguro) { + this.porcdescuentoseguro = porcdescuentoseguro; + } + + public BigDecimal getPorcdescuentotaxaembarque() { + return porcdescuentotaxaembarque; + } + + public void setPorcdescuentotaxaembarque(BigDecimal porcdescuentotaxaembarque) { + this.porcdescuentotaxaembarque = porcdescuentotaxaembarque; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cuponsecretariaId != null ? cuponsecretariaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CuponSecretaria)) { + return false; + } + CuponSecretaria other = (CuponSecretaria) object; + if ((this.cuponsecretariaId == null && other.cuponsecretariaId != null) || (this.cuponsecretariaId != null && !this.cuponsecretariaId.equals(other.cuponsecretariaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CuponSecretaria[cuponsecretariaId=" + cuponsecretariaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Curso.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Curso.java new file mode 100644 index 000000000..f32d9498b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Curso.java @@ -0,0 +1,100 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CURSO_SEQ", sequenceName = "CURSO_SEQ", allocationSize = 1) +@Table(name = "CURSO") +public class Curso implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CURSO_SEQ") + @Basic(optional = false) + @Column(name = "CURSO_ID") + private Integer cursoId; + @Column(name = "NOMCURSO") + private String nomcurso; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToMany + @JoinTable(name = "CLIENTE_CURSO", joinColumns = { @JoinColumn(name = "CURSO_ID") }, + inverseJoinColumns = { @JoinColumn(name = "CLIENTE_ID") }) + private List clienteList; + + public Integer getCursoId() { + return cursoId; + } + + public void setCursoId(Integer cursoId) { + this.cursoId = cursoId; + } + + public String getNomcurso() { + return nomcurso; + } + + public void setNomcurso(String nomcurso) { + this.nomcurso = nomcurso; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getClienteList() { + return clienteList; + } + + public void setClienteList(List clienteList) { + this.clienteList = clienteList; + } + + @Override + public String toString() { + return this.nomcurso; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CustomIdGenerator.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CustomIdGenerator.java new file mode 100644 index 000000000..a9b41d0d9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/CustomIdGenerator.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.dialect.Dialect; +import org.hibernate.engine.SessionImplementor; +import org.hibernate.id.Configurable; +import org.hibernate.id.IdentifierGenerator; + +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; + +public class CustomIdGenerator implements IdentifierGenerator, Configurable { + + private String seqName; + private Integer tamanho; + + public Serializable generate(SessionImplementor session, Object object) + throws HibernateException { + + Connection connection = session.connection(); + try { + + PreparedStatement ps = connection + .prepareStatement("SELECT " + seqName + ".NEXTVAL AS NEXTVAL FROM DUAL"); + + ResultSet rs = ps.executeQuery(); + + if (rs.next()) { + Integer id = rs.getInt("NEXTVAL"); + String newValue = id.toString(); + if (ApplicationProperties.getInstance().habilitarCustomSequence()) { + newValue = "1" + (StringUtils.leftPad(id.toString(), tamanho, "0")); + } + return Integer.valueOf(newValue); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + return null; + } + + @Override + public void configure(org.hibernate.type.Type arg0, Properties arg1, Dialect arg2) throws MappingException { + setTamanho(Integer.valueOf(arg1.getProperty("tamanho"))); + setSeqName(arg1.getProperty("seqName")); + } + + public Integer getTamanho() { + return tamanho; + } + + public void setTamanho(Integer tamanho) { + this.tamanho = tamanho; + } + + public String getSeqName() { + return seqName; + } + + public void setSeqName(String seqName) { + this.seqName = seqName; + } + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DepositoBancario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DepositoBancario.java new file mode 100644 index 000000000..4613f7af0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DepositoBancario.java @@ -0,0 +1,158 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "DEPOSITO_BANCARIO") +@SequenceGenerator(name = "DEPOSITO_BANCARIO_SEQ", sequenceName = "DEPOSITO_BANCARIO_SEQ", allocationSize = 1) +public class DepositoBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DEPOSITO_BANCARIO_SEQ") + @Column(name = "DEPOSITOBANCARIO_ID") + private Long depositobancarioId; + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Column(name = "FORMAPAGO_ID") + private Integer formapagoId; + @Column(name = "BANCO_ID") + private Integer bancoId; + @Column(name = "FECDEPOSITO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecdeposito; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + + public DepositoBancario() { + } + + public DepositoBancario(Long depositobancarioId) { + this.depositobancarioId = depositobancarioId; + } + + public Long getDepositobancarioId() { + return depositobancarioId; + } + + public void setDepositobancarioId(Long depositobancarioId) { + this.depositobancarioId = depositobancarioId; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public Integer getBancoId() { + return bancoId; + } + + public void setBancoId(Integer bancoId) { + this.bancoId = bancoId; + } + + public Date getFecdeposito() { + return fecdeposito; + } + + public void setFecdeposito(Date fecdeposito) { + this.fecdeposito = fecdeposito; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (depositobancarioId != null ? depositobancarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DepositoBancario)) { + return false; + } + DepositoBancario other = (DepositoBancario) object; + if ((this.depositobancarioId == null && other.depositobancarioId != null) || (this.depositobancarioId != null && !this.depositobancarioId.equals(other.depositobancarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.DepositoBancario[depositobancarioId=" + depositobancarioId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DescontoComissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DescontoComissao.java new file mode 100644 index 000000000..099feaff8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DescontoComissao.java @@ -0,0 +1,185 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "DESCONTO_COMISSAO") +@SequenceGenerator(name = "DESCONTO_COMISSAO_SEQ", sequenceName = "DESCONTO_COMISSAO_SEQ", allocationSize = 1) +public class DescontoComissao implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DESCONTO_COMISSAO_SEQ") + @Column(name = "DESCONTOCOMISSAO_ID") + private Long descontocomissaoId; + + @Column(name = "PRECO") + private BigDecimal preco; + + @Column(name = "DATAINICIAL") + @Temporal(TemporalType.DATE) + private Date datainicial; + + @Column(name = "DATAFINAL") + @Temporal(TemporalType.DATE) + private Date datafinal; + + @Column(name = "OBSERVACAO") + private String observacao; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ITEMDESCONTO_ID") + private ItemDesconto itemDesconto; + + public Long getDescontocomissaoId() { + return descontocomissaoId; + } + + public void setDescontocomissaoId(Long descontocomissaoId) { + this.descontocomissaoId = descontocomissaoId; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public Date getDatainicial() { + return datainicial; + } + + public void setDatainicial(Date datainicial) { + this.datainicial = datainicial; + } + + public Date getDatafinal() { + return datafinal; + } + + public void setDatafinal(Date datafinal) { + this.datafinal = datafinal; + } + + public String getObservacao() { + return observacao; + } + + public void setObservacao(String observacao) { + this.observacao = observacao; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public ItemDesconto getItemDesconto() { + return itemDesconto; + } + + public void setItemDesconto(ItemDesconto itemDesconto) { + this.itemDesconto = itemDesconto; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((descontocomissaoId == null) ? 0 : descontocomissaoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + DescontoComissao other = (DescontoComissao) obj; + if (descontocomissaoId == null) { + if (other.descontocomissaoId != null) + return false; + } else if (!descontocomissaoId.equals(other.descontocomissaoId)) + return false; + return true; + } + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DetAbastoBoleto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DetAbastoBoleto.java new file mode 100644 index 000000000..a5aada479 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DetAbastoBoleto.java @@ -0,0 +1,191 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "DET_ABASTO_BOLETO_SEQ", sequenceName = "DET_ABASTO_BOLETO_SEQ", allocationSize = 1) +@Table(name = "DET_ABASTO_BOLETO") +public class DetAbastoBoleto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DET_ABASTO_BOLETO_SEQ") + @Column(name = "DETABASTOBOLETO_ID") + private Integer detabastoboletoId; + @Column(name = "NUMMOVIMIENTO") + private Long nummovimiento; + @Column(name = "NUMSERIEPREIMPRESA") + private String numseriepreimpresa; + @Column(name = "NUMFOLIOINICIAL") + private String numfolioinicial; + @Column(name = "NUMFOLIOFINAL") + private String numfoliofinal; + @Column(name = "STATUSFIRMA") + private Boolean statusfirma; + @Column(name = "STATUSOPERACION") + private Integer statusoperacion; + @Column(name = "STATUSENVIO") + private Boolean statusenvio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDINUTILIZA") + private Boolean indinutiliza; + @JoinColumn(name = "ABASTOBOLETO_ID", referencedColumnName = "ABASTOBOLETO_ID") + @ManyToOne + private AbastoBoleto abastoBoleto; + + public Integer getDetabastoboletoId() { + return detabastoboletoId; + } + + public void setDetabastoboletoId(Integer detabastoboletoId) { + this.detabastoboletoId = detabastoboletoId; + } + + public Long getNummovimiento() { + return nummovimiento; + } + + public void setNummovimiento(Long nummovimiento) { + this.nummovimiento = nummovimiento; + } + + public String getNumseriepreimpresa() { + return numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + public String getNumfolioinicial() { + return numfolioinicial; + } + + public void setNumfolioinicial(String numfolioinicial) { + this.numfolioinicial = numfolioinicial; + } + + public String getNumfoliofinal() { + return numfoliofinal; + } + + public void setNumfoliofinal(String numfoliofinal) { + this.numfoliofinal = numfoliofinal; + } + + public Boolean getStatusfirma() { + return statusfirma; + } + + public void setStatusfirma(Boolean statusfirma) { + this.statusfirma = statusfirma; + } + + public Integer getStatusoperacion() { + return statusoperacion; + } + + public void setStatusoperacion(Integer statusoperacion) { + this.statusoperacion = statusoperacion; + } + + public Boolean getStatusenvio() { + return statusenvio; + } + + public void setStatusenvio(Boolean statusenvio) { + this.statusenvio = statusenvio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndinutiliza() { + return indinutiliza; + } + + public void setIndinutiliza(Boolean indinutiliza) { + this.indinutiliza = indinutiliza; + } + + public AbastoBoleto getAbastoBoleto() { + return abastoBoleto; + } + + public void setAbastoBoleto(AbastoBoleto abastoBoleto) { + this.abastoBoleto = abastoBoleto; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((detabastoboletoId == null) ? 0 : detabastoboletoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + DetAbastoBoleto other = (DetAbastoBoleto) obj; + if (detabastoboletoId == null) { + if (other.detabastoboletoId != null) + return false; + } else if (!detabastoboletoId.equals(other.detabastoboletoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto [detabastoboletoId=" + detabastoboletoId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DetDiagramaAutobus.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DetDiagramaAutobus.java new file mode 100644 index 000000000..6720f88b2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DetDiagramaAutobus.java @@ -0,0 +1,215 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; +import javax.persistence.Transient; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "DET_DIAGRAMA_AUTOBUS_SEQ", sequenceName = "DET_DIAGRAMA_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "DET_DIAGRAMA_AUTOBUS") +public class DetDiagramaAutobus implements Serializable { + + public final static String WC = "WC";//BAÑO + public final static String TV = "TV";//TELEVISION + public final static String PT = "PT";//PORTA TRAJE + public final static String CF = "CF";//CAFE + public final static String ME = "ME";//MESA + public final static String GE = "GE";//GELADEIRA + public final static String ES = "ES";//ESCADA + + public final static String ORIENTACION_W = "W";//OESTTE + public final static String ORIENTACION_S = "S";//SUL + public final static String ORIENTACION_E = "E";//LESTE + public final static String ORIENTACION_N = "S";//NORTE + + + + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DET_DIAGRAMA_AUTOBUS_SEQ") + @Column(name = "DETDIAGRAMAAUTOBUS_ID") + private Short detdiagramaautobusId; + @Column(name = "ASIENTO") + private String asiento; + @Column(name = "NUMECOLUMNA") + private Short numecolumna; + @Column(name = "NUMEFILA") + private Short numefila; + @Column(name = "VENDIBLE") + private Boolean vendible; + @Column(name = "INTERNET") + private Boolean internet; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DIAGRAMAAUTOBUS_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobus; + @Column(name = "ORIENTACION") + private String orientacion; + + public DetDiagramaAutobus() { + } + + public Short getDetdiagramaautobusId() { + return detdiagramaautobusId; + } + + public void setDetdiagramaautobusId(Short detdiagramaautobusId) { + this.detdiagramaautobusId = detdiagramaautobusId; + } + + public String getAsiento() { + return asiento; + } + + public void setAsiento(String asiento) { + this.asiento = asiento; + } + + public Short getNumecolumna() { + return numecolumna; + } + + public void setNumecolumna(Short numecolumna) { + this.numecolumna = numecolumna; + } + + public Short getNumefila() { + return numefila; + } + + public void setNumefila(Short numefila) { + this.numefila = numefila; + } + + public Boolean getVendible() { + return vendible; + } + + public void setVendible(Boolean vendible) { + this.vendible = vendible; + } + + public Boolean getInternet() { + return internet; + } + + public void setInternet(Boolean internet) { + this.internet = internet; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public DiagramaAutobus getDiagramaAutobus() { + return diagramaAutobus; + } + + public void setDiagramaAutobus(DiagramaAutobus diagramaAutobus) { + this.diagramaAutobus = diagramaAutobus; + } + + public String getOrientacion() { + return orientacion; + } + + public void setOrientacion(String orientacion) { + this.orientacion = orientacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (detdiagramaautobusId != null ? detdiagramaautobusId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DetDiagramaAutobus)) { + return false; + } + DetDiagramaAutobus other = (DetDiagramaAutobus) object; + if ((this.detdiagramaautobusId == null && other.detdiagramaautobusId != null) || (this.detdiagramaautobusId != null && !this.detdiagramaautobusId.equals(other.detdiagramaautobusId))) { + return false; + } + return true; + } + + /** + * Indica se el tipo del asiento es vendible + * @param tipoAsiento + * @return + */ + @Transient + public static boolean asientoVendible(String tipoAsiento){ + if (tipoAsiento == null){ + return false; + } + + if (tipoAsiento.equalsIgnoreCase(CF) + || tipoAsiento.equalsIgnoreCase(PT) + || tipoAsiento.equalsIgnoreCase(TV) + || tipoAsiento.equalsIgnoreCase(WC) + || tipoAsiento.equalsIgnoreCase(GE) + || tipoAsiento.equalsIgnoreCase(ES)) { + return false; + } + + return true; + } + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus[detdiagramaautobusId=" + detdiagramaautobusId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DiagramaAutobus.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DiagramaAutobus.java new file mode 100644 index 000000000..591ddba2b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/DiagramaAutobus.java @@ -0,0 +1,174 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "DIAGRAMA_AUTOBUS_SEQ", sequenceName = "DIAGRAMA_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "DIAGRAMA_AUTOBUS") +public class DiagramaAutobus implements Serializable { + + @OneToMany(mappedBy = "diagramaAutobus") + private List autobusList; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DIAGRAMA_AUTOBUS_SEQ") + @Column(name = "DIAGRAMAAUTOBUS_ID") + private Short diagramaautobusId; + @Column(name = "CANTASIENTOS") + private Short cantasientos; + @Column(name = "MARCAAUTOBUS") + private String marcaautobus; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "diagramaAutobus", cascade = CascadeType.ALL,fetch=FetchType.EAGER) + @Fetch(FetchMode.SELECT) + private List detDiagramaAutobusList; + @Column(name = "DESCDIAGRAMA") + private String descDiagrama; + + public DiagramaAutobus() { + } + + public Short getDiagramaautobusId() { + return diagramaautobusId; + } + + public void setDiagramaautobusId(Short diagramaautobusId) { + this.diagramaautobusId = diagramaautobusId; + } + + public Short getCantasientos() { + return cantasientos; + } + + public void setCantasientos(Short cantasientos) { + this.cantasientos = cantasientos; + } + + public String getMarcaautobus() { + return marcaautobus; + } + + public void setMarcaautobus(String marcaautobus) { + this.marcaautobus = marcaautobus; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getDetDiagramaAutobusList() { + List tmp = new ArrayList(); + if (detDiagramaAutobusList != null) { + for (DetDiagramaAutobus ddab : this.detDiagramaAutobusList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.detDiagramaAutobusList = tmp; + + return tmp; + } + + public void setDetDiagramaAutobusList(List detDiagramaAutobusList) { + this.detDiagramaAutobusList = detDiagramaAutobusList; + } + + public String getDescDiagrama() { + return descDiagrama; + } + + public void setDescDiagrama(String descDiagrama) { + this.descDiagrama = descDiagrama; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (diagramaautobusId != null ? diagramaautobusId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DiagramaAutobus)) { + return false; + } + DiagramaAutobus other = (DiagramaAutobus) object; + if ((this.diagramaautobusId == null && other.diagramaautobusId != null) || (this.diagramaautobusId != null && !this.diagramaautobusId.equals(other.diagramaautobusId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescDiagrama(); + } + + public List getAutobusList() { + return autobusList; + } + + public void setAutobusList(List autobusList) { + this.autobusList = autobusList; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Division.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Division.java new file mode 100644 index 000000000..d1a5a558a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Division.java @@ -0,0 +1,130 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "DIVISION_SEQ", sequenceName = "DIVISION_SEQ", allocationSize = 1) +@Table(name = "DIVISION") +public class Division implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DIVISION_SEQ") + @Column(name = "DIVISION_ID") + private Integer divisionId; + @Column(name = "NOMBDIVISION") + private String nombDivion; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Division() { + + } + + public Division(Integer divisionId) { + this.divisionId = divisionId; + } + + public Integer getDivisionId() { + return divisionId; + } + + public void setDivisionId(Integer divisionId) { + this.divisionId = divisionId; + } + + public String getNombDivion() { + return nombDivion; + } + + public void setNombDivion(String nombDivion) { + this.nombDivion = nombDivion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((divisionId == null) ? 0 : divisionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Division other = (Division) obj; + if (divisionId == null) { + if (other.divisionId != null) + return false; + } else if (!divisionId.equals(other.divisionId)) + return false; + return true; + } + + @Override + public String toString() { + return this.getNombDivion(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Empleado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Empleado.java new file mode 100644 index 000000000..08c10b0ca --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Empleado.java @@ -0,0 +1,262 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "EMPLEADO_SEQ", sequenceName = "EMPLEADO_SEQ", allocationSize = 1) +@Table(name = "EMPLEADO") +public class Empleado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPLEADO_SEQ") + @Column(name = "EMPLEADO_ID") + private Integer empleadoId; + @Column(name = "CVEEMPLEADO") + private String cveEmpleado; + @Column(name = "NOMBEMPLEADO") + private String nombEmpleado; + @Column(name = "NOMBPATERNO") + private String nombPaterno; + @Column(name = "NOMBMATERNO") + private String nombMaterno; + @Column(name = "FECNACIMIENTO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecNacimiento; + @Column(name = "FECINGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecIngreso; + @Column(name = "FECBAJA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecBaja; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "DESCCALLE") + private String descCalle; + @Column(name = "NUMEXTINT") + private String numExtInt; + @Column(name = "CODPOSTAL") + private String codPostal; + @Column(name = "DESCCORREO") + private String desccorreo; + + @JoinColumn(name = "TIPOEMPLEADO_ID", referencedColumnName = "TIPOEMPLEADO_ID") + @ManyToOne + private TipoEmpleado tipoEmpleado; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + + public Empleado() { + super(); + } + + public Empleado(Integer empleadoId) { + this(); + this.empleadoId = empleadoId; + } + + public Empleado(Integer empleadoId, String nombEmpleado) { + this(); + this.empleadoId = empleadoId; + this.nombEmpleado = nombEmpleado; + } + + public Empleado(Integer empleadoId, Date fecmodif) { + this(); + this.empleadoId = empleadoId; + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getCveEmpleado() { + return cveEmpleado; + } + + public void setCveEmpleado(String cveEmpleado) { + this.cveEmpleado = cveEmpleado; + } + + public Integer getEmpleadoId() { + return empleadoId; + } + + public void setEmpleadoId(Integer empleadoId) { + this.empleadoId = empleadoId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecBaja() { + return fecBaja; + } + + public void setFecBaja(Date fecBaja) { + this.fecBaja = fecBaja; + } + + public Date getFecIngreso() { + return fecIngreso; + } + + public void setFecIngreso(Date fecIngreso) { + this.fecIngreso = fecIngreso; + } + + public Date getFecNacimiento() { + return fecNacimiento; + } + + public void setFecNacimiento(Date fecNacimiento) { + this.fecNacimiento = fecNacimiento; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public String getNombEmpleado() { + return nombEmpleado; + } + + public void setNombEmpleado(String nombEmpleado) { + this.nombEmpleado = nombEmpleado; + } + + public String getNombMaterno() { + return nombMaterno; + } + + public void setNombMaterno(String nombMaterno) { + this.nombMaterno = nombMaterno; + } + + public String getNombPaterno() { + return nombPaterno; + } + + public void setNombPaterno(String nombPaterno) { + this.nombPaterno = nombPaterno; + } + + public TipoEmpleado getTipoEmpleado() { + return tipoEmpleado; + } + + public void setTipoEmpleado(TipoEmpleado tipoEmpleado) { + this.tipoEmpleado = tipoEmpleado; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getDescCalle() { + return descCalle; + } + + public void setDescCalle(String descCalle) { + this.descCalle = descCalle; + } + + public String getNumExtInt() { + return numExtInt; + } + + public void setNumExtInt(String numExtInt) { + this.numExtInt = numExtInt; + } + + public String getCodPostal() { + return codPostal; + } + + public void setCodPostal(String codPostal) { + this.codPostal = codPostal; + } + + public String getDesccorreo() { + return desccorreo; + } + + public void setDesccorreo(String desccorreo) { + this.desccorreo = desccorreo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empleadoId != null ? empleadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Empleado)) { + return false; + } + Empleado other = (Empleado) object; + if ((this.empleadoId == null && other.empleadoId != null) || (this.empleadoId != null && !this.empleadoId.equals(other.empleadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombEmpleado(); + // return this.getNombPaterno() + getNombMaterno() + getNombEmpleado(); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Empresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Empresa.java new file mode 100644 index 000000000..fb25a83ea --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Empresa.java @@ -0,0 +1,485 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.hibernate.annotations.Where; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "EMPRESA_SEQ", sequenceName = "EMPRESA_SEQ", allocationSize = 1) +@Table(name = "EMPRESA") +public class Empresa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_SEQ") + @Column(name = "EMPRESA_ID") + private Integer empresaId; + @Column(name = "NOMBEMPRESA") + private String nombempresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "empresa") + private List puntoVentaList; + @Column(name = "INDEXTERNA") + private Boolean indExterna; + @Column(name = "INDTIPO") + private Short indTipo; + @Column(name = "INDPAGOCONDUCTOR") + private Boolean pagoConductor; + @OneToMany(mappedBy = "empresa") + private List corridaList; + @OneToMany(mappedBy = "empresa1") + private List corridaList1; + @Column(name = "EQUIVALENCIAELEKTRA_ID") + private String equivalenciaElektraId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "RFC") + private String rfc; + @Column(name = "CNPJ") + private String cnpj; + @Column(name = "LOGRADOURO") + private String logradouro; + @Column(name = "NUMERO") + private String numero; + @Column(name = "COMPLEMENTO") + private String complemento; + @Column(name = "CEP") + private String cep; + @Column(name = "BAIRRO") + private String bairro; + @Column(name = "CODANTT") + private String codantt; + @OneToOne(cascade = CascadeType.MERGE) + @JoinColumn(name = "CIUDAD_ID") + private Ciudad cidade; + @OneToMany(mappedBy = "empresa") + private List empresaImpostoList; + @Column(name = "NUMTELEFONO") + private String numtelefono; + @Column(name = "INDCARBOLETOSDEVOLVIDOSCONF") + private Boolean indcarboletosdevolvidosconf; + + @Column(name = "INDBOLETOAGRUPADO") + private Boolean indBoletoAgrupado; + + @Column(name = "INDVALIDABLOQUEIOECF") + private Boolean indvalidabloqueioecf; + + + @Column(name = "INDFECHATARIFA") + private Boolean indfechatarifa; + + @OneToMany(mappedBy = "empresa") + private List inscricoesEstaduais; + + @OneToMany(mappedBy = "empresa", cascade = CascadeType.ALL) + private List empresaContaBancaria; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpCategorias; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpFormapagos; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpTipoEventoExtras; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpConferencias; + + public Empresa() { + super(); + } + + public Empresa(Integer empresaId) { + this(); + this.empresaId = empresaId; + } + + public Empresa(Integer empresaId, String nombempresa) { + this(); + this.empresaId = empresaId; + this.nombempresa = nombempresa; + } + + public Empresa(Integer empresaId, Date fecmodif) { + this(); + this.empresaId = empresaId; + this.fecmodif = fecmodif; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + public Boolean getIndExterna() { + return indExterna; + } + + public void setIndExterna(Boolean indExterna) { + this.indExterna = indExterna; + } + + public Short getIndTipo() { + return indTipo; + } + + public void setIndTipo(Short indTipo) { + this.indTipo = indTipo; + } + + public Boolean getPagoConductor() { + return pagoConductor; + } + + public void setPagoConductor(Boolean pagoConductor) { + this.pagoConductor = pagoConductor; + } + + public String getEquivalenciaElektraId() { + return equivalenciaElektraId; + } + + public void setEquivalenciaElektraId(String equivalenciaElektraId) { + this.equivalenciaElektraId = equivalenciaElektraId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public String getRfc() { + return rfc; + } + + public void setRfc(String rfc) { + this.rfc = rfc; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public String getLogradouro() { + return logradouro; + } + + public void setLogradouro(String logradouro) { + this.logradouro = logradouro; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public Ciudad getCidade() { + return cidade; + } + + public void setCidade(Ciudad cidade) { + this.cidade = cidade; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getCorridaList1() { + return corridaList1; + } + + public void setCorridaList1(List corridaList1) { + this.corridaList1 = corridaList1; + } + + public List getEmpresaImpostoList() { + + return this.empresaImpostoList; + } + + public void setEmpresaImpostoList(List empresaImpostoList) { + this.empresaImpostoList = empresaImpostoList; + } + + public String getCodantt() { + return codantt; + } + + public void setCodantt(String codantt) { + this.codantt = codantt; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getEmpresaId() != null ? getEmpresaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Empresa)) { + return false; + } + Empresa other = (Empresa) object; + if ((this.getEmpresaId() == null && other.getEmpresaId() != null) || (this.getEmpresaId() != null && !this.getEmpresaId().equals(other.getEmpresaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombempresa(); + } + + + public List getInscricoesEstaduais() { + return inscricoesEstaduais; + } + + public List getInscricoesEstaduaisActivas() { + + List inscEstaduais = new ArrayList(); + inscEstaduais.addAll(getInscricoesEstaduais()); + + CollectionUtils.filter(inscEstaduais, new Predicate() { + + @Override + public boolean evaluate(Object arg0) { + return ((InscricaoEstadual)arg0).getActivo(); + } + }); + + return inscEstaduais; + } + + public void setInscricoesEstaduais(List inscricoesEstaduais) { + this.inscricoesEstaduais = inscricoesEstaduais; + } + + public String getNumtelefono() { + return numtelefono; + } + + public void setNumtelefono(String numtelefono) { + this.numtelefono = numtelefono; + } + + + /** + * @return the indfechatarifa + */ + public Boolean getIndfechatarifa() { + return indfechatarifa; + } + + /** + * @param indfechatarifa the indfechatarifa to set + */ + public void setIndfechatarifa(Boolean indfechatarifa) { + this.indfechatarifa = indfechatarifa; + } + + + + public List getEmpresaContaBancaria() { + + List tempList = new ArrayList(); + + if (empresaContaBancaria != null) { + for (EmpresaContaBancaria empContaBancaria : this.empresaContaBancaria) { + if (empContaBancaria.getActivo()) { + tempList.add(empContaBancaria); + } + } + } + return tempList; + } + + public void setEmpresaContaBancaria(List empresaContaBancaria) { + this.empresaContaBancaria = empresaContaBancaria; + } + + public Boolean getIndcarboletosdevolvidosconf() { + return indcarboletosdevolvidosconf; + } + + public void setIndcarboletosdevolvidosconf(Boolean indcarboletosdevolvidosconf) { + this.indcarboletosdevolvidosconf = indcarboletosdevolvidosconf; + } + + public List getComEmpCategorias() { + return comEmpCategorias; + } + + public void setComEmpCategorias(List comEmpCategorias) { + this.comEmpCategorias = comEmpCategorias; + } + + public List getComEmpFormapagos() { + return comEmpFormapagos; + } + + public void setComEmpFormapagos(List comEmpFormapagos) { + this.comEmpFormapagos = comEmpFormapagos; + } + + public List getComEmpTipoEventoExtras() { + return comEmpTipoEventoExtras; + } + + public void setComEmpTipoEventoExtras(List comEmpTipoEventoExtras) { + this.comEmpTipoEventoExtras = comEmpTipoEventoExtras; + } + + public List getComEmpConferencias() { + return comEmpConferencias; + } + + public void setComEmpConferencias(List comEmpConferencias) { + this.comEmpConferencias = comEmpConferencias; + } + + public Boolean getIndBoletoAgrupado() { + return indBoletoAgrupado; + } + + public void setIndBoletoAgrupado(Boolean indBoletoAgrupado) { + this.indBoletoAgrupado = indBoletoAgrupado; + } + + public Boolean getIndvalidabloqueioecf() { + return indvalidabloqueioecf; + } + + public void setIndvalidabloqueioecf(Boolean indvalidabloqueioecf) { + this.indvalidabloqueioecf = indvalidabloqueioecf; + } + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaContaBancaria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaContaBancaria.java new file mode 100644 index 000000000..52834ebae --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaContaBancaria.java @@ -0,0 +1,161 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="EMPRESA_CONTABANCARIA_SEQ", sequenceName="EMPRESA_CONTABANCARIA_SEQ", allocationSize=1) +@Table(name="EMPRESA_CONTABANCARIA") +public class EmpresaContaBancaria implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer empresaContaBancariaId; + private Empresa empresa; + private InstiFinanceira instituicaoFinandeira; + private String numConta; + private String numAgencia; + private String numIntegracion; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_CONTABANCARIA_SEQ") + @Column(name = "EMPRESACONTABANCARIA_ID") + public Integer getEmpresaContaBancariaId() { + return empresaContaBancariaId; + } + + public void setEmpresaContaBancariaId(Integer empresaContaBancariaId) { + this.empresaContaBancariaId = empresaContaBancariaId; + } + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @JoinColumn(name = "INSTIFINANCEIRA_ID", referencedColumnName = "INSTIFINANCEIRA_ID") + @ManyToOne + public InstiFinanceira getInstituicaoFinandeira() { + return instituicaoFinandeira; + } + + public void setInstituicaoFinandeira(InstiFinanceira instituicaoFinandeira) { + this.instituicaoFinandeira = instituicaoFinandeira; + } + + @Column(name = "NUMCONTA") + public String getNumConta() { + return numConta; + } + + public void setNumConta(String numConta) { + this.numConta = numConta; + } + + @Column(name = "NUMAGENCIA") + public String getNumAgencia() { + return numAgencia; + } + + public void setNumAgencia(String numAgencia) { + this.numAgencia = numAgencia; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "NUMINTEGRACION") + public String getNumIntegracion() { + return numIntegracion; + } + + public void setNumIntegracion(String numIntegracion) { + this.numIntegracion = numIntegracion; + } + + @Override + public boolean equals(Object old) { + + if (!(old instanceof EmpresaContaBancaria)) { + return false; + } + + EmpresaContaBancaria oldObject = (EmpresaContaBancaria) old; + + if(this.getInstituicaoFinandeira().equals(oldObject.getInstituicaoFinandeira()) && + this.getNumAgencia().equals(oldObject.getNumAgencia()) && this.getNumConta().equals(oldObject.getNumConta()) && + this.getNumIntegracion().equals(oldObject.getNumIntegracion()) && + this.getActivo().equals(oldObject.getActivo())) { + return true; + } + + if(this.empresaContaBancariaId == null && oldObject.empresaContaBancariaId == null) { + return false; + } + + if ((this.empresaContaBancariaId == null && oldObject.empresaContaBancariaId != null) || (this.empresaContaBancariaId != null && !this.empresaContaBancariaId.equals(oldObject.empresaContaBancariaId))) { + return false; + } + + return Boolean.TRUE; + } + + @Override + public String toString() { + return getNumConta() + " - " + getNumAgencia() + " - " + getNumIntegracion() + " - " + getInstituicaoFinandeira().getNome(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empresaContaBancariaId != null ? empresaContaBancariaId.hashCode() : 0); + return hash; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaEquivalencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaEquivalencia.java new file mode 100644 index 000000000..21421e25b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "EMPRESA_EQUIVALENCIA_SEQ", sequenceName = "EMPRESA_EQUIVALENCIA_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_EQUIVALENCIA") +public class EmpresaEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "EMPRESAEQUIVALENCIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_EQUIVALENCIA_SEQ") + private Integer empresaequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public EmpresaEquivalencia() { + } + + public EmpresaEquivalencia(Integer empresaequivalenciaId) { + this.empresaequivalenciaId = empresaequivalenciaId; + } + + public Integer getEmpresaequivalenciaId() { + return empresaequivalenciaId; + } + + public void setEmpresaequivalenciaId(Integer empresaequivalenciaId) { + this.empresaequivalenciaId = empresaequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empresaequivalenciaId != null ? empresaequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EmpresaEquivalencia)) { + return false; + } + EmpresaEquivalencia other = (EmpresaEquivalencia) object; + if ((this.empresaequivalenciaId == null && other.empresaequivalenciaId != null) || (this.empresaequivalenciaId != null && !this.empresaequivalenciaId.equals(other.empresaequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia[ empresaequivalenciaId=" + empresaequivalenciaId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java new file mode 100644 index 000000000..2465a321f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java @@ -0,0 +1,667 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EMPRESA_IMPOSTO_SEQ", sequenceName = "EMPRESA_IMPOSTO_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_IMPOSTO") +public class EmpresaImposto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_IMPOSTO_SEQ") + @Column(name = "EMPRESAIMPOSTO_ID") + private Integer empresaImpostoId; + + @Column(name = "ICMS") + private BigDecimal icms; + + @Column(name = "INDTARIFAMUNICIPAL") + private Boolean indTarifaMunicipal; + @Column(name = "INDSEGUROMUNICIPAL") + private Boolean indSeguroMunicipal; + @Column(name = "INDTXEMBARQUEMUNICIPAL") + private Boolean indTxEmbarqueMunicipal; + @Column(name = "INDPEDAGIOMUNICIPAL") + private Boolean indPedagioMunicipal; + @Column(name = "INDTARIFAESTADUAL") + private Boolean indTarifaEstadual; + @Column(name = "INDSEGUROESTADUAL") + private Boolean indSeguroEstadual; + @Column(name = "INDTXEMBARQUEESTADUAL") + private Boolean indTxEmbarqueEstadual; + @Column(name = "INDPEDAGIOESTDUAL") + private Boolean indPedadioEstdual; + + @Column(name = "PORCREDMUNICIPAL") + private BigDecimal porCredMunicipal; + @Column(name = "PORCREDESTADUAL") + private BigDecimal porCredEstadual; + @Column(name = "PORCREDBASEICMS") + private BigDecimal porCredBaseIcms; + + @Column(name = "INDJANEIRO") + private Boolean indJaneiro; + @Column(name = "INDFEVEREIRO") + private Boolean indFevereiro; + @Column(name = "INDMARCO") + private Boolean indMarco; + @Column(name = "INDABRIL") + private Boolean indAbril; + @Column(name = "INDMAIO") + private Boolean indMaio; + @Column(name = "INDJUNHO") + private Boolean indJunho; + @Column(name = "INDJULHO") + private Boolean indJulho; + @Column(name = "INDAGOSTO") + private Boolean indAgosto; + @Column(name = "INDSETEMBRO") + private Boolean indSetembro; + @Column(name = "INDOUTUBRO") + private Boolean indOutubro; + @Column(name = "INDNOVEMBRO") + private Boolean indNovembro; + @Column(name = "INDDEZEMBRO") + private Boolean indDezembro; + + @Column(name = "INDOUTROSISENTO") + private Boolean indOutrosIsento; + + @Column(name = "INDOUTRASUFBLOQUEADAS") + private Boolean indOutrasUFBloqueadas; + + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estado; + + @Column(name = "INDICEICMSECF") + private Integer indiceICMSecf; + + @Column(name = "PORCTRIBUTO") + private BigDecimal porctributo; + + @Column(name = "ICMSIM") + private BigDecimal icmsIntermunicipal; + @Column(name = "INDICEICMSIMECF") + private BigDecimal indiceICMSIntermunicipal; + + @Column(name="INDVALIDAECF") + private Boolean indValidaECF; + + public EmpresaImposto() { + } + + /** + * @return the empresaImpostoId + */ + public Integer getEmpresaImpostoId() { + return empresaImpostoId; + } + + /** + * @param empresaImpostoId + * the empresaImpostoId to set + */ + public void setEmpresaImpostoId(Integer empresaImpostoId) { + this.empresaImpostoId = empresaImpostoId; + } + + /** + * @return the icms + */ + public BigDecimal getIcms() { + return icms; + } + + /** + * @param icms + * the icms to set + */ + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + /** + * @return the indTarifaMunicipal + */ + public Boolean getIndTarifaMunicipal() { + return indTarifaMunicipal; + } + + /** + * @param indTarifaMunicipal + * the indTarifaMunicipal to set + */ + public void setIndTarifaMunicipal(Boolean indTarifaMunicipal) { + this.indTarifaMunicipal = indTarifaMunicipal; + } + + /** + * @return the indSeguroMunicipal + */ + public Boolean getIndSeguroMunicipal() { + return indSeguroMunicipal; + } + + /** + * @param indSeguroMunicipal + * the indSeguroMunicipal to set + */ + public void setIndSeguroMunicipal(Boolean indSeguroMunicipal) { + this.indSeguroMunicipal = indSeguroMunicipal; + } + + /** + * @return the indTxEmbarqueMunicipal + */ + public Boolean getIndTxEmbarqueMunicipal() { + return indTxEmbarqueMunicipal; + } + + /** + * @param indTxEmbarqueMunicipal + * the indTxEmbarqueMunicipal to set + */ + public void setIndTxEmbarqueMunicipal(Boolean indTxEmbarqueMunicipal) { + this.indTxEmbarqueMunicipal = indTxEmbarqueMunicipal; + } + + /** + * @return the indPedagioMunicipal + */ + public Boolean getIndPedagioMunicipal() { + return indPedagioMunicipal; + } + + /** + * @param indPedagioMunicipal + * the indPedagioMunicipal to set + */ + public void setIndPedagioMunicipal(Boolean indPedagioMunicipal) { + this.indPedagioMunicipal = indPedagioMunicipal; + } + + /** + * @return the indTarifaEstadual + */ + public Boolean getIndTarifaEstadual() { + return indTarifaEstadual; + } + + /** + * @param indTarifaEstadual + * the indTarifaEstadual to set + */ + public void setIndTarifaEstadual(Boolean indTarifaEstadual) { + this.indTarifaEstadual = indTarifaEstadual; + } + + /** + * @return the indSeguroEstadual + */ + public Boolean getIndSeguroEstadual() { + return indSeguroEstadual; + } + + /** + * @param indSeguroEstadual + * the indSeguroEstadual to set + */ + public void setIndSeguroEstadual(Boolean indSeguroEstadual) { + this.indSeguroEstadual = indSeguroEstadual; + } + + /** + * @return the indTxEmbarqueEstadual + */ + public Boolean getIndTxEmbarqueEstadual() { + return indTxEmbarqueEstadual; + } + + /** + * @param indTxEmbarqueEstadual + * the indTxEmbarqueEstadual to set + */ + public void setIndTxEmbarqueEstadual(Boolean indTxEmbarqueEstadual) { + this.indTxEmbarqueEstadual = indTxEmbarqueEstadual; + } + + /** + * @return the indPedadioEstdual + */ + public Boolean getIndPedadioEstdual() { + return indPedadioEstdual; + } + + /** + * @param indPedadioEstdual + * the indPedadioEstdual to set + */ + public void setIndPedadioEstdual(Boolean indPedadioEstdual) { + this.indPedadioEstdual = indPedadioEstdual; + } + + /** + * @return the porCredMunicipal + */ + public BigDecimal getPorCredMunicipal() { + return porCredMunicipal; + } + + /** + * @param porCredMunicipal + * the porCredMunicipal to set + */ + public void setPorCredMunicipal(BigDecimal porCredMunicipal) { + this.porCredMunicipal = porCredMunicipal; + } + + /** + * @return the porCredEstadual + */ + public BigDecimal getPorCredEstadual() { + return porCredEstadual; + } + + /** + * @param porCredEstadual + * the porCredEstadual to set + */ + public void setPorCredEstadual(BigDecimal porCredEstadual) { + this.porCredEstadual = porCredEstadual; + } + + /** + * @return the porCredBaseIcms + */ + public BigDecimal getPorCredBaseIcms() { + return porCredBaseIcms; + } + + /** + * @param porCredBaseIcms + * the porCredBaseIcms to set + */ + public void setPorCredBaseIcms(BigDecimal porCredBaseIcms) { + this.porCredBaseIcms = porCredBaseIcms; + } + + /** + * @return the indJaneiro + */ + public Boolean getIndJaneiro() { + return indJaneiro; + } + + /** + * @param indJaneiro + * the indJaneiro to set + */ + public void setIndJaneiro(Boolean indJaneiro) { + this.indJaneiro = indJaneiro; + } + + /** + * @return the indFevereiro + */ + public Boolean getIndFevereiro() { + return indFevereiro; + } + + /** + * @param indFevereiro + * the indFevereiro to set + */ + public void setIndFevereiro(Boolean indFevereiro) { + this.indFevereiro = indFevereiro; + } + + /** + * @return the indMarco + */ + public Boolean getIndMarco() { + return indMarco; + } + + /** + * @param indMarco + * the indMarco to set + */ + public void setIndMarco(Boolean indMarco) { + this.indMarco = indMarco; + } + + /** + * @return the indAbril + */ + public Boolean getIndAbril() { + return indAbril; + } + + /** + * @param indAbril + * the indAbril to set + */ + public void setIndAbril(Boolean indAbril) { + this.indAbril = indAbril; + } + + /** + * @return the indMaio + */ + public Boolean getIndMaio() { + return indMaio; + } + + /** + * @param indMaio + * the indMaio to set + */ + public void setIndMaio(Boolean indMaio) { + this.indMaio = indMaio; + } + + /** + * @return the indJunho + */ + public Boolean getIndJunho() { + return indJunho; + } + + /** + * @param indJunho + * the indJunho to set + */ + public void setIndJunho(Boolean indJunho) { + this.indJunho = indJunho; + } + + /** + * @return the indJulho + */ + public Boolean getIndJulho() { + return indJulho; + } + + /** + * @param indJulho + * the indJulho to set + */ + public void setIndJulho(Boolean indJulho) { + this.indJulho = indJulho; + } + + /** + * @return the indAgosto + */ + public Boolean getIndAgosto() { + return indAgosto; + } + + /** + * @param indAgosto + * the indAgosto to set + */ + public void setIndAgosto(Boolean indAgosto) { + this.indAgosto = indAgosto; + } + + /** + * @return the indSetembro + */ + public Boolean getIndSetembro() { + return indSetembro; + } + + /** + * @param indSetembro + * the indSetembro to set + */ + public void setIndSetembro(Boolean indSetembro) { + this.indSetembro = indSetembro; + } + + /** + * @return the indOutubro + */ + public Boolean getIndOutubro() { + return indOutubro; + } + + /** + * @param indOutubro + * the indOutubro to set + */ + public void setIndOutubro(Boolean indOutubro) { + this.indOutubro = indOutubro; + } + + /** + * @return the indNovembro + */ + public Boolean getIndNovembro() { + return indNovembro; + } + + /** + * @param indNovembro + * the indNovembro to set + */ + public void setIndNovembro(Boolean indNovembro) { + this.indNovembro = indNovembro; + } + + /** + * @return the indDezembro + */ + public Boolean getIndDezembro() { + return indDezembro; + } + + /** + * @param indDezembro + * the indDezembro to set + */ + public void setIndDezembro(Boolean indDezembro) { + this.indDezembro = indDezembro; + } + + /** + * @return the indOutrosIsento + */ + public Boolean getIndOutrosIsento() { + return indOutrosIsento; + } + + /** + * @param indOutrosIsento + * the indOutrosIsento to set + */ + public void setIndOutrosIsento(Boolean indOutrosIsento) { + this.indOutrosIsento = indOutrosIsento; + } + + /** + * @return the activo + */ + public Boolean getActivo() { + return activo; + } + + /** + * @param activo + * the activo to set + */ + public void setActivo(Boolean activo) { + this.activo = activo; + } + + /** + * @return the fecmodif + */ + public Date getFecmodif() { + return fecmodif; + } + + /** + * @param fecmodif + * the fecmodif to set + */ + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + /** + * @return the usuarioId + */ + public Integer getUsuarioId() { + return usuarioId; + } + + /** + * @param usuarioId + * the usuarioId to set + */ + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + /** + * @return the empresa + */ + public Empresa getEmpresa() { + return empresa; + } + + /** + * @param empresa + * the empresa to set + */ + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + + public Estado getEstado() { + return estado; + } + + + public void setEstado(Estado estado) { + this.estado = estado; + } + + + + public Integer getIndiceICMSecf() { + return indiceICMSecf; + } + + public void setIndiceICMSecf(Integer indiceICMSecf) { + this.indiceICMSecf = indiceICMSecf; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empresaImpostoId != null ? empresaImpostoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EmpresaImposto)) { + return false; + } + EmpresaImposto other = (EmpresaImposto) object; + if ((this.empresaImpostoId == null && other.empresaImpostoId != null) || (this.empresaImpostoId != null && !this.empresaImpostoId.equals(other.empresaImpostoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EmpresaImposto[empresaImpostoId=" + empresaImpostoId + "]"; + } + + public BigDecimal getPorctributo() { + return porctributo; + } + + public void setPorctributo(BigDecimal porctributo) { + this.porctributo = porctributo; + } + + /** + * @return the indOutrasUFBloqueadas + */ + public Boolean getIndOutrasUFBloqueadas() { + return indOutrasUFBloqueadas; + } + + /** + * @param indOutrasUFBloqueadas the indOutrasUFBloqueadas to set + */ + public void setIndOutrasUFBloqueadas(Boolean indOutrasUFBloqueadas) { + this.indOutrasUFBloqueadas = indOutrasUFBloqueadas; + } + + public BigDecimal getIcmsIntermunicipal() { + return icmsIntermunicipal; + } + + public void setIcmsIntermunicipal(BigDecimal icmsIntermunicipal) { + this.icmsIntermunicipal = icmsIntermunicipal; + } + + public BigDecimal getIndiceICMSIntermunicipal() { + return indiceICMSIntermunicipal; + } + + public void setIndiceICMSIntermunicipal(BigDecimal indiceICMSIntermunicipal) { + this.indiceICMSIntermunicipal = indiceICMSIntermunicipal; + } + + public Boolean getIndValidaECF() { + return indValidaECF; + } + + public void setIndValidaECF(Boolean indValidaECF) { + this.indValidaECF = indValidaECF; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EnderecoApanhe.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EnderecoApanhe.java new file mode 100644 index 000000000..20730a7ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EnderecoApanhe.java @@ -0,0 +1,221 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.LocalEnderecoApanhe; + +@Entity +@Table(name = "ENDERECO_APANHE") +@SequenceGenerator(name = "ENDERECO_APANHE_SEQ", sequenceName = "ENDERECO_APANHE_SEQ", allocationSize = 1) +public class EnderecoApanhe implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ENDERECO_APANHE_SEQ") + @Column(name = "ENDERECOAPANHE_ID") + private Long enderecoapanheId; + + @Enumerated(EnumType.ORDINAL) + @Column(name = "LOCAL") + private LocalEnderecoApanhe localEnderecoApanhe; + + @Column(name = "CEP") + private String cep; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "CIDADE") + private String cidade; + + @Column(name = "NUMERO") + private String numero; + + @Column(name = "BAIRRO") + private String bairro; + + @Column(name = "COMPLEMENTO") + private String complemento; + + @Column(name = "REFERENCIA") + private String referencia; + + @Column(name = "DESCHOTEL") + private String deschotel; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "VENDAPACOTE_ID") + private VendaPacote vendaPacote; + + public Long getEnderecoapanheId() { + return enderecoapanheId; + } + + public void setEnderecoapanheId(Long enderecoapanheId) { + this.enderecoapanheId = enderecoapanheId; + } + + public LocalEnderecoApanhe getLocalEnderecoApanhe() { + return localEnderecoApanhe; + } + + public void setLocalEnderecoApanhe(LocalEnderecoApanhe localEnderecoApanhe) { + this.localEnderecoApanhe = localEnderecoApanhe; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getReferencia() { + return referencia; + } + + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + public String getDeschotel() { + return deschotel; + } + + public void setDeschotel(String deschotel) { + this.deschotel = deschotel; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((enderecoapanheId == null) ? 0 : enderecoapanheId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EnderecoApanhe other = (EnderecoApanhe) obj; + if (enderecoapanheId == null) { + if (other.enderecoapanheId != null) + return false; + } else if (!enderecoapanheId.equals(other.enderecoapanheId)) + return false; + return true; + } + + public VendaPacote getVendaPacote() { + return vendaPacote; + } + + public void setVendaPacote(VendaPacote vendaPacote) { + this.vendaPacote = vendaPacote; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Escola.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Escola.java new file mode 100644 index 000000000..013f59db7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Escola.java @@ -0,0 +1,96 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ESCOLA_SEQ", sequenceName = "ESCOLA_SEQ", allocationSize = 1) +@Table(name = "ESCOLA") +public class Escola implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESCOLA_SEQ") + @Basic(optional = false) + @Column(name = "ESCOLA_ID") + private Integer escolaId; + @Column(name = "NOMESCOLA") + private String nombescola; + @JoinColumn(name = "CIUDAD_ID", referencedColumnName = "CIUDAD_ID") + @ManyToOne + private Ciudad ciudad; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getEscolaId() { + return escolaId; + } + + public void setEscolaId(Integer escolaId) { + this.escolaId = escolaId; + } + + public String getNombescola() { + return nombescola; + } + + public void setNombescola(String nombescola) { + this.nombescola = nombescola; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return this.nombescola; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaAgrupacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaAgrupacion.java new file mode 100644 index 000000000..bae27a7b9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaAgrupacion.java @@ -0,0 +1,148 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ESQUEMA_AGRUPACION_SEQ", sequenceName = "ESQUEMA_AGRUPACION_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_AGRUPACION") +public class EsquemaAgrupacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_AGRUPACION_SEQ") + @Column(name = "ESQUEMAAGRUPACION_ID") + private Integer esquemaagrupacionId; + @Column(name = "DESCAGRUPACION ") + private String descagrupacion; + @Column(name = "NUMAGRUPACION") + private Integer numagrupacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ESQUEMAAGRUPACION_ID", referencedColumnName = "ESQUEMAAGRUPACION_ID") + @OneToMany + private List esquemaCorridaList; + + public EsquemaAgrupacion() { + } + + public EsquemaAgrupacion(Integer esquemaagrupacionId) { + this.esquemaagrupacionId = esquemaagrupacionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getEsquemaagrupacionId() { + return esquemaagrupacionId; + } + + public void setEsquemaagrupacionId(Integer esquemaagrupacionId) { + this.esquemaagrupacionId = esquemaagrupacionId; + } + + public String getDescagrupacion() { + return descagrupacion; + } + + public void setDescagrupacion(String descagrupacion) { + this.descagrupacion = descagrupacion; + } + + public Integer getNumagrupacion() { + return numagrupacion; + } + + public void setNumagrupacion(Integer numagrupacion) { + this.numagrupacion = numagrupacion; + } + + public List getEsquemaCorridaList() { + + if (this.esquemaCorridaList != null) { + List esquemaList = new ArrayList(); + + for (EsquemaCorrida ec : this.esquemaCorridaList) { + if (ec.getActivo()) { + esquemaList.add(ec); + } + } + return esquemaList; + } + return null; + } + + public void setEsquemaCorridaList(List esquemaCorrida) { + this.esquemaCorridaList = esquemaCorrida; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (esquemaagrupacionId != null ? esquemaagrupacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EsquemaAgrupacion)) { + return false; + } + EsquemaAgrupacion other = (EsquemaAgrupacion) object; + if ((this.esquemaagrupacionId == null && other.esquemaagrupacionId != null) || (this.esquemaagrupacionId != null && !this.esquemaagrupacionId.equals(other.esquemaagrupacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.EsquemaAgrupacion[esquemaagrupacionId=" + esquemaagrupacionId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java new file mode 100644 index 000000000..8d36bfee7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java @@ -0,0 +1,182 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_ASIENTO_SEQ", sequenceName = "ESQUEMA_ASIENTO_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_ASIENTO") +public class EsquemaAsiento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMAASIENTO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_ASIENTO_SEQ") + private Integer esquemaasientoId; + @Column(name = "NUMASIENTO") + private String numasiento; + @Column(name = "INDVENDIBLE") + private Boolean indvendible; + @Column(name = "TIEMPOLIBERACION") + private Integer tiempoLiberacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @ManyToOne + private EsquemaCorrida esquemaCorrida; + @Column(name = "MOTIVOBLOQUEO") + private String motivobloqueo; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + + public EsquemaAsiento() { + } + + public EsquemaAsiento(Integer esquemaasientoId) { + this.esquemaasientoId = esquemaasientoId; + } + + public Integer getEsquemaasientoId() { + return esquemaasientoId; + } + + public void setEsquemaasientoId(Integer esquemaasientoId) { + this.esquemaasientoId = esquemaasientoId; + } + + public String getNumasiento() { + return numasiento; + } + + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } + + public Boolean getIndvendible() { + return indvendible; + } + + public void setIndvendible(Boolean indvendible) { + this.indvendible = indvendible; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public EsquemaCorrida getEsquemaCorrida() { + return esquemaCorrida; + } + + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destinoId) { + this.destino = destinoId; + } + + public String getMotivobloqueo() { + return motivobloqueo; + } + + public void setMotivobloqueo(String motivobloqueo) { + this.motivobloqueo = motivobloqueo; + } + + public Integer getTiempoLiberacion() { + return tiempoLiberacion; + } + + public void setTiempoLiberacion(Integer tiempoLiberacion) { + this.tiempoLiberacion = tiempoLiberacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (esquemaasientoId != null ? esquemaasientoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EsquemaAsiento)) { + return false; + } + EsquemaAsiento other = (EsquemaAsiento) object; + if ((this.esquemaasientoId == null && other.esquemaasientoId != null) || (this.esquemaasientoId != null && !this.esquemaasientoId.equals(other.esquemaasientoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaAsiento[esquemaasientoId=" + esquemaasientoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java new file mode 100644 index 000000000..8f12c316d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java @@ -0,0 +1,585 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_CORRIDA_SEQ", sequenceName = "ESQUEMA_CORRIDA_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_CORRIDA") +public class EsquemaCorrida implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMACORRIDA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_CORRIDA_SEQ") + private Integer esquemacorridaId; + @Column(name = "HORASALIDA") + @Temporal(TemporalType.TIME) + private Date horasalida; + @Column(name = "INDPISOEXTRA") + private Boolean pisoExtra; + @Column(name = "INDLUNES") + private Boolean indlunes; + @Column(name = "INDMARTES") + private Boolean indmartes; + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + @Column(name = "INDJUEVES") + private Boolean indjueves; + @Column(name = "INDVIERNES") + private Boolean indviernes; + @Column(name = "INDSABADO") + private Boolean indsabado; + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + @Column(name = "CANTPARADOS") + private Integer cantparados; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "DIAGRAMAAUTOBUS_ID") + private Integer diagramaAutobusId; + @Column(name = "STATUSCORRIDA") + private String statusCorrida; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "ROLOPERATIVO_ID", referencedColumnName = "ROLOPERATIVO_ID") + @ManyToOne(cascade = CascadeType.ALL) + private RolOperativo rolOperativo; + @JoinColumn(name = "ROLOPERATIVO2_ID", referencedColumnName = "ROLOPERATIVO_ID") + @ManyToOne(cascade = CascadeType.ALL) + private RolOperativo rolOperativo2; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "ESQUEMAOPERACIONAL_ID", referencedColumnName = "ESQUEMAOPERACIONAL_ID") + @ManyToOne(cascade = CascadeType.ALL) + private EsquemaOperacional esquemaOperacional; + @JoinColumn(name = "EMPRESACORRIDA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "EMPRESAINGRESO_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa1; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CLASESERVICIO2_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio2; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + private List esquemaTramoList; + @OneToMany + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + private List esquemaAsientoList; + @Column(name = "tipocorrida") + private String tipocorrida; + @JoinColumn(name = "ESQUEMAREBOTE_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @ManyToOne + private EsquemaCorrida esquemaCorridaRebote; + @JoinColumn(name = "DIVISION_ID", referencedColumnName = "DIVISION_ID") + @ManyToOne + private Division division; + @Column(name = "NUMCORRIDA") + private Integer numCorrida; + @Column(name = "NUMCORRIDAPISOEXTRA") + private Integer numCorridaPisoExtra; + @Column(name = "INDGENERAFERIADO") + private String indGeneraFeriado; + @Column(name = "CANTDIASGENERACION") + private Integer cantDiasGeneracion; + @Column(name = "ESQUEMAAGRUPACION_ID") + private Integer esquemaAgrupacionId; + @Column(name = "INFOCORRIDA") + private String infoCorrida; + @Column(name = "INDCORRIDAEXTRA") + private Boolean indCorridaExtra; + @Column(name = "INDDIASIMDIANAO") + private Boolean indDiaSimDiaNao; + public enum GerarFeriado { + // Declaração dos enum + GERARSEMPRE("GERAR SEMPRE", "S"), + + GERARQUANDOFERIADO("GERAR SÓ QUANDO FOR FERIADO", "F"), + + GERARQUANDONAOFERIADO("GERAR QUANDO NÃO FOR FERIADO", "N"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private GerarFeriado(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + } + + public String getTipocorrida() { + return tipocorrida; + } + + public void setTipocorrida(String tipocorrida) { + this.tipocorrida = tipocorrida; + } + + public EsquemaCorrida() { + } + + public EsquemaCorrida(Integer esquemacorridaId) { + this.esquemacorridaId = esquemacorridaId; + } + + public Integer getEsquemacorridaId() { + return esquemacorridaId; + } + + public void setEsquemacorridaId(Integer esquemacorridaId) { + this.esquemacorridaId = esquemacorridaId; + } + + public Date getHorasalida() { + return horasalida; + } + + public void setHorasalida(Date horasalida) { + this.horasalida = horasalida; + } + + public Integer getCantparados() { + return cantparados; + } + + public void setCantparados(Integer cantparados) { + this.cantparados = cantparados; + } + + public Boolean getInddomingo() { + return inddomingo; + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + public Boolean getIndjueves() { + return indjueves; + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndlunes() { + return indlunes; + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return indmartes; + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return indmiercoles; + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndsabado() { + return indsabado; + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getIndviernes() { + return indviernes; + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Date getFecmodif() { + return fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public RolOperativo getRolOperativo() { + return rolOperativo; + } + + public void setRolOperativo(RolOperativo rolOperativo) { + this.rolOperativo = rolOperativo; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public EsquemaOperacional getEsquemaOperacional() { + return esquemaOperacional; + } + + public void setEsquemaOperacional(EsquemaOperacional esquemaOperacional) { + this.esquemaOperacional = esquemaOperacional; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Empresa getEmpresa1() { + return empresa1; + } + + public void setEmpresa1(Empresa empresa1) { + this.empresa1 = empresa1; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public String getStatusCorrida() { + return statusCorrida; + } + + public void setStatusCorrida(String statusCorrida) { + this.statusCorrida = statusCorrida; + } + + public Integer getDiagramaAutobusId() { + return diagramaAutobusId; + } + + public void setDiagramaAutobusId(Integer diagramaAutobusId) { + this.diagramaAutobusId = diagramaAutobusId; + } + + public Division getDivision() { + return division; + } + + public void setDivision(Division division) { + this.division = division; + } + + public Boolean getPisoExtra() { + return pisoExtra; + } + + public void setPisoExtra(Boolean pisoExtra) { + this.pisoExtra = pisoExtra; + } + + public List getEsquemaTramoList() { + if (this.esquemaTramoList != null) { + List esquemaList = new ArrayList(); + + for (EsquemaTramo ec : this.esquemaTramoList) { + if (ec.getActivo()) { + esquemaList.add(ec); + } + } + return esquemaList; + } + return null; + + } + + public void setEsquemaTramoList(List esquemaTramoList) { + this.esquemaTramoList = esquemaTramoList; + } + + public List getEsquemaAsientoList() { + List esquemaList = new ArrayList(); + for (EsquemaAsiento ec : this.esquemaAsientoList) { + if (ec.getActivo()) { + esquemaList.add(ec); + } + } + return esquemaList; + } + + public void setEsquemaAsientoList(List esquemaAsientoList) { + this.esquemaAsientoList = esquemaAsientoList; + } + + public EsquemaCorrida getEsquemaCorridaRebote() { + return esquemaCorridaRebote; + } + + public void setEsquemaCorridaRebote(EsquemaCorrida esquemaCorridaRebote) { + this.esquemaCorridaRebote = esquemaCorridaRebote; + } + + public ClaseServicio getClaseServicio2() { + return claseServicio2; + } + + public void setClaseServicio2(ClaseServicio claseServicio2) { + this.claseServicio2 = claseServicio2; + } + + public RolOperativo getRolOperativo2() { + return rolOperativo2; + } + + public void setRolOperativo2(RolOperativo rolOperativo2) { + this.rolOperativo2 = rolOperativo2; + } + + public Integer getNumCorrida() { + return numCorrida; + } + + public void setNumCorrida(Integer numCorrida) { + this.numCorrida = numCorrida; + } + + public Integer getNumCorridaPisoExtra() { + return numCorridaPisoExtra; + } + + public void setNumCorridaPisoExtra(Integer numCorridaPisoExtra) { + this.numCorridaPisoExtra = numCorridaPisoExtra; + } + + public String getIndGeneraFeriado() { + return indGeneraFeriado; + } + + public void setIndGeneraFeriado(String indGeneraFeriado) { + this.indGeneraFeriado = indGeneraFeriado; + } + + public Integer getCantDiasGeneracion() { + return cantDiasGeneracion; + } + + public void setCantDiasGeneracion(Integer cantDiasGeracion) { + this.cantDiasGeneracion = cantDiasGeracion; + } + + public Integer getEsquemaAgrupacionId() { + return esquemaAgrupacionId; + } + + public void setEsquemaAgrupacionId(Integer esquemaAgrupacionId) { + this.esquemaAgrupacionId = esquemaAgrupacionId; + } + + public String getInfoCorrida() { + return infoCorrida; + } + + public void setInfoCorrida(String infoCorrida) { + this.infoCorrida = infoCorrida; + } + + public Boolean getIndCorridaExtra() { + return indCorridaExtra; + } + + public void setIndCorridaExtra(Boolean indCorridaExtra) { + this.indCorridaExtra = indCorridaExtra; + } + + public void clone(EsquemaCorrida other){ + this.activo = other.activo; + this.cantDiasGeneracion = other.cantDiasGeneracion; + this.cantparados = other.cantparados; + this.claseServicio = other.claseServicio; + this.claseServicio2 = other.claseServicio2; + this.diagramaAutobusId = other.diagramaAutobusId; + this.division = other.division; + this.empresa = other.empresa; + this.empresa1 = other.empresa1; + this.esquemaAgrupacionId = other.esquemaAgrupacionId; + this.esquemacorridaId = null; + this.esquemaCorridaRebote = other.esquemaCorridaRebote; + this.esquemaOperacional = other.esquemaOperacional; + this.fecmodif = other.fecmodif; + this.horasalida = other.horasalida; + this.indCorridaExtra = other.indCorridaExtra; + this.indDiaSimDiaNao = other.indDiaSimDiaNao; + this.inddomingo = other.inddomingo; + this.indGeneraFeriado = other.indGeneraFeriado; + this.indjueves = other.indjueves; + this.indlunes = other.indlunes; + this.indmartes = other.indmartes; + this.indmiercoles = other.indmiercoles; + this.indsabado = other.indsabado; + this.indviernes = other.indviernes; + this.infoCorrida = other.infoCorrida; + this.marca = other.marca; + this.numCorrida = other.numCorrida; + this.numCorridaPisoExtra = other.numCorridaPisoExtra; + this.pisoExtra = other.pisoExtra; + this.rolOperativo = other.rolOperativo; + this.rolOperativo2 = other.rolOperativo2; + this.ruta = other.ruta; + this.statusCorrida = other.statusCorrida; + this.tipocorrida = other.tipocorrida; + this.usuarioId = other.usuarioId; + + //this.esquemaAsientoList; + //this.esquemaTramoList; + + for (EsquemaTramo old : other.esquemaTramoList){ + EsquemaTramo et = new EsquemaTramo(); + et.setActivo(old.getActivo()); + et.setEsquemaCorrida(this); + et.setExcepcionRecorrido(old.getExcepcionRecorrido()); + et.setFecmodif(old.getFecmodif()); + et.setNumsecuencia(old.getNumsecuencia()); + et.setPlataforma(old.getPlataforma()); + et.setTiempoEstancia(old.getTiempoEstancia()); + et.setTramo(old.getTramo()); + et.setUsuarioId(old.getUsuarioId()); + if (esquemaTramoList == null){ + esquemaTramoList = new ArrayList(); + } + esquemaTramoList.add(et); + } + + for (EsquemaAsiento old : other.esquemaAsientoList){ + EsquemaAsiento a = new EsquemaAsiento(); + a.setActivo(old.getActivo()); + a.setDestino(old.getDestino()); + a.setEsquemaasientoId(null); + a.setEsquemaCorrida(this); + a.setFecmodif(old.getFecmodif()); + a.setIndvendible(old.getIndvendible()); + a.setMotivobloqueo(old.getMotivobloqueo()); + a.setNumasiento(old.getNumasiento()); + a.setParada(old.getParada()); + a.setTiempoLiberacion(old.getTiempoLiberacion()); + a.setUsuarioId(old.getUsuarioId()); + if (esquemaAsientoList == null){ + esquemaAsientoList = new ArrayList(); + } + esquemaAsientoList.add(a); + } + + } + + public Boolean getIndDiaSimDiaNao() { + return indDiaSimDiaNao; + } + + public void setIndDiaSimDiaNao(Boolean indDiaSimDiaNao) { + this.indDiaSimDiaNao = indDiaSimDiaNao; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (esquemacorridaId != null ? esquemacorridaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof EsquemaCorrida)) { + return false; + } + EsquemaCorrida other = (EsquemaCorrida) object; + if ((this.esquemacorridaId == null && other.esquemacorridaId != null) || (this.esquemacorridaId != null && !this.esquemacorridaId.equals(other.esquemacorridaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaCorrida[esquemacorridaId=" + esquemacorridaId + "]"; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaOperacional.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaOperacional.java new file mode 100644 index 000000000..5d128074b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaOperacional.java @@ -0,0 +1,171 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_OPERACIONAL_SEQ", sequenceName = "ESQUEMA_OPERACIONAL_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_OPERACIONAL") +public class EsquemaOperacional implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMAOPERACIONAL_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_OPERACIONAL_SEQ") + private Integer esquemaoperacionalId; + @Column(name = "FECNICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @OneToMany(mappedBy = "esquemaOperacional") + private List esquemaCorridaList; + + public EsquemaOperacional() { + } + + public EsquemaOperacional(Integer esquemaoperacionalId) { + this.esquemaoperacionalId = esquemaoperacionalId; + } + + public Integer getEsquemaoperacionalId() { + return esquemaoperacionalId; + } + + public void setEsquemaoperacionalId(Integer esquemaoperacionalId) { + this.esquemaoperacionalId = esquemaoperacionalId; + } + + public Date getFecniciovigencia() { + return fecniciovigencia; + } + + public void setFecniciovigencia(Date fecniciovigencia) { + if (fecniciovigencia != null) { + GregorianCalendar fecInicioVigenciaEsquema = new GregorianCalendar(); + + fecInicioVigenciaEsquema.setTime(fecniciovigencia); + fecInicioVigenciaEsquema.set(Calendar.SECOND, 0); + fecInicioVigenciaEsquema.set(Calendar.MILLISECOND, 0); + fecInicioVigenciaEsquema.set(Calendar.MINUTE, 0); + fecInicioVigenciaEsquema.set(Calendar.HOUR_OF_DAY, 0); + + fecniciovigencia = fecInicioVigenciaEsquema.getTime(); + } + this.fecniciovigencia = fecniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + if (fecfinvigencia != null) { + GregorianCalendar fecFinVigenciaEsquema = new GregorianCalendar(); + + fecFinVigenciaEsquema.setTime(fecfinvigencia); + fecFinVigenciaEsquema.set(Calendar.SECOND, 0); + fecFinVigenciaEsquema.set(Calendar.MILLISECOND, 0); + fecFinVigenciaEsquema.set(Calendar.MINUTE, 0); + fecFinVigenciaEsquema.set(Calendar.HOUR_OF_DAY, 0); + + fecfinvigencia = fecFinVigenciaEsquema.getTime(); + } + this.fecfinvigencia = fecfinvigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public List getEsquemaCorridaList() { + List esquemaList = new ArrayList(); + for (EsquemaCorrida ec : this.esquemaCorridaList) { + if (ec.getActivo() == Boolean.TRUE) { + esquemaList.add(ec); + } + } + return esquemaList; + } + + public void setEsquemaCorridaList(List esquemaCorridaList) { + this.esquemaCorridaList = esquemaCorridaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (esquemaoperacionalId != null ? esquemaoperacionalId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EsquemaOperacional)) { + return false; + } + EsquemaOperacional other = (EsquemaOperacional) object; + if ((this.esquemaoperacionalId == null && other.esquemaoperacionalId != null) || (this.esquemaoperacionalId != null && !this.esquemaoperacionalId.equals(other.esquemaoperacionalId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaOperacional[esquemaoperacionalId=" + esquemaoperacionalId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaTramo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaTramo.java new file mode 100644 index 000000000..7a3eed9b5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EsquemaTramo.java @@ -0,0 +1,170 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_TRAMO_SEQ", sequenceName = "ESQUEMA_TRAMO_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_TRAMO") +public class EsquemaTramo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMATRAMO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_TRAMO_SEQ") + private Integer esquematramoId; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIEMPOESTANCIA") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date tiempoEstancia; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @ManyToOne + private EsquemaCorrida esquemaCorrida; + @Column(name = "PLATAFORMA") + private String plataforma; + @Column(name = "EXCEPCIONRECORRIDO") + private Date excepcionRecorrido; + + public Date getTiempoEstancia() { + return tiempoEstancia; + } + + public void setTiempoEstancia(Date tiempoEstancia) { + this.tiempoEstancia = tiempoEstancia; + } + + public EsquemaTramo() { + } + + public EsquemaTramo(Integer esquematramoId) { + this.esquematramoId = esquematramoId; + } + + public Integer getEsquematramoId() { + return esquematramoId; + } + + public void setEsquematramoId(Integer esquematramoId) { + this.esquematramoId = esquematramoId; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public EsquemaCorrida getEsquemaCorrida() { + return esquemaCorrida; + } + + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } + + public String getPlataforma() { + return plataforma; + } + + public void setPlataforma(String plataforma) { + this.plataforma = plataforma; + } + + public Date getExcepcionRecorrido() { + return excepcionRecorrido; + } + + public void setExcepcionRecorrido(Date excepcionRecorrido) { + this.excepcionRecorrido = excepcionRecorrido; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (esquematramoId != null ? esquematramoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EsquemaTramo)) { + return false; + } + EsquemaTramo other = (EsquemaTramo) object; + if ((this.esquematramoId == null && other.esquematramoId != null) || (this.esquematramoId != null && !this.esquematramoId.equals(other.esquematramoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaTramo[esquematramoId=" + esquematramoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Estacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Estacion.java new file mode 100644 index 000000000..ef875d073 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Estacion.java @@ -0,0 +1,331 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "ESTACION") +@SequenceGenerator(name = "ESTACION_SEQ", sequenceName = "ESTACION_SEQ", allocationSize = 1) +public class Estacion implements Serializable { + + public final static String CONEXION_SANTANDER = "S"; + public final static String CONEXION_BANORTE = "B"; + public final static String CONEXION_SW_MANUAL = "M"; + public final static String CONEXION_SW_PINPAD = "E"; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_SEQ") + @Column(name = "ESTACION_ID") + private Integer estacionId; + @Column(name = "NUMCAJA") + private Long numcaja; + @Column(name = "DESCESTACION") + private String descestacion; + @Column(name = "DESCMAC") + private String descmac; + @Column(name = "INDCONEXIONBANCARIA") + private String conexionBancaria; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "INDIMPRESIONPINPAD") + private Boolean pinPadImpresoraPropia; + @Column(name = "INDPAUSARIMPRESORA") + private Boolean pausarImpressora; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + @OneToOne + @JoinColumn(name = "USUARIOBANCARIO_ID") + private UsuarioBancario usuarioBancario; + @Column(name = "NOMEIMPRESSORA") + private String nomeImpressora; + @Column(name = "NOMEARQUIVOLAYOUT") + private String nomeArquivoLayout; + @Column(name = "NOMEIMPRESSORARELATORIO") + private String nomeImpressoraRelatorio; + @Column(name = "NOMBIMPRESORASEGURO") + private String nombImpresoraSeguro; + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + private List estacionSitefList; + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + private List estacionRioCardList; + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + private List lsEstacionImpresora; + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + private List abastoBoletoList; + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + private List requisicionBoletoList; + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + private List folioPreimpresoList; + + public Estacion() { + } + + public Estacion(Integer estacionId) { + this.estacionId = estacionId; + + } + + public Integer getEstacionId() { + return estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public Long getNumcaja() { + return numcaja; + } + + public void setNumcaja(Long numcaja) { + this.numcaja = numcaja; + } + + public String getDescestacion() { + return descestacion; + } + + public void setDescestacion(String descestacion) { + this.descestacion = descestacion; + } + + public String getDescmac() { + return descmac; + } + + public void setDescmac(String descmac) { + this.descmac = descmac; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public UsuarioBancario getUsuarioBancario() { + return usuarioBancario; + } + + public void setUsuarioBancario(UsuarioBancario usuarioBancario) { + this.usuarioBancario = usuarioBancario; + } + + public String getConexionBancaria() { + return conexionBancaria; + } + + public void setConexionBancaria(String conexionBancaria) { + this.conexionBancaria = conexionBancaria; + } + + public Boolean getPinPadImpresoraPropia() { + return pinPadImpresoraPropia; + } + + public void setPinPadImpresoraPropia(Boolean pinPadImpresoraPropia) { + this.pinPadImpresoraPropia = pinPadImpresoraPropia; + } + + public Boolean getPausarImpressora() { + return pausarImpressora; + } + + public void setPausarImpressora(Boolean pausarImpressora) { + this.pausarImpressora = pausarImpressora; + } + + public String getNomeImpressora() { + return nomeImpressora; + } + + public void setNomeImpressora(String nomeImpressora) { + this.nomeImpressora = nomeImpressora; + } + + public String getNomeArquivoLayout() { + return nomeArquivoLayout; + } + + public void setNomeArquivoLayout(String nomeArquivoLayout) { + this.nomeArquivoLayout = nomeArquivoLayout; + } + + public String getNomeImpressoraRelatorio() { + return nomeImpressoraRelatorio; + } + + public void setNomeImpressoraRelatorio(String nomeImpressoraRelatorio) { + this.nomeImpressoraRelatorio = nomeImpressoraRelatorio; + } + + public List getEstacionSitefList() { + List tmp = new ArrayList(); + + if (estacionSitefList != null) { + for (EstacionSitef es : estacionSitefList) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setEstacionSitefList(List estacionSitefList) { + this.estacionSitefList = estacionSitefList; + } + + public List getEstacionRioCardList() { + List tmp = new ArrayList(); + + if (estacionRioCardList != null) { + for (EstacionRioCard es : estacionRioCardList) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setEstacionRioCardList(List estacionRioCardList) { + this.estacionRioCardList = estacionRioCardList; + } + + public List getLsEstacionImpresora() { + List tmp = new ArrayList(); + + if (lsEstacionImpresora != null) { + for (EstacionImpresora es : lsEstacionImpresora) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setLsEstacionImpresora(List lsEstacionImpresora) { + this.lsEstacionImpresora = lsEstacionImpresora; + } + + public List getAbastoBoletoList() { + return abastoBoletoList; + } + + public void setAbastoBoletoList(List abastoBoletoList) { + this.abastoBoletoList = abastoBoletoList; + } + + public List getRequisicionBoletoList() { + return requisicionBoletoList; + } + + public void setRequisicionBoletoList(List requisicionBoletoList) { + this.requisicionBoletoList = requisicionBoletoList; + } + + public List getFolioPreimpresoList() { + return folioPreimpresoList; + } + + public void setFolioPreimpresoList(List folioPreimpresoList) { + this.folioPreimpresoList = folioPreimpresoList; + } + + public String getNombImpresoraSeguro() { + return nombImpresoraSeguro; + } + + public void setNombImpresoraSeguro(String nombImpresoraSeguro) { + this.nombImpresoraSeguro = nombImpresoraSeguro; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estacionId != null ? estacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Estacion)) { + return false; + } + Estacion other = (Estacion) object; + if ((this.estacionId == null && other.estacionId != null) || (this.estacionId != null && !this.estacionId.equals(other.estacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return (numcaja != null) ? String.format("%d - %s", numcaja, descestacion) : descestacion; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionImpresora.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionImpresora.java new file mode 100644 index 000000000..576e69463 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionImpresora.java @@ -0,0 +1,123 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ESTACION_IMPRESORA_SEQ", sequenceName = "ESTACION_IMPRESORA_SEQ", allocationSize = 1) +@Table(name = "ESTACION_IMPRESORA ") +public class EstacionImpresora implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_IMPRESORA_SEQ") + @Column(name = "ESTACIONIMPRESORA_ID") + private Integer estacionImpresoraId; + @ManyToOne + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + private Estacion estacion; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "NOMBIMPRESORA") + private String nombImpresora; + @Column(name = "NOMBARCHIVOLAYOUT") + private String nombArchivoLayout; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIPOIMPRESSORA") + private Integer tipoImpressora; + + public Integer getEstacionImpresoraId() { + return estacionImpresoraId; + } + + public void setEstacionImpresoraId(Integer estacionImpresoraId) { + this.estacionImpresoraId = estacionImpresoraId; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getNombImpresora() { + return nombImpresora; + } + + public void setNombImpresora(String nombImpresora) { + this.nombImpresora = nombImpresora; + } + + public String getNombArchivoLayout() { + return nombArchivoLayout; + } + + public void setNombArchivoLayout(String nombArchivoLayout) { + this.nombArchivoLayout = nombArchivoLayout; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getTipoImpressora() { + return tipoImpressora; + } + + public void setTipoImpressora(Integer tipoImpressora) { + this.tipoImpressora = tipoImpressora; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionRioCard.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionRioCard.java new file mode 100644 index 000000000..b03fd2d6c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionRioCard.java @@ -0,0 +1,143 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@Table(name = "ESTACION_RIOCARD") +@SequenceGenerator(name = "ESTACION_RIOCARD_SEQ", sequenceName = "ESTACION_RIOCARD_SEQ", allocationSize = 1) +public class EstacionRioCard implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_RIOCARD_SEQ") + @Column(name = "ESTACIONRIOCARD_ID") + private Integer estacionRioCardId; + @Column(name = "OPERADORA") + private String operadora; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + private Estacion estacion; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + public EstacionRioCard() { + } + + public EstacionRioCard(Integer estacionRioCardId) { + this.estacionRioCardId = estacionRioCardId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estacionRioCardId != null ? estacionRioCardId.hashCode() : 0); + return hash; + } + + public Integer getEstacionRioCardId() { + return estacionRioCardId; + } + + public void setEstacionRioCardId(Integer estacionRioCardId) { + this.estacionRioCardId = estacionRioCardId; + } + + public String getOperadora() { + return operadora; + } + + public void setOperadora(String operadora) { + this.operadora = operadora; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof EstacionRioCard)) { + return false; + } + EstacionRioCard other = (EstacionRioCard) object; + if ((this.estacionRioCardId == null && other.estacionRioCardId != null) || (this.estacionRioCardId != null && !this.estacionRioCardId.equals(other.estacionRioCardId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EstacionRiocard[ estacionRioCardId=" + estacionRioCardId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java new file mode 100644 index 000000000..72ee6231c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@Table(name = "ESTACION_SITEF") +@SequenceGenerator(name = "ESTACION_SITEF_SEQ", sequenceName = "ESTACION_SITEF_SEQ", allocationSize = 1) +public class EstacionSitef implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_SITEF_SEQ") + @Column(name = "ESTACIONSITEF_ID") + private Integer estacionsitefId; + @Column(name = "NUMEMPRESA") + private Integer numempresa; + @Column(name = "NUMFILIAL") + private Integer numfilial; + @Column(name = "NUMPDV") + private Integer numpdv; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + private Estacion estacion; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "IPSERVIDOR") + private String ipServidor; + + public EstacionSitef() { + } + + public EstacionSitef(Integer estacionsitefId) { + this.estacionsitefId = estacionsitefId; + } + + public Integer getEstacionsitefId() { + return estacionsitefId; + } + + public void setEstacionsitefId(Integer estacionsitefId) { + this.estacionsitefId = estacionsitefId; + } + + public Integer getNumempresa() { + return numempresa; + } + + public void setNumempresa(Integer numempresa) { + this.numempresa = numempresa; + } + + public Integer getNumfilial() { + return numfilial; + } + + public void setNumfilial(Integer numfilial) { + this.numfilial = numfilial; + } + + public Integer getNumpdv() { + return numpdv; + } + + public void setNumpdv(Integer numpdv) { + this.numpdv = numpdv; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estacionsitefId != null ? estacionsitefId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof EstacionSitef)) { + return false; + } + EstacionSitef other = (EstacionSitef) object; + if ((this.estacionsitefId == null && other.estacionsitefId != null) || (this.estacionsitefId != null && !this.estacionsitefId.equals(other.estacionsitefId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EstacionSitef[ estacionsitefId=" + estacionsitefId + " ]"; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public String getIpServidor() { + return ipServidor; + } + + public void setIpServidor(String ipServidor) { + this.ipServidor = ipServidor; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Estado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Estado.java new file mode 100644 index 000000000..567a2c32f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Estado.java @@ -0,0 +1,226 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESTADO_SEQ", sequenceName = "ESTADO_SEQ", allocationSize = 1) +@Table(name = "ESTADO") +public class Estado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTADO_SEQ") + @Basic(optional = false) + @Column(name = "ESTADO_ID") + private Integer estadoId; + @Column(name = "NOMBESTADO") + private String nombestado; + @Column(name = "CVEESTADO") + private String cveestado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PAIS_ID", referencedColumnName = "PAIS_ID") + @ManyToOne + private Pais pais; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @OneToMany(mappedBy = "estado") + private List ciudadList; + @Column(name = "ICMS") + private BigDecimal icms; + @Column(name = "TIEMPOHORHUSO") + private Integer tiempoHorHuso; + @Column(name = "FECINICIOHORVERANO") + @Temporal(TemporalType.DATE) + private Date fecInicioHorVerano; + @Column(name = "FECFINOHORVERANO") + @Temporal(TemporalType.DATE) + private Date fecFinoHorVerano; + @Column(name = "TIEMPOHORVERANO") + private Integer tiempoHorVerano; + @OneToMany(mappedBy = "estado") + private List empresaImpostoList; + @Column(name = "DESCPROCON") + private String descProcon; + + public Estado() { + } + + public Estado(Integer estadoId) { + this.estadoId = estadoId; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public String getNombestado() { + return nombestado; + } + + public void setNombestado(String nombestado) { + this.nombestado = nombestado; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pais getPais() { + return pais; + } + + public void setPais(Pais pais) { + this.pais = pais; + } + + public List getCiudadList() { + return ciudadList; + } + + public void setCiudadList(List ciudadList) { + this.ciudadList = ciudadList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public String getCveestado() { + return cveestado; + } + + public void setCveestado(String cveestado) { + this.cveestado = cveestado; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public Integer getTiempoHorHuso() { + return tiempoHorHuso; + } + + public void setTiempoHorHuso(Integer tiempoHorHuso) { + this.tiempoHorHuso = tiempoHorHuso; + } + + public Date getFecInicioHorVerano() { + return fecInicioHorVerano; + } + + public void setFecInicioHorVerano(Date fecInicioHorVerano) { + this.fecInicioHorVerano = fecInicioHorVerano; + } + + public Date getFecFinoHorVerano() { + return fecFinoHorVerano; + } + + public void setFecFinoHorVerano(Date fecFinoHorVerano) { + this.fecFinoHorVerano = fecFinoHorVerano; + } + + public Integer getTiempoHorVerano() { + return tiempoHorVerano; + } + + public void setTiempoHorVerano(Integer tiempoHorVerano) { + this.tiempoHorVerano = tiempoHorVerano; + } + + public String getDescProcon() { + return descProcon; + } + + public void setDescProcon(String descProcon) { + this.descProcon = descProcon; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estadoId != null ? estadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Estado)) { + return false; + } + Estado other = (Estado) object; + if ((this.estadoId == null && other.estadoId != null) || (this.estadoId != null && !this.estadoId.equals(other.estadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombestado(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EventoExtra.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EventoExtra.java new file mode 100644 index 000000000..5e25cccf4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/EventoExtra.java @@ -0,0 +1,249 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "EVENTO_EXTRA") +@SequenceGenerator(name = "EVENTO_EXTRA_SEQ", sequenceName = "EVENTO_EXTRA_SEQ", allocationSize = 1) +public class EventoExtra implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EVENTO_EXTRA_SEQ") + @Column(name = "EVENTOEXTRA_ID") + private Long eventoextraId; + @Column(name = "TIPOEVENTOEXTRA_ID") + private Integer tipoeventoextraId; + @Column(name = "FECHORINGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechoringreso; + @Column(name = "IMPINGRESO") + private BigDecimal impingreso; + @Column(name = "NUMDOCUMENTO") + private String numdocumento; + @Column(name = "IMPORTEIVA") + private BigDecimal importeiva; + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "FORMAPAGO_ID") + private Integer formapagoId; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "CANTBOLETOS") + private Short cantboletos; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "FECCORRIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date feccorrida; + @Column(name = "CONDUCTOR1_ID") + private Integer conductor1Id; + @Column(name = "EMPRESA_ID") + private Integer empresaId; + @Column(name = "CONDUCTOR2_ID") + private Integer conductor2Id; + @Column(name = "AUTOBUS") + private Integer autobus; + + public EventoExtra() { + } + + public EventoExtra(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public Date getFechoringreso() { + return fechoringreso; + } + + public void setFechoringreso(Date fechoringreso) { + this.fechoringreso = fechoringreso; + } + + public BigDecimal getImpingreso() { + return impingreso; + } + + public void setImpingreso(BigDecimal impingreso) { + this.impingreso = impingreso; + } + + public String getNumdocumento() { + return numdocumento; + } + + public void setNumdocumento(String numdocumento) { + this.numdocumento = numdocumento; + } + + public BigDecimal getImporteiva() { + return importeiva; + } + + public void setImporteiva(BigDecimal importeiva) { + this.importeiva = importeiva; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Short getCantboletos() { + return cantboletos; + } + + public void setCantboletos(Short cantboletos) { + this.cantboletos = cantboletos; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFeccorrida() { + return feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + public Integer getConductor1Id() { + return conductor1Id; + } + + public void setConductor1Id(Integer conductor1Id) { + this.conductor1Id = conductor1Id; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getConductor2Id() { + return conductor2Id; + } + + public void setConductor2Id(Integer conductor2Id) { + this.conductor2Id = conductor2Id; + } + + public Integer getAutobus() { + return autobus; + } + + public void setAutobus(Integer autobus) { + this.autobus = autobus; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (eventoextraId != null ? eventoextraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EventoExtra)) { + return false; + } + EventoExtra other = (EventoExtra) object; + if ((this.eventoextraId == null && other.eventoextraId != null) || (this.eventoextraId != null && !this.eventoextraId.equals(other.eventoextraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EventoExtra[eventoextraId=" + eventoextraId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java new file mode 100644 index 000000000..bb4d4c762 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Filter; +import org.hibernate.annotations.FilterDef; + +@Entity +@FilterDef(name="ativo") +@SequenceGenerator(name = "EXCEPCION_PEAJE_SEQ", sequenceName = "EXCEPCION_PEAJE_SEQ", allocationSize = 1) +@Table(name = "EXCEPCION_PEAJE") +public class ExcepcionPeaje implements Serializable,Comparable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "EXCEPCIONPEAJE_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_PEAJE_SEQ") + private Integer excepcionPeajeId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID") + @OneToOne + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToMany(mappedBy = "excepcionPeaje", cascade = CascadeType.ALL)//, fetch = FetchType.EAGER + @Filter(name="ativo", condition="ACTIVO = 1") + private List lsExcepcionPeajeVigencia; + + public Integer getExcepcionPeajeId() { + return excepcionPeajeId; + } + public void setExcepcionPeajeId(Integer excepcionPeajeId) { + this.excepcionPeajeId = excepcionPeajeId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Parada getOrigem() { + return origem; + } + public void setOrigem(Parada origem) { + this.origem = origem; + } + public Parada getDestino() { + return destino; + } + public void setDestino(Parada destino) { + this.destino = destino; + } + + public List getLsExcepcionPeajeVigencia() { + return lsExcepcionPeajeVigencia; + } + public void setLsExcepcionPeajeVigencia(List lsExcepcionPeajeVigencia) { + this.lsExcepcionPeajeVigencia = lsExcepcionPeajeVigencia; + } + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje[excepcionPeajeId=" + excepcionPeajeId + "]"; + } + @Override + public int compareTo(ExcepcionPeaje excepcionPeaje) { + return this.getExcepcionPeajeId().intValue() - excepcionPeaje.getExcepcionPeajeId().intValue(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java new file mode 100644 index 000000000..c7569e16c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java @@ -0,0 +1,254 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EXCEPCION_PEAJE_VIGENCIA_SEQ", sequenceName = "EXCEPCION_PEAJE_VIGENCIA_SEQ", allocationSize = 1) +@Table(name = "EXCEPCION_PEAJE_VIGENCIA") +public class ExcepcionPeajeVigencia implements Serializable ,Comparable { + +private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "EXCEPCIONPEAJEVIGENCIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_PEAJE_VIGENCIA_SEQ") + private Integer excepcionPeajeVigenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "EXCEPCIONPEAJE_ID" , referencedColumnName = "EXCEPCIONPEAJE_ID") + private ExcepcionPeaje excepcionPeaje; + @Column(name = "FECHAVENTAINI") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecVentaIni; + @Column(name = "FECHAVENTAFIN") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecVentaFin; + @Column(name = "FECHORINICIO") + @Temporal(TemporalType.TIME) + private Date horaIni; + @Column(name = "FECHORFINAL") + @Temporal(TemporalType.TIME) + private Date horaFin; + @Column(name = "INDLUNES") + private Boolean INDLUNES; + @Column(name = "INDMARTES") + private Boolean INDMARTES; + @Column(name = "INDMIERCOLES") + private Boolean INDMIERCOLES; + @Column(name = "INDJUEVES") + private Boolean INDJUEVES; + @Column(name = "INDVIERNES") + private Boolean INDVIERNES; + @Column(name = "INDSABADO") + private Boolean INDSABADO; + @Column(name = "INDDOMINGO") + private Boolean INDDOMINGO; + @Column(name = "PRECIO") + private BigDecimal precio; + + public Integer getExcepcionPeajeVigenciaId() { + return excepcionPeajeVigenciaId; + } + + + public void setExcepcionPeajeVigenciaId(Integer excepcionPeajeVigenciaId) { + this.excepcionPeajeVigenciaId = excepcionPeajeVigenciaId; + } + + + public Boolean getActivo() { + return activo; + } + + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + + public Date getFecmodif() { + return fecmodif; + } + + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + + public Integer getUsuarioId() { + return usuarioId; + } + + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + public ExcepcionPeaje getExcepcionPeaje() { + return excepcionPeaje; + } + + + public void setExcepcionPeaje(ExcepcionPeaje excepcionPeaje) { + this.excepcionPeaje = excepcionPeaje; + } + + + public java.util.Date getFecVentaIni() { + return fecVentaIni; + } + + + public void setFecVentaIni(java.util.Date fecVentaIni) { + this.fecVentaIni = fecVentaIni; + } + + + public java.util.Date getFecVentaFin() { + return fecVentaFin; + } + + + public void setFecVentaFin(java.util.Date fecVentaFin) { + this.fecVentaFin = fecVentaFin; + } + + + public Date getHoraIni() { + return horaIni; + } + + + public void setHoraIni(Date horaIni) { + this.horaIni = horaIni; + } + + + public Date getHoraFin() { + return horaFin; + } + + + public void setHoraFin(Date horaFin) { + this.horaFin = horaFin; + } + + + public Boolean getINDLUNES() { + return INDLUNES; + } + + + public void setINDLUNES(Boolean iNDLUNES) { + INDLUNES = iNDLUNES; + } + + + public Boolean getINDMARTES() { + return INDMARTES; + } + + + public void setINDMARTES(Boolean iNDMARTES) { + INDMARTES = iNDMARTES; + } + + + public Boolean getINDMIERCOLES() { + return INDMIERCOLES; + } + + + public void setINDMIERCOLES(Boolean iNDMIERCOLES) { + INDMIERCOLES = iNDMIERCOLES; + } + + + public Boolean getINDJUEVES() { + return INDJUEVES; + } + + + public void setINDJUEVES(Boolean iNDJUEVES) { + INDJUEVES = iNDJUEVES; + } + + + public Boolean getINDVIERNES() { + return INDVIERNES; + } + + + public void setINDVIERNES(Boolean iNDVIERNES) { + INDVIERNES = iNDVIERNES; + } + + + public Boolean getINDSABADO() { + return INDSABADO; + } + + + public void setINDSABADO(Boolean iNDSABADO) { + INDSABADO = iNDSABADO; + } + + + public Boolean getINDDOMINGO() { + return INDDOMINGO; + } + + + public void setINDDOMINGO(Boolean iNDDOMINGO) { + INDDOMINGO = iNDDOMINGO; + } + + + public BigDecimal getPrecio() { + return precio; + } + + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia[excepcionPeajeVigenciaId=" + excepcionPeajeVigenciaId + "]"; + } + + @Override + public int compareTo(ExcepcionPeajeVigencia excepcionPeajeVigencia) { + if(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId() != null){ + return this.getExcepcionPeajeVigenciaId().intValue() - excepcionPeajeVigencia.getExcepcionPeajeVigenciaId().intValue(); + }else{ + return -1; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionRedondo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionRedondo.java new file mode 100644 index 000000000..68bb75d18 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ExcepcionRedondo.java @@ -0,0 +1,146 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "EXCEPCION_REDONDO_SEQ", sequenceName = "EXCEPCION_REDONDO_SEQ", allocationSize = 1) +@Table(name = "EXCEPCION_REDONDO") +public class ExcepcionRedondo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_REDONDO_SEQ") + @Basic(optional = false) + @Column(name = "EXCEPCIONREDONDO_ID") + private Integer excepcionredondoId; + @Column(name = "INDTIPO") + private String indtipo; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + + public ExcepcionRedondo() { + } + + public ExcepcionRedondo(Integer excepcionredondoId) { + this.excepcionredondoId = excepcionredondoId; + } + + public ExcepcionRedondo(Integer excepcionredondoId, Boolean activo) { + this.excepcionredondoId = excepcionredondoId; + this.activo = activo; + } + + public Integer getExcepcionredondoId() { + return excepcionredondoId; + } + + public void setExcepcionredondoId(Integer excepcionredondoId) { + this.excepcionredondoId = excepcionredondoId; + } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (excepcionredondoId != null ? excepcionredondoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ExcepcionRedondo)) { + return false; + } + ExcepcionRedondo other = (ExcepcionRedondo) object; + if ((this.excepcionredondoId == null && other.excepcionredondoId != null) || (this.excepcionredondoId != null && !this.excepcionredondoId.equals(other.excepcionredondoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo[excepcionredondoId=" + excepcionredondoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamgeral.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamgeral.java new file mode 100644 index 000000000..66e771ce4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamgeral.java @@ -0,0 +1,194 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "FECHAMENTO_PARAMGERAL") +public class FechamentoParamgeral implements java.io.Serializable { + + private static final long serialVersionUID = 1L; + + private Long fechamentoparamgeralId; + private Empresa empresa; + private String boletoBancoCod; + private String boletoBancoAgencia; + private String boletoBancoConta; + private String boletoBancoContaDigito; + private String boletoBancoCarteira; + private Integer boletoDiasVenc; + + private Date fecmodif; + private Integer usuarioId; + private Boolean activo; + + public FechamentoParamgeral() { + super(); + } + + public FechamentoParamgeral(Empresa empresa, String boletoBancoCod, + String boletoBancoAgencia, String boletoBancoConta, + String boletoBancoContaDigito, String boletoBancoCarteira, + Integer boletoDiasVenc, Date fecmodif, Integer usuarioId, + Boolean activo) { + this(); + this.empresa = empresa; + this.boletoBancoCod = boletoBancoCod; + this.boletoBancoAgencia = boletoBancoAgencia; + this.boletoBancoConta = boletoBancoConta; + this.boletoBancoContaDigito = boletoBancoContaDigito; + this.boletoBancoCarteira = boletoBancoCarteira; + this.boletoDiasVenc = boletoDiasVenc; + + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.activo = activo; + } + + public FechamentoParamgeral(Empresa empresa, String boletoBancoCod, + String boletoBancoAgencia, String boletoBancoConta, + String boletoBancoContaDigito, String boletoBancoCarteira, + Integer boletoDiasVenc, Integer usuarioId) { + this(); + this.empresa = empresa; + this.boletoBancoCod = boletoBancoCod; + this.boletoBancoAgencia = boletoBancoAgencia; + this.boletoBancoConta = boletoBancoConta; + this.boletoBancoContaDigito = boletoBancoContaDigito; + this.boletoBancoCarteira = boletoBancoCarteira; + this.boletoDiasVenc = boletoDiasVenc; + + this.fecmodif = new Date(); + this.usuarioId = usuarioId; + this.activo = true; + } + + @SequenceGenerator(name = "FECHAMENTO_PARAMGERAL_SEQ", sequenceName = "FECHAMENTO_PARAMGERAL_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_PARAMGERAL_SEQ") + @Column(name = "FECHAMENTOPARAMGERAL_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getFechamentoparamgeralId() { + return fechamentoparamgeralId; + } + public void setFechamentoparamgeralId(Long fechamentoparamgeralId) { + this.fechamentoparamgeralId = fechamentoparamgeralId; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Column(name = "BOLETO_BANCO_COD", length = 4) + public String getBoletoBancoCod() { + return boletoBancoCod; + } + public void setBoletoBancoCod(String boletoBancoCod) { + this.boletoBancoCod = boletoBancoCod; + } + + @Column(name = "BOLETO_BANCO_AGENCIA", length = 10) + public String getBoletoBancoAgencia() { + return boletoBancoAgencia; + } + public void setBoletoBancoAgencia(String boletoBancoAgencia) { + this.boletoBancoAgencia = boletoBancoAgencia; + } + + @Column(name = "BOLETO_BANCO_CONTA", length = 10) + public String getBoletoBancoConta() { + return boletoBancoConta; + } + public void setBoletoBancoConta(String boletoBancoConta) { + this.boletoBancoConta = boletoBancoConta; + } + + @Column(name = "BOLETO_BANCO_CONTA_DIGITO", length = 1) + public String getBoletoBancoContaDigito() { + return boletoBancoContaDigito; + } + public void setBoletoBancoContaDigito(String boletoBancoContaDigito) { + this.boletoBancoContaDigito = boletoBancoContaDigito; + } + + @Column(name = "BOLETO_BANCO_CARTEIRA", length = 3) + public String getBoletoBancoCarteira() { + return boletoBancoCarteira; + } + public void setBoletoBancoCarteira(String boletoBancoCarteira) { + this.boletoBancoCarteira = boletoBancoCarteira; + } + + @Column(name = "BOLETO_DIAS_VENC", length = 3) + public Integer getBoletoDiasVenc() { + return boletoDiasVenc; + } + public void setBoletoDiasVenc(Integer boletoDiasVenc) { + this.boletoDiasVenc = boletoDiasVenc; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((fechamentoparamgeralId == null) ? 0 : fechamentoparamgeralId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof FechamentoParamgeral)) + return false; + FechamentoParamgeral other = (FechamentoParamgeral) obj; + if (fechamentoparamgeralId == null) { + if (other.fechamentoparamgeralId != null) + return false; + } else if (!fechamentoparamgeralId.equals(other.fechamentoparamgeralId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java new file mode 100644 index 000000000..32bc8a2d9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java @@ -0,0 +1,142 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "FECHAMENTO_PARAMPTOVTA") +public class FechamentoParamptovta implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long fechamentoparamptovtaId; + private PuntoVenta puntoventa; + private Empresa empresa; + private Integer intervalofechamento; + private Date fecmodif; + private Integer usuarioId; + private Boolean activo; + private Integer diasemtransito; + + public FechamentoParamptovta() { + } + + public FechamentoParamptovta( PuntoVenta puntoventa, Empresa empresa, Integer usuarioId) { + this.puntoventa = puntoventa; + this.empresa = empresa; + + this.fecmodif = new Date(); + this.usuarioId = usuarioId; + this.activo = true; + } + + public FechamentoParamptovta( + PuntoVenta puntoventa, Empresa empresa, Integer intervalofechamento, + Date fecmodif, Integer usuarioId, Boolean activo) { + this.puntoventa = puntoventa; + this.empresa = empresa; + this.intervalofechamento = intervalofechamento; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.activo = activo; + } + + + @SequenceGenerator(name = "FECHAMENTO_PARAMPTOVTA_SEQ", sequenceName = "FECHAMENTO_PARAMPTOVTA_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_PARAMPTOVTA_SEQ") + @Column(name = "FECHAMENTOPARAMPTOVTA_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getFechamentoparamptovtaId() { + return this.fechamentoparamptovtaId; + } + + public void setFechamentoparamptovtaId(Long fechamentoparamptovtaId) { + this.fechamentoparamptovtaId = fechamentoparamptovtaId; + } + + public void setIntervalofechamento(Integer intervalofechamento) { + this.intervalofechamento = intervalofechamento; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Column(name = "INTERVALOFECHAMENTO", length = 2) + public Integer getIntervalofechamento() { + return intervalofechamento; + } + + @Column(name = "DIASEMTRANSITO", length = 2) + public Integer getDiasemtransito() { + return diasemtransito; + } + + public void setDiasemtransito(Integer diasemtransito) { + this.diasemtransito = diasemtransito; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("FechamentoParamptovta [fechamentoparamptovtaId=").append(fechamentoparamptovtaId).append(", puntoventa=").append(puntoventa).append(", empresa=").append(empresa).append(", intervalofechamento=").append(intervalofechamento).append(", fecmodif=").append(fecmodif).append(", usuarioId=").append(usuarioId).append(", activo=").append(activo).append(", diasemtransito=").append(diasemtransito).append("]"); + return builder.toString(); + } + + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Feriado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Feriado.java new file mode 100644 index 000000000..cc9ab0c86 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Feriado.java @@ -0,0 +1,158 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "FERIADO_SEQ", sequenceName = "FERIADO_SEQ", allocationSize = 1) +@Table(name = "FERIADO") +public class Feriado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "FERIADO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FERIADO_SEQ") + private Integer feriadoId; + @Column(name = "FECFERIADO") + @Temporal(TemporalType.DATE) + private Date fecferiado; + @Column(name = "DESCFERIADO") + private String descferiado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "ESTADO_ID") + private Estado estado; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + public Feriado(Integer feriadoId, Date fecferiado, String descferiado) { + super(); + this.feriadoId = feriadoId; + this.fecferiado = fecferiado; + this.descferiado = descferiado; + } + + public Feriado() { + } + + public Feriado(Integer feriadoId) { + this.feriadoId = feriadoId; + } + + public Integer getFeriadoId() { + return feriadoId; + } + + public void setFeriadoId(Integer feriadoId) { + this.feriadoId = feriadoId; + } + + public Date getFecferiado() { + return fecferiado; + } + + public void setFecferiado(Date fecferiado) { + this.fecferiado = fecferiado; + } + + public String getDescferiado() { + return descferiado; + } + + public void setDescferiado(String descferiado) { + this.descferiado = descferiado; + } + + public Date getFecmodif() { + return fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (feriadoId != null ? feriadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Feriado)) { + return false; + } + Feriado other = (Feriado) object; + if ((this.feriadoId == null && other.feriadoId != null) || (this.feriadoId != null && !this.feriadoId.equals(other.feriadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.descferiado; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalAliquotaEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalAliquotaEmpresa.java new file mode 100644 index 000000000..fdacd2443 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalAliquotaEmpresa.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "FISCAL_ALIQUOTA_EMP_SEQ", sequenceName = "FISCAL_ALIQUOTA_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_ALIQUOTA_EMPRESA") +public class FiscalAliquotaEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_ALIQUOTA_EMP_SEQ") + @Column(name = "FISCALALIQUOTAEMPRESA_ID") + private Integer fiscalAliquotaEmpresaId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @Column(name = "TOTALIZADOR") + private Integer totalizador; + @Column(name = "ICMS") + private BigDecimal icms; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getFiscalAliquotaEmpresaId() { + return fiscalAliquotaEmpresaId; + } + + public void setFiscalAliquotaEmpresaId(Integer fiscalAliquotaEmpresaId) { + this.fiscalAliquotaEmpresaId = fiscalAliquotaEmpresaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Integer getTotalizador() { + return totalizador; + } + + public void setTotalizador(Integer totalizador) { + this.totalizador = totalizador; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return fiscalAliquotaEmpresaId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (fiscalAliquotaEmpresaId != null ? fiscalAliquotaEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof FiscalAliquotaEmpresa)) { + return false; + } + FiscalAliquotaEmpresa other = (FiscalAliquotaEmpresa) object; + if ((this.fiscalAliquotaEmpresaId == null && other.fiscalAliquotaEmpresaId != null) || (this.fiscalAliquotaEmpresaId != null && !this.fiscalAliquotaEmpresaId.equals(other.fiscalAliquotaEmpresaId))) { + return false; + } + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalFormapagoEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalFormapagoEmpresa.java new file mode 100644 index 000000000..b525120ad --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalFormapagoEmpresa.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "FISCAL_FORMAPAGO_EMP_SEQ", sequenceName = "FISCAL_FORMAPAGO_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_FORMAPAGO_EMPRESA") +public class FiscalFormapagoEmpresa { + + @Id + @Basic(optional = false) + @Column(name = "FISCALFORMAPAGOEMPRESA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_FORMAPAGO_EMP_SEQ") + private Long fiscalformapagoempresaId; + @Column(name = "TIPOFORMAPAGO") + private String tipoformapago; + @Column(name = "DESCRICAO") + private String descricao; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + @Column(name = "INDVINCULADO") + private Boolean indVinculado; + + + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public FormaPago getFormaPago() { + return formaPago; + } + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + public Long getFiscalformapagoempresaId() { + return fiscalformapagoempresaId; + } + public void setFiscalformapagoempresaId(Long fiscalformapagoempresaId) { + this.fiscalformapagoempresaId = fiscalformapagoempresaId; + } + public String getTipoformapago() { + return tipoformapago; + } + public void setTipoformapago(String tipoformapago) { + this.tipoformapago = tipoformapago; + } + + public Boolean getIndVinculado() { + return indVinculado; + } + public void setIndVinculado(Boolean indVinculado) { + this.indVinculado = indVinculado; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((tipoformapago == null) ? 0 : tipoformapago.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalFormapagoEmpresa other = (FiscalFormapagoEmpresa) obj; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (tipoformapago == null) { + if (other.tipoformapago != null) + return false; + } else if (!tipoformapago.equals(other.tipoformapago)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressora.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressora.java new file mode 100644 index 000000000..1acf04c12 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressora.java @@ -0,0 +1,156 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "FISCAL_IMPRESSORA") +public class FiscalImpressora implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "FISCALIMPRESSORA_ID") + private Integer fiscalimpressoraId; + + @Column(name = "MARCA") + private String marca; + + @Column(name = "MODELO") + private String modelo; + + @Column(name = "VERSIONSB") + private String versionsb; + + @Column(name = "CNIEE") + private String cniee; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "NUMSERIE20") + private String numserie20; + + public FiscalImpressora() { + super(); + } + + public FiscalImpressora(Integer fiscalimpressoraId) { + this(); + setFiscalimpressoraId(fiscalimpressoraId); + } + + public Integer getFiscalimpressoraId() { + return fiscalimpressoraId; + } + + public void setFiscalimpressoraId(Integer fiscalimpressoraId) { + this.fiscalimpressoraId = fiscalimpressoraId; + } + + public String getMarca() { + return marca; + } + + public void setMarca(String marca) { + this.marca = marca; + } + + public String getModelo() { + return modelo; + } + + public void setModelo(String modelo) { + this.modelo = modelo; + } + + public String getVersionsb() { + return versionsb; + } + + public void setVersionsb(String versionsb) { + this.versionsb = versionsb; + } + + public String getCniee() { + return cniee; + } + + public void setCniee(String cniee) { + this.cniee = cniee; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((fiscalimpressoraId == null) ? 0 : fiscalimpressoraId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof FiscalImpressora)) + return false; + FiscalImpressora other = (FiscalImpressora) obj; + if (fiscalimpressoraId == null) { + if (other.fiscalimpressoraId != null) + return false; + } else if (!fiscalimpressoraId.equals(other.fiscalimpressoraId)) + return false; + return true; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalRelgerencialEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalRelgerencialEmpresa.java new file mode 100644 index 000000000..06c6eda0d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalRelgerencialEmpresa.java @@ -0,0 +1,114 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +@Entity +@SequenceGenerator(name = "FISCAL_RELGERENCIAL_EMP_SEQ", sequenceName = "FISCAL_RELGERENCIAL_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_RELGERENCIAL_EMPRESA") +public class FiscalRelgerencialEmpresa { + + @Id + @Basic(optional = false) + @Column(name = "FISCALRELGERENCIAL_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_RELGERENCIAL_EMP_SEQ") + private Long fiscalrelgerencialId; + @Column(name = "TIPORELGERENCIAL") + private String tiporelgerencial; + @Column(name = "DESCRICAO") + private String descricao; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getFiscalrelgerencialId() { + return fiscalrelgerencialId; + } + public void setFiscalrelgerencialId(Long relgerencialId) { + this.fiscalrelgerencialId = relgerencialId; + } + public String getTiporelgerencial() { + return tiporelgerencial; + } + public void setTiporelgerencial(String tiporelgerencial) { + this.tiporelgerencial = tiporelgerencial; + } + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((tiporelgerencial == null) ? 0 : tiporelgerencial.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalRelgerencialEmpresa other = (FiscalRelgerencialEmpresa) obj; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (tiporelgerencial == null) { + if (other.tiporelgerencial != null) + return false; + } else if (!tiporelgerencial.equals(other.tiporelgerencial)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalTotnaofiscalEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalTotnaofiscalEmpresa.java new file mode 100644 index 000000000..bae49059b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FiscalTotnaofiscalEmpresa.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +@Entity +@SequenceGenerator(name = "FISCAL_TOTNAOFISCAL_EMP_SEQ", sequenceName = "FISCAL_TOTNAOFISCAL_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_TOTNAOFISCAL_EMPRESA") +public class FiscalTotnaofiscalEmpresa { + + @Id + @Basic(optional = false) + @Column(name = "FISCALTOTNAOFISCAL_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_TOTNAOFISCAL_EMP_SEQ") + private Long fiscaltotnaofiscalId; + @Column(name = "TIPOTOTALIZADOR") + private String tipototalizador; + @Column(name = "DESCRICAO") + private String descricao; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoeventoextra; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + public String getTipototalizador() { + return tipototalizador; + } + public void setTipototalizador(String tipototalizador) { + this.tipototalizador = tipototalizador; + } + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public TipoEventoExtra getTipoeventoextra() { + return tipoeventoextra; + } + public void setTipoeventoextra(TipoEventoExtra tipoeventoextra) { + this.tipoeventoextra = tipoeventoextra; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Long getFiscaltotnaofiscalId() { + return fiscaltotnaofiscalId; + } + public void setFiscaltotnaofiscalId(Long fiscaltotnaofiscalId) { + this.fiscaltotnaofiscalId = fiscaltotnaofiscalId; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((tipototalizador == null) ? 0 : tipototalizador.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalTotnaofiscalEmpresa other = (FiscalTotnaofiscalEmpresa) obj; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (tipototalizador == null) { + if (other.tipototalizador != null) + return false; + } else if (!tipototalizador.equals(other.tipototalizador)) + return false; + return true; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FolioPreimpreso.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FolioPreimpreso.java new file mode 100644 index 000000000..43d73390e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FolioPreimpreso.java @@ -0,0 +1,181 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +@Entity +@SequenceGenerator(name = "FOLIO_PREIMPRESO_SEQ", sequenceName = "FOLIO_PREIMPRESO_SEQ", allocationSize = 1) +@Table(name = "FOLIO_PREIMPRESO") +public class FolioPreimpreso implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GenericGenerator(name = "FOLIO_PREIMPRESO_SEQ", strategy = "com.rjconsultores.ventaboletos.entidad.CustomIdGenerator" , + parameters = { + @Parameter(name="tamanho", value="8"), + @Parameter(name="seqName", value="FOLIO_PREIMPRESO_SEQ") + } ) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FOLIO_PREIMPRESO_SEQ") + @Column(name = "FOLIOPREIMPRESO_ID") + private Integer foliopreimpresoId; + @Column(name = "NUMESERIE") + private String numeserie; + @Column(name = "FOLIOPREIMPRESO") + private String foliopreimpreso; + @Column(name = "INDREPLICA") + private Long indreplica; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NODO_ID") + private Integer nodoId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + @ManyToOne + private Estacion estacion; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public Integer getFoliopreimpresoId() { + return foliopreimpresoId; + } + + public void setFoliopreimpresoId(Integer foliopreimpresoId) { + this.foliopreimpresoId = foliopreimpresoId; + } + + public String getNumeserie() { + return numeserie; + } + + public void setNumeserie(String numeserie) { + this.numeserie = numeserie; + } + + public String getFoliopreimpreso() { + return foliopreimpreso; + } + + public void setFoliopreimpreso(String foliopreimpreso) { + this.foliopreimpreso = foliopreimpreso; + } + + public Long getIndreplica() { + return indreplica; + } + + public void setIndreplica(Long indreplica) { + this.indreplica = indreplica; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getNodoId() { + return nodoId; + } + + public void setNodoId(Integer nodoId) { + this.nodoId = nodoId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((foliopreimpresoId == null) ? 0 : foliopreimpresoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FolioPreimpreso other = (FolioPreimpreso) obj; + if (foliopreimpresoId == null) { + if (other.foliopreimpresoId != null) + return false; + } else if (!foliopreimpresoId.equals(other.foliopreimpresoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.FolioPreimpreso [foliopreimpresoId=" + foliopreimpresoId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java new file mode 100644 index 000000000..b99c49519 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java @@ -0,0 +1,216 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "FORMA_PAGO_SEQ", sequenceName = "FORMA_PAGO_SEQ", allocationSize = 1) +@Table(name = "FORMA_PAGO") +public class FormaPago implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FORMA_PAGO_SEQ") + @Column(name = "FORMAPAGO_ID") + private Short formapagoId; + @Column(name = "DESCPAGO") + private String descpago; + @Column(name = "INDOPERACION") + private Short indoperacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "CVEPAGO") + private String cvePago; + @Column(name = "IMPFISCAL") + private Boolean impfiscal; + @OneToMany(mappedBy = "formaPago") + private List configRestriccionPagoList; + @OneToMany(mappedBy = "formaPago") + private List pricingFormapagoList; + @Column(name = "INDCONFERENCIAFISICACOMISSAO") + private Boolean indconferenciafisicacomissao; + + public FormaPago() { + super(); + } + + public FormaPago(Short formapagoId) { + this(); + this.formapagoId = formapagoId; + } + + public FormaPago(Short formapagoId, String descpago) { + this(); + this.formapagoId = formapagoId; + this.descpago = descpago; + } + + public Short getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Short formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Short getIndoperacion() { + return indoperacion; + } + + public void setIndoperacion(Short indoperacion) { + this.indoperacion = indoperacion; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public String getCvePago() { + return cvePago; + } + + public void setCvePago(String cvePago) { + this.cvePago = cvePago; + } + + public List getConfigRestriccionPagoList() { + List tmp = new ArrayList(); + if (configRestriccionPagoList != null) { + for (ConfigRestriccionPago crp : this.configRestriccionPagoList) { + if (crp.getActivo()) { + tmp.add(crp); + } + } + } + + return tmp; + } + + public void setConfigRestriccionPagoList(List configRestriccionPagoList) { + this.configRestriccionPagoList = configRestriccionPagoList; + } + + public List getPricingFormapagoList() { + List pfpgList = new ArrayList(); + if (pricingFormapagoList != null) { + for (PricingFormapago pfpg : this.pricingFormapagoList) { + if (pfpg.getActivo() == Pricing.ATIVO) { + pfpgList.add(pfpg); + } + } + } + return pfpgList; + } + + public void setPricingFormapagoList(List pricingFormapagoList) { + this.pricingFormapagoList = pricingFormapagoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (formapagoId != null ? formapagoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof FormaPago)) { + return false; + } + FormaPago other = (FormaPago) object; + if ((this.formapagoId == null && other.formapagoId != null) || (this.formapagoId != null && !this.formapagoId.equals(other.formapagoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescpago(); + } + + public Boolean getImpfiscal() { + return impfiscal; + } + + public void setImpfiscal(Boolean impfiscal) { + this.impfiscal = impfiscal; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java new file mode 100644 index 000000000..096bf0e50 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java @@ -0,0 +1,164 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "FORMA_PAGO_DET_SEQ", sequenceName = "FORMA_PAGO_DET_SEQ", allocationSize = 1) +@Table(name = "FORMA_PAGO_DET") +public class FormaPagoDet implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "FORMAPAGODET_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FORMA_PAGO_DET_SEQ") + private Integer formapagodetId; + @Column(name = "CARGOSEXTRAS") + private BigDecimal cargosextras; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + + @OneToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + public FormaPagoDet() { + } + + public FormaPagoDet(Integer formapagodetId) { + this.formapagodetId = formapagodetId; + } + + public FormaPagoDet(Integer formapagodetId, Date fecmodif) { + this.formapagodetId = formapagodetId; + this.fecmodif = fecmodif; + } + + public Integer getFormapagodetId() { + return formapagodetId; + } + + public void setFormapagodetId(Integer formapagodetId) { + this.formapagodetId = formapagodetId; + } + + public BigDecimal getCargosextras() { + return cargosextras; + } + + public void setCargosextras(BigDecimal cargosextras) { + this.cargosextras = cargosextras; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (formapagodetId != null ? formapagodetId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof FormaPagoDet)) { + return false; + } + FormaPagoDet other = (FormaPagoDet) object; + if ((this.formapagodetId == null && other.formapagodetId != null) || (this.formapagodetId != null && !this.formapagodetId.equals(other.formapagodetId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.FormaPagoDet[formapagodetId=" + formapagodetId + "]"; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FuncionSistema.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FuncionSistema.java new file mode 100644 index 000000000..580c0e0bb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/FuncionSistema.java @@ -0,0 +1,151 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "FUNCION_SISTEMA") +@SequenceGenerator(name = "FUNCION_SISTEMA_SEQ", sequenceName = "FUNCION_SISTEMA_SEQ", allocationSize = 1) +public class FuncionSistema implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "FUNCIONSISTEMA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FUNCION_SISTEMA_SEQ") + private Integer funcionsistemaId; + @Column(name = "NOMBFUNCION") + private String nombfuncion; + @Column(name = "DESCRUTA") + private String descruta; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "funcionSistema") + private List perfilFuncionList; + @JoinColumn(name = "SISTEMA_ID", referencedColumnName = "SISTEMA_ID") + @ManyToOne + private Sistema sistema; + + public FuncionSistema() { + } + + public FuncionSistema(Integer funcionsistemaId) { + this.funcionsistemaId = funcionsistemaId; + } + + public Integer getFuncionsistemaId() { + return funcionsistemaId; + } + + public void setFuncionsistemaId(Integer funcionsistemaId) { + this.funcionsistemaId = funcionsistemaId; + } + + public String getNombfuncion() { + return nombfuncion; + } + + public void setNombfuncion(String nombfuncion) { + this.nombfuncion = nombfuncion; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPerfilFuncionList() { + return perfilFuncionList; + } + + public void setPerfilFuncionList(List perfilFuncionList) { + this.perfilFuncionList = perfilFuncionList; + } + + public Sistema getSistema() { + return sistema; + } + + public void setSistema(Sistema sistema) { + this.sistema = sistema; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (funcionsistemaId != null ? funcionsistemaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof FuncionSistema)) { + return false; + } + FuncionSistema other = (FuncionSistema) object; + if ((this.funcionsistemaId == null && other.funcionsistemaId != null) || (this.funcionsistemaId != null && !this.funcionsistemaId.equals(other.funcionsistemaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombfuncion(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoCategoria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoCategoria.java new file mode 100644 index 000000000..219cba717 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoCategoria.java @@ -0,0 +1,101 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "GRUPO_CATEGORIA_SEQ", sequenceName = "GRUPO_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "GRUPO_CATEGORIA") +public class GrupoCategoria { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_CATEGORIA_SEQ") + @Column(name = "GRUPOCATEGORIA_ID") + private Integer grupoCategoriaId; + @Column(name = "DESCGRUPO") + private String descGrupo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Override + public int hashCode() { + int hash = 0; + hash += (grupoCategoriaId != null ? grupoCategoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof Categoria)) { + return false; + } + GrupoCategoria other = (GrupoCategoria) object; + if ((this.grupoCategoriaId == null && other.grupoCategoriaId != null) || (this.grupoCategoriaId != null && !this.grupoCategoriaId.equals(other.grupoCategoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescGrupo(); + } + + public Integer getGrupoCategoriaId() { + return grupoCategoriaId; + } + + public void setGrupoCategoriaId(Integer grupoCategoriaId) { + this.grupoCategoriaId = grupoCategoriaId; + } + + public String getDescGrupo() { + return descGrupo; + } + + public void setDescGrupo(String descGrupo) { + this.descGrupo = descGrupo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoCortesia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoCortesia.java new file mode 100644 index 000000000..6b4a589a5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoCortesia.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "GRUPO_CORTESIA_SEQ", sequenceName = "GRUPO_CORTESIA_SEQ", allocationSize = 1) +@Table(name = "GRUPO_CORTESIA") +public class GrupoCortesia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_CORTESIA_SEQ") + @Column(name = "GRUPOCORTESIA_ID") + private Short grupocortesiaId; + @Column(name = "DESCGRUPO") + private String descgrupo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "grupoCortesia") + private List tipoCortesiaList; + + public GrupoCortesia() { + } + + public GrupoCortesia(Short grupocortesiaId) { + this.grupocortesiaId = grupocortesiaId; + } + + public Short getGrupocortesiaId() { + return grupocortesiaId; + } + + public void setGrupocortesiaId(Short grupocortesiaId) { + this.grupocortesiaId = grupocortesiaId; + } + + public String getDescgrupo() { + return descgrupo; + } + + public void setDescgrupo(String descgrupo) { + this.descgrupo = descgrupo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTipoCortesiaList() { + return tipoCortesiaList; + } + + public void setTipoCortesiaList(List tipoCortesiaList) { + this.tipoCortesiaList = tipoCortesiaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (grupocortesiaId != null ? grupocortesiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof GrupoCortesia)) { + return false; + } + GrupoCortesia other = (GrupoCortesia) object; + if ((this.grupocortesiaId == null && other.grupocortesiaId != null) || (this.grupocortesiaId != null && !this.grupocortesiaId.equals(other.grupocortesiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescgrupo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoRuta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoRuta.java new file mode 100644 index 000000000..4b9e0dd45 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/GrupoRuta.java @@ -0,0 +1,131 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Entity +@SequenceGenerator(name = "GRUPO_RUTA_SEQ", sequenceName = "GRUPO_RUTA_SEQ", allocationSize = 1) +@Table(name = "GRUPO_RUTA") +public class GrupoRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_RUTA_SEQ") + @Column(name = "GRUPORUTA_ID") + private Integer grupoRutaId; + @Column(name = "DESCGRUPO") + private String descgrupo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public GrupoRuta() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + /** + * @return the grupoRutaId + */ + public Integer getGrupoRutaId() { + return grupoRutaId; + } + + /** + * @param grupoRutaId + * the grupoRutaId to set + */ + public void setGrupoRutaId(Integer grupoRutaId) { + this.grupoRutaId = grupoRutaId; + } + + /** + * @return the descGrupo + */ + public String getDescGrupo() { + return descgrupo; + } + + /** + * @param descGrupo + * the descGrupo to set + */ + public void setDescGrupo(String descgrupo) { + this.descgrupo = descgrupo; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final GrupoRuta other = (GrupoRuta) obj; + if (!this.getGrupoRutaId().equals(other.getGrupoRutaId())) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + (this.getGrupoRutaId() != null ? this.getGrupoRutaId().hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return this.getDescGrupo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Hotel.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Hotel.java new file mode 100644 index 000000000..b1fd4b9ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Hotel.java @@ -0,0 +1,199 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "HOTEL") +@SequenceGenerator(name = "HOTEL_SEQ", sequenceName = "HOTEL_SEQ", allocationSize = 1) +public class Hotel implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "HOTEL_SEQ") + @Column(name = "HOTEL_ID") + private Long hotelId; + + @Column(name = "DESCHOTEL") + private String deschotel; + + @Column(name = "CEP") + private String cep; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "NUMERO") + private String numero; + + @Column(name = "COMPLEMENTO") + private String complemento; + + @Column(name = "BAIRRO") + private String bairro; + + @Column(name = "CIDADE") + private String cidade; + + @Column(name = "ESTADO") + private String estado; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "DESCTELEFONE") + private String desctelefone; + + public Long getHotelId() { + return hotelId; + } + + public void setHotelId(Long hotelId) { + this.hotelId = hotelId; + } + + public String getDeschotel() { + return deschotel; + } + + public void setDeschotel(String deschotel) { + this.deschotel = deschotel; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getDeschotel(); + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((hotelId == null) ? 0 : hotelId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + Hotel other = (Hotel) obj; + if (hotelId == null) { + if (other.hotelId != null) + return false; + } else if (!hotelId.equals(other.hotelId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/InscricaoEstadual.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/InscricaoEstadual.java new file mode 100644 index 000000000..6088346a4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/InscricaoEstadual.java @@ -0,0 +1,208 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "INSCRICAO_ESTADUAL") +public class InscricaoEstadual { + private Long inscricaoestadualId; + + private Empresa empresa; + private Estado estado; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private String numInscricaoEstadual; + private String logradouro; + private String numero; + private String complemento; + private String cep; + private String bairro; + private Ciudad cidade; + private String cnpj; + + public InscricaoEstadual() { + // TODO Auto-generated constructor stub + } + + public InscricaoEstadual(String inscricaoEstadual, Empresa empresa, Estado estado, Integer usuarioId, + String logradouro, String numero, String complemento, String cep, String bairro, Ciudad cidade, String cnpj) { + super(); + this.numInscricaoEstadual = inscricaoEstadual; + this.empresa = empresa; + this.estado = estado; + this.fecmodif = new Date(); + this.activo = true; + this.usuarioId = usuarioId; + this.logradouro = logradouro; + this.numero=numero; + this.complemento=complemento; + this.cep=cep; + this.bairro=bairro; + this.cidade=cidade; + this.cnpj=cnpj; + } + + @SequenceGenerator(name = "INSCRICAO_ESTADUAL_SEQ", sequenceName = "INSCRICAO_ESTADUAL_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "INSCRICAO_ESTADUAL_SEQ") + @Column(name = "INSCRICAOESTADUAL_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getInscricaoestadualId() { + return inscricaoestadualId; + } + + public void setInscricaoestadualId(Long inscricaoestadualId) { + this.inscricaoestadualId = inscricaoestadualId; + } + + @Column(name = "NUMINSCRICAOESTADUAL", length = 20) + public String getNumInscricaoEstadual() { + return numInscricaoEstadual; + } + + public void setNumInscricaoEstadual(String inscricaoEstadual) { + this.numInscricaoEstadual = inscricaoEstadual; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @JoinColumn(name = "ESTADO_ID") + @ManyToOne + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + @Column(name = "LOGRADOURO") + public String getLogradouro() { + return logradouro; + } + + public void setLogradouro(String logradouro) { + this.logradouro = logradouro; + } + + @Column(name = "NUMERO") + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + @Column(name = "COMPLEMENTO") + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + @Column(name = "CEP") + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + @Column(name = "BAIRRO") + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + @OneToOne(cascade = CascadeType.MERGE) + @JoinColumn(name = "CIUDAD_ID") + public Ciudad getCidade() { + return cidade; + } + + public void setCidade(Ciudad cidade) { + this.cidade = cidade; + } + + @Column(name = "CNPJ") + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EmpresaImposto)) { + return false; + } + InscricaoEstadual other = (InscricaoEstadual) object; + if ((this.inscricaoestadualId == null && other.inscricaoestadualId != null) || (this.inscricaoestadualId != null && !this.inscricaoestadualId.equals(other.inscricaoestadualId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return String.format("%s-%s", estado.getCveestado(), numInscricaoEstadual); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/InstiFinanceira.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/InstiFinanceira.java new file mode 100644 index 000000000..18b140162 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/InstiFinanceira.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "INSTI_FINANCEIRA_SEQ", sequenceName = "INSTI_FINANCEIRA_SEQ", allocationSize = 1) +@Table(name = "INSTI_FINANCEIRA") + +public class InstiFinanceira implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "INSTI_FINANCEIRA_SEQ") + @Column(name = "INSTIFINANCEIRA_ID") + private Integer instFinanceiraId; + + @Column(name = "NOME") + private String nome; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "CODIGO") + private String codigo; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "instiFinanceiraId") + private List ptovtaAgenciaList; + + public InstiFinanceira() { + } + + public InstiFinanceira(Integer instFinanceiraId) { + this.instFinanceiraId = instFinanceiraId; + } + + public InstiFinanceira(Integer instFinanceiraId, String codigo, String nome, Boolean activo, Date fecmodif, int usuarioId) { + this.instFinanceiraId = instFinanceiraId; + this.codigo = codigo; + this.nome = nome; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getInstFinanceiraId() { + return instFinanceiraId; + } + + public void setInstFinanceiraId(Integer instFinanceiraId) { + this.instFinanceiraId = instFinanceiraId; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPtovtaAgenciaList() { + return ptovtaAgenciaList; + } + + public void setPtovtaAgenciaList(List ptovtaAgenciaList) { + this.ptovtaAgenciaList = ptovtaAgenciaList; + } + + public String getCodigo() { + return codigo; + } + + public void setCodigo(String codigo) { + this.codigo = codigo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (instFinanceiraId != null ? instFinanceiraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof InstiFinanceira)) { + return false; + } + InstiFinanceira other = (InstiFinanceira) object; + if ((this.instFinanceiraId == null && other.instFinanceiraId != null) || (this.instFinanceiraId != null && !this.instFinanceiraId.equals(other.instFinanceiraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.nome; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ItemAdicional.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ItemAdicional.java new file mode 100644 index 000000000..28e80731a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ItemAdicional.java @@ -0,0 +1,136 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "ITEM_ADICIONAL") +@SequenceGenerator(name = "ITEM_ADICIONAL_SEQ", sequenceName = "ITEM_ADICIONAL_SEQ", allocationSize = 1) +public class ItemAdicional implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ITEM_ADICIONAL_SEQ") + @Column(name = "ITEMADICIONAL_ID") + private Integer itemadicionalId; + @Column(name = "DESCITEMADICIONAL") + private String descitemadicional; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToMany + @JoinTable(name = "PACOTE_ITEM", joinColumns = { @JoinColumn(name = "ITEMADICIONAL_ID") }, + inverseJoinColumns = { @JoinColumn(name = "PACOTE_ID") }) + private List pacoteList; + + public ItemAdicional() { + } + + public ItemAdicional(Integer itemadicionalId, String descitemadicional, Boolean activo, Date fecmodif, Integer usuarioId) { + super(); + this.itemadicionalId = itemadicionalId; + this.descitemadicional = descitemadicional; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getItemadicionalId() { + return itemadicionalId; + } + + public void setItemadicionalId(Integer itemadicionalId) { + this.itemadicionalId = itemadicionalId; + } + + public String getDescitemadicional() { + return descitemadicional; + } + + public void setDescitemadicional(String descitemadicional) { + this.descitemadicional = descitemadicional; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPacoteList() { + return pacoteList; + } + + public void setPacoteList(List pacoteList) { + this.pacoteList = pacoteList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((itemadicionalId == null) ? 0 : itemadicionalId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ItemAdicional other = (ItemAdicional) obj; + if (itemadicionalId == null) { + if (other.itemadicionalId != null) + return false; + } else if (!itemadicionalId.equals(other.itemadicionalId)) + return false; + return true; + } + + @Override + public String toString() { + return this.getDescitemadicional() + " - " + this.getItemadicionalId(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ItemDesconto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ItemDesconto.java new file mode 100644 index 000000000..2b40a3059 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ItemDesconto.java @@ -0,0 +1,101 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.text.NumberFormat; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "ITEM_DESCONTO_SEQ", sequenceName = "ITEM_DESCONTO_SEQ", allocationSize = 1) +@Table(name = "ITEM_DESCONTO") +public class ItemDesconto implements Serializable { + + private static final long serialVersionUID = 1L; + + private static NumberFormat NF = NumberFormat.getInstance(); + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ITEM_DESCONTO_SEQ") + @Column(name = "ITEMDESCONTO_ID") + private Long itemdescontoId; + + @Column(name = "NOMITEMDESCONTO") + private String nomitemdesconto; + + @Column(name = "PRECO") + private BigDecimal preco; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getItemdescontoId() { + return itemdescontoId; + } + + public void setItemdescontoId(Long itemdescontoId) { + this.itemdescontoId = itemdescontoId; + } + + public String getNomitemdesconto() { + return nomitemdesconto; + } + + public void setNomitemdesconto(String nomitemdesconto) { + this.nomitemdesconto = nomitemdesconto; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + NF.setMinimumFractionDigits(2); + return this.getNomitemdesconto() + " - " + NF.format(this.getPreco()); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/LogConferencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/LogConferencia.java new file mode 100644 index 000000000..b2fffe958 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/LogConferencia.java @@ -0,0 +1,219 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.enums.comissao.TipoLogConferencia; + +@Entity +@Table(name = "LOG_CONFERENCIA") +@SequenceGenerator(name = "LOG_CONFERENCIA_SEQ", sequenceName = "LOG_CONFERENCIA_SEQ", allocationSize = 1) +public class LogConferencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "LOG_CONFERENCIA_SEQ") + @Column(name = "LOGCONFERENCIA_ID") + private Long logconferenciaId; + + @Column(name = "OBSERVACAO") + private String observacao; + + @Column(name = "PRECO") + private BigDecimal preco; + + @Column(name = "ACTIVO") + private boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "BOLETO_ID") + private Long boletoId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONFERENCIA_ID") + private Conferencia conferencia; + + @Enumerated(EnumType.ORDINAL) + @Column(name = "STATUS") + private StatusLogConferencia status; + + @Column(name = "EVENTOEXTRA_ID") + private Long eventoextraId; + + @Column(name = "OCD_ID") + private Long ocdId; + + @Enumerated(EnumType.ORDINAL) + @Column(name = "TIPO") + private TipoLogConferencia tipo; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONTACORRENTEPTOVTA_ID") + private ContaCorrentePtoVta contaCorrentePtoVta; + + @Column(name = "INDCREDITO") + private boolean indcredito; + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public String getObservacao() { + return observacao; + } + + public void setObservacao(String observacao) { + this.observacao = observacao; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Conferencia getConferencia() { + return conferencia; + } + + public void setConferencia(Conferencia conferencia) { + this.conferencia = conferencia; + } + + public StatusLogConferencia getStatus() { + return status; + } + + public void setStatus(StatusLogConferencia status) { + this.status = status; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((logconferenciaId == null) ? 0 : logconferenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + LogConferencia other = (LogConferencia) obj; + if (logconferenciaId == null) { + if (other.logconferenciaId != null) + return false; + } else if (!logconferenciaId.equals(other.logconferenciaId)) + return false; + return true; + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Long getOcdId() { + return ocdId; + } + + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + public TipoLogConferencia getTipo() { + return tipo; + } + + public void setTipo(TipoLogConferencia tipo) { + this.tipo = tipo; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public ContaCorrentePtoVta getContaCorrentePtoVta() { + return contaCorrentePtoVta; + } + + public void setContaCorrentePtoVta(ContaCorrentePtoVta contaCorrentePtoVta) { + this.contaCorrentePtoVta = contaCorrentePtoVta; + } + + public boolean isIndcredito() { + return indcredito; + } + + public void setIndcredito(boolean indcredito) { + this.indcredito = indcredito; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Marca.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Marca.java new file mode 100644 index 000000000..59f8726ae --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Marca.java @@ -0,0 +1,247 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "MARCA_SEQ", sequenceName = "MARCA_SEQ", allocationSize = 1) +@Table(name = "MARCA") +public class Marca implements Serializable { + + public final static short TODOS = -1; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MARCA_SEQ") + @Column(name = "MARCA_ID") + private Short marcaId; + @Column(name = "DESCMARCA") + private String descmarca; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Lob + @Column(name = "LOGOTIPOMARCA") + private byte[] logotipomarca; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List categoriaMarcaList; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List reservacionMarcaList; + @OneToMany(mappedBy = "marca") + private List cancelacionCtrlList; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List tarifaHistList; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List corridaList; + + public Marca() { + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Marca(Short marcaId) { + this.marcaId = marcaId; + } + + public Marca(Short marcaId, Date fecmodif) { + this.marcaId = marcaId; + this.fecmodif = fecmodif; + } + + public Marca(Short marcaId, String descMarca) { + this.marcaId = marcaId; + this.descmarca = descMarca; + } + + public Marca(Short marcaId, String descMarca, Integer usuarioId , Date fecmodif) { + this.marcaId = marcaId; + this.descmarca = descMarca; + this.usuarioId = usuarioId; + this.fecmodif = fecmodif; + } + + public Short getMarcaId() { + return marcaId; + } + + public void setMarcaId(Short marcaId) { + this.marcaId = marcaId; + } + + public String getDescmarca() { + return descmarca; + } + + public void setDescmarca(String descmarca) { + this.descmarca = descmarca; + } + + public byte[] getLogotipomarca() { + return logotipomarca; + } + + public void setLogotipomarca(byte[] logotipomarca) { + this.logotipomarca = logotipomarca; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCategoriaMarcaList() { + List tmp = new ArrayList(); + if (categoriaMarcaList != null) { + for (CategoriaMarca cm : this.categoriaMarcaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaMarcaList(List categoriaMarcaList) { + this.categoriaMarcaList = categoriaMarcaList; + } + + public List getReservacionMarcaList() { + List tmp = new ArrayList(); + for (ReservacionMarca rm : this.reservacionMarcaList) { + if (rm.getActivo()) { + tmp.add(rm); + } + } + + return tmp; + } + + public void setReservacionMarcaList(List reservacionMarcaList) { + this.reservacionMarcaList = reservacionMarcaList; + } + + public List getCancelacionCtrlList() { + return cancelacionCtrlList; + } + + public void setCancelacionCtrlList(List cancelacionCtrlList) { + this.cancelacionCtrlList = cancelacionCtrlList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (marcaId != null ? marcaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Marca)) { + return false; + } + Marca other = (Marca) object; + if ((this.marcaId == null && other.marcaId != null) || (this.marcaId != null && !this.marcaId.equals(other.marcaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescmarca(); + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java new file mode 100644 index 000000000..ba08b7d71 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MARCA_AUTOBUS_SEQ", sequenceName = "MARCA_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "MARCA_AUTOBUS") +public class MarcaAutobus implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MARCA_AUTOBUS_SEQ") + @Column(name = "MARCAAUTOBUS_ID") + private Long marcaAutobusId; + @Column(name = "DESCMARCA") + private String descmarca; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getMarcaAutobusId() { + return marcaAutobusId; + } + public void setMarcaAutobusId(Long marcaAutobusId) { + this.marcaAutobusId = marcaAutobusId; + } + public String getDescmarca() { + return descmarca; + } + public void setDescmarca(String descmarca) { + this.descmarca = descmarca; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString(){ + return this.descmarca; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MarcaAutobus)) { + return false; + } + MarcaAutobus other = (MarcaAutobus) object; + if ((this.marcaAutobusId == null && other.marcaAutobusId != null) || (this.marcaAutobusId != null && !this.marcaAutobusId.equals(other.marcaAutobusId))) { + return false; + } + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicio.java new file mode 100644 index 000000000..c10952ad4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicio.java @@ -0,0 +1,94 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "MARCA_CLASESERVICIO") +public class MarcaClaseServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @EmbeddedId + protected MarcaClaseServicioPK marcaClaseservicioPK; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public MarcaClaseServicio() { + } + + public MarcaClaseServicioPK getMarcaClaseservicioPK() { + return marcaClaseservicioPK; + } + + public void setMarcaClaseservicioPK(MarcaClaseServicioPK marcaClaseservicioPK) { + this.marcaClaseservicioPK = marcaClaseservicioPK; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (marcaClaseservicioPK != null ? marcaClaseservicioPK.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MarcaClaseServicio)) { + return false; + } + MarcaClaseServicio other = (MarcaClaseServicio) object; + if ((this.marcaClaseservicioPK == null && other.marcaClaseservicioPK != null) || (this.marcaClaseservicioPK != null && !this.marcaClaseservicioPK.equals(other.marcaClaseservicioPK))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MarcaClaseservicio[marcaClaseservicioPK=" + marcaClaseservicioPK + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicioPK.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicioPK.java new file mode 100644 index 000000000..602e495a0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicioPK.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import javax.persistence.Basic; +import javax.persistence.Embeddable; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; + +/** + * + * @author Administrador + */ +@Embeddable +public class MarcaClaseServicioPK implements Serializable { + + private static final long serialVersionUID = 1L; + @Basic(optional = false) + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseservicio; + @Basic(optional = false) + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + + public MarcaClaseServicioPK() { + } + + public ClaseServicio getClaseservicio() { + return claseservicio; + } + + public void setClaseservicio(ClaseServicio claseservicio) { + this.claseservicio = claseservicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MercadoCompetido.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MercadoCompetido.java new file mode 100644 index 000000000..832dcdb0d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MercadoCompetido.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "MERCADO_COMPETIDO_SEQ", sequenceName = "MERCADO_COMPETIDO_SEQ", allocationSize = 1) +@Table(name = "MERCADO_COMPETIDO") +public class MercadoCompetido implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MERCADO_COMPETIDO_SEQ") + @Basic(optional = false) + @Column(name = "MERCADOCOMPETIDO_ID") + private Integer mercadocompetidoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public MercadoCompetido() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getMercadocompetidoId() { + return mercadocompetidoId; + } + + public void setMercadocompetidoId(Integer mercadocompetidoId) { + this.mercadocompetidoId = mercadocompetidoId; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mercadocompetidoId != null ? mercadocompetidoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MercadoCompetido)) { + return false; + } + MercadoCompetido other = (MercadoCompetido) object; + if ((this.mercadocompetidoId == null && other.mercadocompetidoId != null) || (this.mercadocompetidoId != null && !this.mercadocompetidoId.equals(other.mercadocompetidoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "newpackage.MercadoCompetido[mercadocompetidoId=" + mercadocompetidoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MerchantBancario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MerchantBancario.java new file mode 100644 index 000000000..4bf33934d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MerchantBancario.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MERCHANT_BANCARIO_SEQ", sequenceName = "MERCHANT_BANCARIO_SEQ", allocationSize = 1) +@Table(name = "MERCHANT_BANCARIO") +public class MerchantBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MERCHANT_BANCARIO_SEQ") + @Column(name = "MERCHANTBANCARIO_ID") + private Integer merchantbancarioId; + @Column(name = "CVEMERCHANT") + private String cvemerchant; + @Column(name = "DESCMERCHANT") + private String descmerchant; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @JoinColumn(name = "COMPANIABANCARIA_ID", referencedColumnName = "COMPANIABANCARIA_ID") + @ManyToOne(optional = false) + private CompaniaBancaria companiaBancaria; + + public MerchantBancario() { + } + + public MerchantBancario(Integer merchantbancarioId) { + this.merchantbancarioId = merchantbancarioId; + } + + public MerchantBancario(Integer merchantbancarioId, Boolean activo) { + this.merchantbancarioId = merchantbancarioId; + this.activo = activo; + } + + public Integer getMerchantbancarioId() { + return merchantbancarioId; + } + + public void setMerchantbancarioId(Integer merchantbancarioId) { + this.merchantbancarioId = merchantbancarioId; + } + + public String getCvemerchant() { + return cvemerchant; + } + + public void setCvemerchant(String cvemerchant) { + this.cvemerchant = cvemerchant; + } + + public String getDescmerchant() { + return descmerchant; + } + + public void setDescmerchant(String descmerchant) { + this.descmerchant = descmerchant; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public CompaniaBancaria getCompaniaBancaria() { + return companiaBancaria; + } + + public void setCompaniaBancaria(CompaniaBancaria companiaBancaria) { + this.companiaBancaria = companiaBancaria; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final MerchantBancario other = (MerchantBancario) obj; + if ((this.cvemerchant == null) ? (other.cvemerchant != null) : !this.cvemerchant.equals(other.cvemerchant)) { + return false; + } + if ((this.descmerchant == null) ? (other.descmerchant != null) : !this.descmerchant.equals(other.descmerchant)) { + return false; + } + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 53 * hash + (this.cvemerchant != null ? this.cvemerchant.hashCode() : 0); + hash = 53 * hash + (this.descmerchant != null ? this.descmerchant.hashCode() : 0); + hash = 53 * hash + (this.activo != null ? this.activo.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MerchantBancario[merchantbancarioId=" + merchantbancarioId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Moneda.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Moneda.java new file mode 100644 index 000000000..f46e597e3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Moneda.java @@ -0,0 +1,149 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MONEDA_SEQ", sequenceName = "MONEDA_SEQ", allocationSize = 1) +@Table(name = "MONEDA") +public class Moneda implements Serializable { + + public final static Integer MONEDA_REAL_ID = 1; + @OneToMany(mappedBy = "moneda") + private List tarifaHistList; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MONEDA_SEQ") + @Column(name = "MONEDA_ID") + private Integer monedaId; + @Column(name = "DESCMONEDA") + private String descmoneda; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "moneda") + private List puntoVentaList; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + + public Moneda() { + } + + public Moneda(Integer monedaId) { + this.monedaId = monedaId; + } + + public Integer getMonedaId() { + return monedaId; + } + + public void setMonedaId(Integer monedaId) { + this.monedaId = monedaId; + } + + public String getDescmoneda() { + return descmoneda; + } + + public void setDescmoneda(String descmoneda) { + this.descmoneda = descmoneda; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (monedaId != null ? monedaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Moneda)) { + return false; + } + Moneda other = (Moneda) object; + if ((this.monedaId == null && other.monedaId != null) || (this.monedaId != null && !this.monedaId.equals(other.monedaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescmoneda(); + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelacion.java new file mode 100644 index 000000000..3f0c437be --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelacion.java @@ -0,0 +1,136 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MOTIVO_CANCELACION_SEQ", sequenceName = "MOTIVO_CANCELACION_SEQ", allocationSize = 1) +@Table(name = "MOTIVO_CANCELACION") +public class MotivoCancelacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_CANCELACION_SEQ") + @Column(name = "MOTIVOCANCELACION_ID") + private Integer motivocancelacionId; + @Column(name = "DESCMOTIVO") + private String descmotivo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIPOMOTIVO") + private String tipomotivo; + @Column(name = "TXTRELATORIO") + private String txtRelatorio; + + public MotivoCancelacion() { + } + + public MotivoCancelacion(Integer motivocancelacionId) { + this.motivocancelacionId = motivocancelacionId; + } + + public Integer getMotivocancelacionId() { + return motivocancelacionId; + } + + public void setMotivocancelacionId(Integer motivocancelacionId) { + this.motivocancelacionId = motivocancelacionId; + } + + public String getDescmotivo() { + return descmotivo; + } + + public void setDescmotivo(String descmotivo) { + this.descmotivo = descmotivo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getTipomotivo() { + return tipomotivo; + } + + public void setTipomotivo(String tipomotivo) { + this.tipomotivo = tipomotivo; + } + + public String getTxtRelatorio() { + return txtRelatorio; + } + + public void setTxtRelatorio(String txtRelatorio) { + this.txtRelatorio = txtRelatorio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivocancelacionId != null ? motivocancelacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivoCancelacion)) { + return false; + } + MotivoCancelacion other = (MotivoCancelacion) object; + if ((this.motivocancelacionId == null && other.motivocancelacionId != null) || (this.motivocancelacionId != null && !this.motivocancelacionId.equals(other.motivocancelacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescmotivo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoReimpresion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoReimpresion.java new file mode 100644 index 000000000..18347ba7d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoReimpresion.java @@ -0,0 +1,122 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MOTIVO_REIMPRESION_SEQ", sequenceName = "MOTIVO_REIMPRESION_SEQ", allocationSize=1) +@Table(name = "MOTIVO_REIMPRESION") +public class MotivoReimpresion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_REIMPRESION_SEQ") + @Column(name = "MOTIVOREIMPRESION_ID") + private Integer motivoreimpresionId; + @Column(name = "DESCMOTIVO") + private String descmotivo; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public MotivoReimpresion() { + } + + public MotivoReimpresion(Integer motivoreimpresionId) { + this.motivoreimpresionId = motivoreimpresionId; + } + + public MotivoReimpresion(Integer motivoreimpresionId, Date fecmodif) { + this.motivoreimpresionId = motivoreimpresionId; + this.fecmodif = fecmodif; + } + + public Integer getMotivoreimpresionId() { + return motivoreimpresionId; + } + + public void setMotivoreimpresionId(Integer motivoreimpresionId) { + this.motivoreimpresionId = motivoreimpresionId; + } + + public String getDescmotivo() { + return descmotivo; + } + + public void setDescmotivo(String descmotivo) { + this.descmotivo = descmotivo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivoreimpresionId != null ? motivoreimpresionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivoReimpresion)) { + return false; + } + MotivoReimpresion other = (MotivoReimpresion) object; + if ((this.motivoreimpresionId == null && other.motivoreimpresionId != null) || (this.motivoreimpresionId != null && !this.motivoreimpresionId.equals(other.motivoreimpresionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MotivoReimpresion[motivoreimpresionId=" + motivoreimpresionId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoViaje.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoViaje.java new file mode 100644 index 000000000..db7d21459 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivoViaje.java @@ -0,0 +1,132 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "MOTIVO_VIAJE_SEQ", sequenceName = "MOTIVO_VIAJE_SEQ", allocationSize = 1) +@Table(name = "MOTIVO_VIAJE") +public class MotivoViaje implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_VIAJE_SEQ") + @Column(name = "MOTIVOVIAJE_ID") + private Integer motivoViajeId; + @Column(name = "CVEMOTIVOVIAJE") + private String cveMotivoViaje; + @Column(name = "DESCMOTIVOVIAJE") + private String descMotivoViaje; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "motivoViaje") + private List cortesiaList; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public List getCortesiaList() { + return cortesiaList; + } + + public void setCortesiaList(List cortesiaList) { + this.cortesiaList = cortesiaList; + } + + public String getCveMotivoViaje() { + return cveMotivoViaje; + } + + public void setCveMotivoViaje(String cveMotivoViaje) { + this.cveMotivoViaje = cveMotivoViaje; + } + + public String getDescMotivoViaje() { + return descMotivoViaje; + } + + public void setDescMotivoViaje(String descMotivoViaje) { + this.descMotivoViaje = descMotivoViaje; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getMotivoViajeId() { + return motivoViajeId; + } + + public void setMotivoViajeId(Integer motivoViajeId) { + this.motivoViajeId = motivoViajeId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivoViajeId != null ? motivoViajeId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivoViaje)) { + return false; + } + MotivoViaje other = (MotivoViaje) object; + if ((this.motivoViajeId == null && other.motivoViajeId != null) || (this.motivoViajeId != null && !this.motivoViajeId.equals(other.motivoViajeId))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.GrupoCortesias[grupocortesiaId=" + grupocortesiaId + "]"; + return this.getDescMotivoViaje(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivocancelacionEquivalencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivocancelacionEquivalencia.java new file mode 100644 index 000000000..0ecf7665f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/MotivocancelacionEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "MOTIVOCANC_EQUIVALENCIA_SEQ", sequenceName = "MOTIVOCANC_EQUIVALENCIA_SEQ", allocationSize = 1) +@Table(name = "MOTIVOCANCELACION_EQUIVALENCIA") +public class MotivocancelacionEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVOCANC_EQUIVALENCIA_SEQ") + @Basic(optional = false) + @Column(name = "MOTIVOEQUIVALENCIA_ID") + private Integer motivoequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "MOTIVOCANCELACION_ID") + private MotivoCancelacion motivoCancelacion; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public MotivocancelacionEquivalencia() { + } + + public MotivocancelacionEquivalencia(Integer motivoequivalenciaId) { + this.motivoequivalenciaId = motivoequivalenciaId; + } + + public Integer getMotivoequivalenciaId() { + return motivoequivalenciaId; + } + + public void setMotivoequivalenciaId(Integer motivoequivalenciaId) { + this.motivoequivalenciaId = motivoequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + public MotivoCancelacion getMotivoCancelacion() { + return motivoCancelacion; + } + + public void setMotivoCancelacion(MotivoCancelacion motivoCancelacion) { + this.motivoCancelacion = motivoCancelacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivoequivalenciaId != null ? motivoequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivocancelacionEquivalencia)) { + return false; + } + MotivocancelacionEquivalencia other = (MotivocancelacionEquivalencia) object; + if ((this.motivoequivalenciaId == null && other.motivoequivalenciaId != null) || (this.motivoequivalenciaId != null && !this.motivoequivalenciaId.equals(other.motivoequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia[ motivoequivalenciaId=" + motivoequivalenciaId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Nodo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Nodo.java new file mode 100644 index 000000000..4959b2455 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Nodo.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "NODO_SEQ", sequenceName = "NODO_SEQ", allocationSize=1) +@Table(name = "NODO") +public class Nodo implements Serializable { + public static final Integer NODO_ID_CENTRAL = 1; + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "NODO_SEQ") + @Basic(optional = false) + @Column(name = "NODO_ID") + private Integer nodoId; + @Column(name = "DESCNODO") + private String descnodo; + @Column(name = "INDCONTINGENCIA") + private Short indcontingencia; + @Column(name = "DIRECCIONNODO") + private String direccionnodo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Nodo() { + } + + public Nodo(Integer nodoId) { + this.nodoId = nodoId; + } + + public Integer getNodoId() { + return nodoId; + } + + public void setNodoId(Integer nodoId) { + this.nodoId = nodoId; + } + + public String getDescnodo() { + return descnodo; + } + + public void setDescnodo(String descnodo) { + this.descnodo = descnodo; + } + + public Short getIndcontingencia() { + return indcontingencia; + } + + public void setIndcontingencia(Short indcontingencia) { + this.indcontingencia = indcontingencia; + } + + public String getDireccionnodo() { + return direccionnodo; + } + + public void setDireccionnodo(String direccionnodo) { + this.direccionnodo = direccionnodo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (nodoId != null ? nodoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Nodo)) { + return false; + } + Nodo other = (Nodo) object; + if ((this.nodoId == null && other.nodoId != null) || (this.nodoId != null && !this.nodoId.equals(other.nodoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescnodo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OCD.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OCD.java new file mode 100644 index 000000000..24d3f6e27 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OCD.java @@ -0,0 +1,272 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "OCD") +public class OCD implements java.io.Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + private Long ocdId; + + private Long boletoId; + private PuntoVenta puntoVenta; + + private String numtarjeta; + private String numautorizacion; + private String nsu; + + private String numoperacion; + + private Date fecpagar; + private BigDecimal valorPagar; + private BigDecimal penalizacion; + + private Integer usuarioIncId; + private Date fecinc; + + private Boolean indpago; + private Integer usuarioPagoId; + private Date fecpago; + private PuntoVenta puntoVentaPago; + + private Date fecmodif; + private Integer usuarioId; + private Boolean activo; + + public OCD(){ + + } + + public OCD(Long ocdId, Long boletoId, PuntoVenta puntoVenta, + String numoperacion, Date fecpagar, BigDecimal valorPagar, + BigDecimal penalizacion, Integer usuarioIncId, Date fecinc, + Boolean indpago, Integer usuarioPagoId, Date fecpago, + PuntoVenta puntoVentaPago, Date fecmodif, Integer usuarioId, + Boolean activo) { + super(); + this.ocdId = ocdId; + this.setBoletoId(boletoId); + this.puntoVenta = puntoVenta; + this.numoperacion = numoperacion; + this.fecpagar = fecpagar; + this.valorPagar = valorPagar; + this.penalizacion = penalizacion; + this.usuarioIncId = usuarioIncId; + this.fecinc = fecinc; + this.indpago = indpago; + this.usuarioPagoId = usuarioPagoId; + this.fecpago = fecpago; + this.puntoVentaPago = puntoVentaPago; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.activo = activo; + } + + + public OCD(Long ocdId, Long boletoId, PuntoVenta puntoVenta, + String numoperacion, Date fecpagar, BigDecimal valorPagar, + BigDecimal penalizacion, Integer usuarioIncId) { + super(); + this.ocdId = ocdId; + this.setBoletoId(boletoId); + this.puntoVenta = puntoVenta; + this.numoperacion = numoperacion; + this.fecpagar = fecpagar; + this.valorPagar = valorPagar; + this.penalizacion = penalizacion; + this.usuarioIncId = usuarioIncId; + + this.fecinc = new Date(); + this.indpago = Boolean.FALSE; + + this.fecmodif = new Date(); + this.usuarioId = usuarioIncId; + this.activo = Boolean.TRUE; + } + + @SequenceGenerator(name = "OCD_SEQ", sequenceName = "OCD_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OCD_SEQ") + @Column(name = "OCD_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getOcdId() { + return ocdId; + } + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + @Column(name = "NUMOPERACION", precision = 7, scale = 0) + public String getNumoperacion() { + return numoperacion; + } + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECPAGAR", length = 7) + public Date getFecpagar() { + return fecpagar; + } + public void setFecpagar(Date fecpagar) { + this.fecpagar = fecpagar; + } + + @Column(name = "VALOR_PAGAR", precision = 7, scale = 2) + public BigDecimal getValorPagar() { + return valorPagar; + } + public void setValorPagar(BigDecimal valorPagar) { + this.valorPagar = valorPagar; + } + + @Column(name = "PENALIZACION", precision = 7, scale = 2) + public BigDecimal getPenalizacion() { + return penalizacion; + } + public void setPenalizacion(BigDecimal penalizacion) { + this.penalizacion = penalizacion; + } + + @Column(name = "USUARIOINC_ID", precision = 7, scale = 0) + public Integer getUsuarioIncId() { + return usuarioIncId; + } + public void setUsuarioIncId(Integer usuarioIncId) { + this.usuarioIncId = usuarioIncId; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECINC", length = 7) + public Date getFecinc() { + return fecinc; + } + public void setFecinc(Date fecinc) { + this.fecinc = fecinc; + } + + @Column(name = "INDPAGO", precision = 1, scale = 0) + public Boolean getIndpago() { + return indpago; + } + public void setIndpago(Boolean indpago) { + this.indpago = indpago; + } + + @Column(name = "USUARIOPAGO_ID", precision = 7, scale = 0) + public Integer getUsuarioPagoId() { + return usuarioPagoId; + } + public void setUsuarioPagoId(Integer usuarioPagoId) { + this.usuarioPagoId = usuarioPagoId; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECPAGO", length = 7) + public Date getFecpago() { + return fecpago; + } + public void setFecpago(Date fecpago) { + this.fecpago = fecpago; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + @JoinColumn(name = "PUNTOVENTAPAGO_ID") + @ManyToOne + public PuntoVenta getPuntoVentaPago() { + return puntoVentaPago; + } + + public void setPuntoVentaPago(PuntoVenta puntoVentaPago) { + this.puntoVentaPago = puntoVentaPago; + } + + @Column(name = "BOLETO_ID", precision = 15, scale = 0) + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + @Column(name = "NUMTARJETA",length=16) + public String getNumtarjeta() { + return numtarjeta; + } + + public void setNumtarjeta(String numtarjeta) { + this.numtarjeta = numtarjeta; + } + @Column(name = "NUMAUTORIZACION",length=15) + public String getNumautorizacion() { + return numautorizacion; + } + + public void setNumautorizacion(String numautorizacion) { + this.numautorizacion = numautorizacion; + } + @Column(name = "NSU",length=6) + public String getNsu() { + return nsu; + } + + public void setNsu(String nsu) { + this.nsu = nsu; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java new file mode 100644 index 000000000..d4b1532fe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java @@ -0,0 +1,186 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "OCD_PARAM") +public class OCDParam implements java.io.Serializable { + + + /** + * + */ + private static final long serialVersionUID = 1L; + private Long ocdparamId; + private BigDecimal penalizacion; + private Integer diasPagar; + private PuntoVenta puntoventa; + private Empresa empresa; + private Estado estado; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Boolean indOCDDefault; + private Boolean indOCDTroca; + private Boolean indPenalizacionOCD; + private Boolean indOcdDinheiro; + + public OCDParam(Long ocdparamId, BigDecimal penalizacion, + Integer diasPagar, PuntoVenta puntoventa, Empresa empresa, + Estado estado, Boolean activo, Date fecmodif, Integer usuarioId) { + super(); + this.ocdparamId = ocdparamId; + this.penalizacion = penalizacion; + this.diasPagar = diasPagar; + this.puntoventa = puntoventa; + this.empresa = empresa; + this.estado = estado; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public OCDParam() {/*...*/} + + @SequenceGenerator(name = "OCD_PARAM_SEQ", sequenceName = "OCD_PARAM_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OCD_PARAM_SEQ") + @Column(name = "OCDPARAM_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getOcdparamId() { + return ocdparamId; + } + + public void setOcdparamId(Long ocdparamId) { + this.ocdparamId = ocdparamId; + } + + @Column(name = "PENALIZACION", length = 10) + public BigDecimal getPenalizacion() { + return penalizacion; + } + + public void setPenalizacion(BigDecimal penalizacion) { + this.penalizacion = penalizacion; + } + + @Column(name = "DIAS_PAGAR", length = 10) + public Integer getDiasPagar() { + return diasPagar; + } + + public void setDiasPagar(Integer diasPagar) { + this.diasPagar = diasPagar; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @JoinColumn(name = "ESTADO_ID") + @ManyToOne + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "INDOCDDEFAULT") + public Boolean getIndOCDDefault() { + return indOCDDefault; + } + + public void setIndOCDDefault(Boolean indOCDDefault) { + this.indOCDDefault = indOCDDefault; + } + + @Column(name = "INDOCDTROCA") + public Boolean getIndOCDTroca() { + return indOCDTroca; + } + + public void setIndOCDTroca(Boolean indOCDTroca) { + this.indOCDTroca = indOCDTroca; + } + + public Boolean getIndPenalizacionOCD() { + return indPenalizacionOCD; + } + + public void setIndPenalizacionOCD(Boolean indPenalizacionOCD) { + this.indPenalizacionOCD = indPenalizacionOCD; + } + + /** + * @return the indOcdDinheiro + */ + @Column(name = "INDOCDDINHEIRO") + public Boolean getIndOcdDinheiro() { + return indOcdDinheiro; + } + + /** + * @param indOcdDinheiro the indOcdDinheiro to set + */ + public void setIndOcdDinheiro(Boolean indOcdDinheiro) { + this.indOcdDinheiro = indOcdDinheiro; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java new file mode 100644 index 000000000..97f9923f0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java @@ -0,0 +1,122 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ORGAO_CANCELACION_SEQ", sequenceName = "ORGAO_CANCELACION_SEQ", allocationSize = 1) +@Table(name = "ORGAO_CANCELACION") +public class OrgaoCancelacion implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CANCELACION_SEQ") + @Column(name = "ORGAOCANCELACION_ID") + private Integer orgaoCancelacionId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgao; + @Column(name = "PORCMULTA") + private BigDecimal porcmulta; + @Column(name = "PORCCAMBIO") + private BigDecimal porccambio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIEMPOLIMITE") + private Integer tiempolimite; + @Column(name = "TIEMPOLIMITECAMBIO") + private Integer tiempolimiteCambio; + @Column(name = "INDNAOPERMITETRANSFERENCIA") + private Boolean indnaopermitetransferencia; + + public Integer getOrgaoCancelacionId() { + return orgaoCancelacionId; + } + public void setOrgaoCancelacionId(Integer orgaoCancelacionId) { + this.orgaoCancelacionId = orgaoCancelacionId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public OrgaoConcedente getOrgao() { + return orgao; + } + public void setOrgao(OrgaoConcedente orgao) { + this.orgao = orgao; + } + public BigDecimal getPorcmulta() { + return porcmulta; + } + public void setPorcmulta(BigDecimal porcmulta) { + this.porcmulta = porcmulta; + } + public BigDecimal getPorccambio() { + return porccambio; + } + public void setPorccambio(BigDecimal porccambio) { + this.porccambio = porccambio; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Integer getTiempolimite() { + return tiempolimite; + } + public void setTiempolimite(Integer tiempolimite) { + this.tiempolimite = tiempolimite; + } + public Integer getTiempolimiteCambio() { + return tiempolimiteCambio; + } + public void setTiempolimiteCambio(Integer tiempolimiteCambio) { + this.tiempolimiteCambio = tiempolimiteCambio; + } + public Boolean getIndnaopermitetransferencia() { + return indnaopermitetransferencia; + } + public void setIndnaopermitetransferencia(Boolean indnaopermitetransferencia) { + this.indnaopermitetransferencia = indnaopermitetransferencia; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java new file mode 100644 index 000000000..8e679ec9d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java @@ -0,0 +1,181 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ORGAO_CONCEDENTE_SEQ", sequenceName = "ORGAO_CONCEDENTE_SEQ", allocationSize = 1) +@Table(name = "ORGAO_CONCEDENTE") +public class OrgaoConcedente implements Serializable { + + private static final long serialVersionUID = 1L; + public final static Integer CODIGO_ARTESP = 21; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CONCEDENTE_SEQ") + @Column(name = "ORGAOCONCEDENTE_ID") + private Integer orgaoConcedenteId; + @Column(name = "DESCORGAO") + private String descOrgao; + @Column(name = "INDDEFAULTSEGURO") + private Boolean indDefaultSeguro; + @Column(name = "INDSUBSEGURO") + private Boolean indSubSeguro; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "orgao") + private List categoriaOrgaoList; + @Column(name = "INDNOMDOCOBLIGATORIO") + private Boolean indNomDocObligatorio; + @OneToMany(mappedBy = "orgao") + private List orgaoCancelacionList; + @Column(name = "INDICEPEAJE") + private BigDecimal indicePeaje; + + public void addParametro(OrgaoCancelacion param){ + this.orgaoCancelacionList.add(param); + } + + public void removeParametro(OrgaoCancelacion param){ + this.orgaoCancelacionList.remove(param); + } + + public Integer getOrgaoConcedenteId() { + return orgaoConcedenteId; + } + + public void setOrgaoConcedenteId(Integer orgaoConcedenteId) { + this.orgaoConcedenteId = orgaoConcedenteId; + } + + public String getDescOrgao() { + return descOrgao; + } + + public void setDescOrgao(String descOrgao) { + this.descOrgao = descOrgao; + } + + public Boolean getIndSubSeguro() { + return indSubSeguro; + } + + public void setIndSubSeguro(Boolean indSubSeguro) { + this.indSubSeguro = indSubSeguro; + } + + public Boolean getIndDefaultSeguro() { + return indDefaultSeguro; + } + + public void setIndDefaultSeguro(Boolean indDefaultSeguro) { + this.indDefaultSeguro = indDefaultSeguro; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + + public List getCategoriaOrgaoList() { + return categoriaOrgaoList; + } + + public void setCategoriaOrgaoList(List categoriaOrgaoList) { + this.categoriaOrgaoList = categoriaOrgaoList; + } + + public Boolean getIndNomDocObligatorio() { + return indNomDocObligatorio; + } + + public void setIndNomDocObligatorio(Boolean indNomDocObligatorio) { + this.indNomDocObligatorio = indNomDocObligatorio; + } + + public List getOrgaoCancelacionList() { + return orgaoCancelacionList; + } + + public void setOrgaoCancelacionList(List orgaoCancelacionList) { + this.orgaoCancelacionList = orgaoCancelacionList; + } + + public BigDecimal getIndicePeaje() { + return indicePeaje; + } + + public void setIndicePeaje(BigDecimal indicePeaje) { + this.indicePeaje = indicePeaje; + } + + @Override + public String toString() { + return descOrgao; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((orgaoConcedenteId == null) ? 0 : orgaoConcedenteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + OrgaoConcedente other = (OrgaoConcedente) obj; + if (orgaoConcedenteId == null) { + if (other.orgaoConcedenteId != null) + return false; + } else if (!orgaoConcedenteId.equals(other.orgaoConcedenteId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoTramo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoTramo.java new file mode 100644 index 000000000..c784c90a9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/OrgaoTramo.java @@ -0,0 +1,191 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ORGAO_TRAMO_SEQ", sequenceName = "ORGAO_TRAMO_SEQ", allocationSize = 1) +@Table(name = "ORGAO_TRAMO") +public class OrgaoTramo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_TRAMO_SEQ") + @Basic(optional = false) + @Column(name = "ORGAOTRAMO_ID") + private Integer orgaoTramoId; + @OneToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @OneToOne + @JoinColumn(name = "COEFICIENTETARIFA1_ID") + private CoeficienteTarifa coeficienteTarifa1; + @Column(name = "KMCOEFICIENTE1") + private BigDecimal kmCoeficiente1; + @OneToOne + @JoinColumn(name = "COEFICIENTETARIFA2_ID") + private CoeficienteTarifa coeficienteTarifa2; + @Column(name = "KMCOEFICIENTE2") + private BigDecimal kmCoeficiente2; + @OneToOne + @JoinColumn(name = "COEFICIENTETARIFA3_ID") + private CoeficienteTarifa coeficienteTarifa3; + @Column(name = "KMCOEFICIENTE3") + private BigDecimal kmCoeficiente3; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getOrgaoTramoId() { + return orgaoTramoId; + } + + public void setOrgaoTramoId(Integer orgaoTramoId) { + this.orgaoTramoId = orgaoTramoId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public CoeficienteTarifa getCoeficienteTarifa1() { + return coeficienteTarifa1; + } + + public void setCoeficienteTarifa1(CoeficienteTarifa coeficienteTarifa1) { + this.coeficienteTarifa1 = coeficienteTarifa1; + } + + public BigDecimal getKmCoeficiente1() { + return kmCoeficiente1; + } + + public void setKmCoeficiente1(BigDecimal kmCoeficiente1) { + this.kmCoeficiente1 = kmCoeficiente1; + } + + public CoeficienteTarifa getCoeficienteTarifa2() { + return coeficienteTarifa2; + } + + public void setCoeficienteTarifa2(CoeficienteTarifa coeficienteTarifa2) { + this.coeficienteTarifa2 = coeficienteTarifa2; + } + + public BigDecimal getKmCoeficiente2() { + return kmCoeficiente2; + } + + public void setKmCoeficiente2(BigDecimal kmCoeficiente2) { + this.kmCoeficiente2 = kmCoeficiente2; + } + + public CoeficienteTarifa getCoeficienteTarifa3() { + return coeficienteTarifa3; + } + + public void setCoeficienteTarifa3(CoeficienteTarifa coeficienteTarifa3) { + this.coeficienteTarifa3 = coeficienteTarifa3; + } + + public BigDecimal getKmCoeficiente3() { + return kmCoeficiente3; + } + + public void setKmCoeficiente3(BigDecimal kmCoeficiente3) { + this.kmCoeficiente3 = kmCoeficiente3; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((orgaoTramoId == null) ? 0 : orgaoTramoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + OrgaoTramo other = (OrgaoTramo) obj; + if (orgaoTramoId == null) { + if (other.orgaoTramoId != null) + return false; + } else if (!orgaoTramoId.equals(other.orgaoTramoId)) + return false; + return true; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pacote.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pacote.java new file mode 100644 index 000000000..403901c11 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pacote.java @@ -0,0 +1,219 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE") +@SequenceGenerator(name = "PACOTE_SEQ", sequenceName = "PACOTE_SEQ", allocationSize = 1) +public class Pacote implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_SEQ") + @Column(name = "PACOTE_ID") + private Integer pacoteId; + @Column(name = "NOMPACOTE") + private String nompacote; + @Column(name = "DESCPACOTE") + private String descpacote; + @Column(name = "INDVENDAAGENCIA") + private Boolean indvendaagencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @ManyToMany + @JoinTable(name = "PACOTE_ITEM", joinColumns = { @JoinColumn(name = "PACOTE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "ITEMADICIONAL_ID") }) + private List itemAdicionalList; + + @ManyToMany + @JoinTable(name = "PACOTE_TARIFA", joinColumns = { @JoinColumn(name = "PACOTE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "TIPOTARIFAPACOTE_ID") }) + private List tipoTarifaPacoteList; + + public Pacote() { + super(); + } + + public Pacote(Integer pacoteId, String nompacote) { + this(); + this.pacoteId = pacoteId; + this.nompacote = nompacote; + } + + public Pacote(Integer pacoteId, String nompacote, String descpacote, Boolean indvendaagencia, Boolean activo, Date fecmodif, Integer usuarioId, Ruta ruta) { + this(); + this.pacoteId = pacoteId; + this.nompacote = nompacote; + this.descpacote = descpacote; + this.indvendaagencia = indvendaagencia; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.ruta = ruta; + } + + public Integer getPacoteId() { + return pacoteId; + } + + public void setPacoteId(Integer pacoteId) { + this.pacoteId = pacoteId; + } + + public String getNompacote() { + return nompacote; + } + + public void setNompacote(String nompacote) { + this.nompacote = nompacote; + } + + public String getDescpacote() { + return descpacote; + } + + public void setDescpacote(String descpacote) { + this.descpacote = descpacote; + } + + public Boolean getIndvendaagencia() { + return indvendaagencia; + } + + public void setIndvendaagencia(Boolean indvendaagencia) { + this.indvendaagencia = indvendaagencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public List getItemAdicionalList() { + if (this.itemAdicionalList == null || this.itemAdicionalList.isEmpty()) + return new ArrayList(); + + List aux = new ArrayList(); + for (ItemAdicional item : this.itemAdicionalList) { + if (item.getActivo()) + aux.add(item); + } + return aux; + } + + public void setItemAdicionalList(List itemAdicionalList) { + this.itemAdicionalList = itemAdicionalList; + } + + public List getTipoTarifaPacoteList() { + if (this.tipoTarifaPacoteList == null || this.tipoTarifaPacoteList.isEmpty()) + return new ArrayList(); + + List aux = new ArrayList(); + for (TipoTarifaPacote item : this.tipoTarifaPacoteList) { + if (item.getActivo()) + aux.add(item); + } + return aux; + } + + public void setTipoTarifaPacoteList(List tipoTarifaPacoteList) { + this.tipoTarifaPacoteList = tipoTarifaPacoteList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pacoteId == null) ? 0 : pacoteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Pacote other = (Pacote) obj; + if (pacoteId == null) { + if (other.pacoteId != null) + return false; + } else if (!pacoteId.equals(other.pacoteId)) + return false; + return true; + } + + @Override + public String toString() { + return this.getNompacote(); + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteConvenio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteConvenio.java new file mode 100644 index 000000000..fda565adc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteConvenio.java @@ -0,0 +1,88 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_CONVENIO") +@SequenceGenerator(name = "PACOTE_CONVENIO_SEQ", sequenceName = "PACOTE_CONVENIO_SEQ", allocationSize = 1) +public class PacoteConvenio implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_CONVENIO_SEQ") + @Column(name = "PACOTECONVENIO_ID") + private Long pacoteconvenioId; + + @Column(name = "NOMCONVENIO") + private String nomconvenio; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getPacoteconvenioId() { + return pacoteconvenioId; + } + + public void setPacoteconvenioId(Long pacoteconvenioId) { + this.pacoteconvenioId = pacoteconvenioId; + } + + public String getNomconvenio() { + return nomconvenio; + } + + public void setNomconvenio(String nomconvenio) { + this.nomconvenio = nomconvenio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getNomconvenio(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteDescontoBilhete.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteDescontoBilhete.java new file mode 100644 index 000000000..b4d805012 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteDescontoBilhete.java @@ -0,0 +1,108 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_DESCONTO_BILHETE") +@SequenceGenerator(name = "PACOTE_DESCONTO_BILHETE_SEQ", sequenceName = "PACOTE_DESCONTO_BILHETE_SEQ", allocationSize = 1) +public class PacoteDescontoBilhete implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "PACOTEDESCONTOBILHETE_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_DESCONTO_BILHETE_SEQ") + private Long pacotedescontobilheteId; + + @Column(name = "PERCDESCONTO") + private BigDecimal percdesconto; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @ManyToOne + @JoinColumn(name = "PACOTE_ID") + private Pacote pacote; + + @ManyToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + + public Long getPacotedescontobilheteId() { + return pacotedescontobilheteId; + } + + public void setPacotedescontobilheteId(Long pacotedescontobilheteId) { + this.pacotedescontobilheteId = pacotedescontobilheteId; + } + + public BigDecimal getPercdesconto() { + return percdesconto; + } + + public void setPercdesconto(BigDecimal percdesconto) { + this.percdesconto = percdesconto; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteFormapago.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteFormapago.java new file mode 100644 index 000000000..19a6b287e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteFormapago.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "PACOTE_FORMAPAGO_SEQ", sequenceName = "PACOTE_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "PACOTE_FORMAPAGO") +public class PacoteFormapago implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "PACOTEFORMAPAGO_ID") + private Long pacoteformapagoId; + + @Column(name = "VALOR") + private BigDecimal valor; + + @ManyToOne + @JoinColumn(name = "VENDAPACOTE_ID") + private VendaPacote vendaPacote; + + @ManyToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + public Long getPacoteformapagoId() { + return pacoteformapagoId; + } + + public void setPacoteformapagoId(Long pacoteformapagoId) { + this.pacoteformapagoId = pacoteformapagoId; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public VendaPacote getVendaPacote() { + return vendaPacote; + } + + public void setVendaPacote(VendaPacote vendaPacote) { + this.vendaPacote = vendaPacote; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteItem.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteItem.java new file mode 100644 index 000000000..f501de97f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteItem.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_ITEM") +@SequenceGenerator(name = "PACOTE_ITEM_SEQ", sequenceName = "PACOTE_ITEM_SEQ", allocationSize = 1) +public class PacoteItem implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_ITEM_SEQ") + @Column(name = "PACOTEITEM_ID") + private Integer pacoteItemId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PACOTE_ID", referencedColumnName = "PACOTE_ID") + @ManyToOne + private Pacote pacote; + @JoinColumn(name = "ITEMADICIONAL_ID", referencedColumnName = "ITEMADICIONAL_ID") + @ManyToOne + private ItemAdicional itemAdicional; + + public PacoteItem() { + super(); + } + + public Integer getPacoteItemId() { + return pacoteItemId; + } + + public void setPacoteItemId(Integer pacoteItemId) { + this.pacoteItemId = pacoteItemId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pacoteItemId == null) ? 0 : pacoteItemId.hashCode()); + return result; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public ItemAdicional getItemAdicional() { + return itemAdicional; + } + + public void setItemAdicional(ItemAdicional itemAdicional) { + this.itemAdicional = itemAdicional; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PacoteItem other = (PacoteItem) obj; + if (pacoteItemId == null) { + if (other.pacoteItemId != null) + return false; + } else if (!pacoteItemId.equals(other.pacoteItemId)) + return false; + return true; + } + + @Override + public String toString() { + return "PacoteItem [pacoteItemId=" + pacoteItemId + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", pacoteId=" + pacote + ", itemadicionalId=" + itemAdicional + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteTarifa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteTarifa.java new file mode 100644 index 000000000..ce33bbc70 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PacoteTarifa.java @@ -0,0 +1,145 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_TARIFA") +@SequenceGenerator(name = "PACOTE_TARIFA_SEQ", sequenceName = "PACOTE_TARIFA_SEQ", allocationSize = 1) +public class PacoteTarifa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_TARIFA_SEQ") + @Column(name = "PACOTETARIFA_ID ") + private Integer pacotetarifaId; + @Column(name = "TARIFA") + private BigDecimal tarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PACOTE_ID", referencedColumnName = "PACOTE_ID") + @ManyToOne + private Pacote pacote; + @JoinColumn(name = "TIPOTARIFAPACOTE_ID", referencedColumnName = "TIPOTARIFAPACOTE_ID") + @ManyToOne + private TipoTarifaPacote tipoTarifaPacote; + + public PacoteTarifa() { + super(); + } + + public PacoteTarifa(Integer pacotetarifaId, Boolean activo, Date fecmodif, Integer usuarioId) { + super(); + this.pacotetarifaId = pacotetarifaId; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getPacotetarifaId() { + return pacotetarifaId; + } + + public void setPacotetarifaId(Integer pacotetarifaId) { + this.pacotetarifaId = pacotetarifaId; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public TipoTarifaPacote getTipoTarifaPacote() { + return tipoTarifaPacote; + } + + public void setTipoTarifaPacote(TipoTarifaPacote tipoTarifaPacote) { + this.tipoTarifaPacote = tipoTarifaPacote; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pacotetarifaId == null) ? 0 : pacotetarifaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PacoteTarifa other = (PacoteTarifa) obj; + if (pacotetarifaId == null) { + if (other.pacotetarifaId != null) + return false; + } else if (!pacotetarifaId.equals(other.pacotetarifaId)) + return false; + return true; + } + + @Override + public String toString() { + return "PacoteTarifa [pacotetarifaId=" + pacotetarifaId + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", pacote=" + pacote + ", tipoTarifaPacote=" + tipoTarifaPacote + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pais.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pais.java new file mode 100644 index 000000000..fca72e805 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pais.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PAIS_SEQ", sequenceName = "PAIS_SEQ", allocationSize = 1) +@Table(name = "PAIS") +public class Pais implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PAIS_SEQ") + @Basic(optional = false) + @Column(name = "PAIS_ID") + private Integer paisId; + @Column(name = "NOMBPAIS") + private String nombpais; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "pais") + private List estadoList; + + public Pais() { + } + + public Pais(Integer paisId) { + this.paisId = paisId; + } + + public Integer getPaisId() { + return paisId; + } + + public void setPaisId(Integer paisId) { + this.paisId = paisId; + } + + public String getNombpais() { + return nombpais; + } + + public void setNombpais(String nombpais) { + this.nombpais = nombpais; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getEstadoList() { + return estadoList; + } + + public void setEstadoList(List estadoList) { + this.estadoList = estadoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paisId != null ? paisId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Pais)) { + return false; + } + Pais other = (Pais) object; + if ((this.paisId == null && other.paisId != null) || (this.paisId != null && !this.paisId.equals(other.paisId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombpais(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Parada.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Parada.java new file mode 100644 index 000000000..b5d7d98bb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Parada.java @@ -0,0 +1,255 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "PARADA_SEQ", sequenceName = "PARADA_SEQ", allocationSize = 1) +@Table(name = "PARADA") +public class Parada implements Serializable { + public static Integer ID_PARADA_TODOS = -1; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARADA_SEQ") + @Column(name = "PARADA_ID") + private Integer paradaId; + @Basic(optional = false) + @Column(name = "DESCPARADA") + private String descparada; + @Column(name = "CVEPARADA") + private String cveparada; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "CIUDAD_ID") + private Ciudad ciudad; + @OneToOne + @JoinColumn(name = "TIPOPARADA_ID") + private TipoParada tipoParada; + @OneToMany(mappedBy = "origem") + private List corridaList; + @OneToMany(mappedBy = "destino") + private List corridaList1; + @OneToMany(mappedBy = "paradaOrigem") + private List reservacionMercadoList; + @OneToMany(mappedBy = "paradaDestino") + private List reservacionMercadoList1; + @OneToMany(mappedBy = "destino") + private List categoriaMercadoDestinoList; + @OneToMany(mappedBy = "origem") + private List categoriaMercadoOrigemList; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @OneToMany(mappedBy = "origem") + private List tramoOrigemList; + @OneToMany(mappedBy = "destino") + private List tramoDestinoList; + @Column(name = "CODANTT") + private Integer codantt; + + public Parada() { + } + + public List getCategoriaMercadoDestinoList() { + return categoriaMercadoDestinoList; + } + + public void setCategoriaMercadoDestinoList(List categoriaMercadoDestinoList) { + this.categoriaMercadoDestinoList = categoriaMercadoDestinoList; + } + + public List getCategoriaMercadoOrigemList() { + return categoriaMercadoOrigemList; + } + + public void setCategoriaMercadoOrigemList(List categoriaMercadoOrigemList) { + this.categoriaMercadoOrigemList = categoriaMercadoOrigemList; + } + + public String getDescparada() { + return descparada; + } + + public void setDescparada(String descparada) { + this.descparada = descparada; + } + + public Integer getParadaId() { + return paradaId; + } + + public void setParadaId(Integer paradaId) { + this.paradaId = paradaId; + } + + public List getReservacionMercadoList() { + return reservacionMercadoList; + } + + public void setReservacionMercadoList(List reservacionMercadoList) { + this.reservacionMercadoList = reservacionMercadoList; + } + + public List getReservacionMercadoList1() { + return reservacionMercadoList1; + } + + public void setReservacionMercadoList1(List reservacionMercadoList1) { + this.reservacionMercadoList1 = reservacionMercadoList1; + } + + public String getCveparada() { + return cveparada; + } + + public void setCveparada(String cveparada) { + this.cveparada = cveparada; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getCorridaList1() { + return corridaList1; + } + + public void setCorridaList1(List corridaList1) { + this.corridaList1 = corridaList1; + } + + public List getTramoDestinoList() { + return tramoDestinoList; + } + + public void setTramoDestinoList(List tramoDestinoList) { + this.tramoDestinoList = tramoDestinoList; + } + + public List getTramoOrigemList() { + return tramoOrigemList; + } + + public void setTramoOrigemList(List tramoOrigemList) { + this.tramoOrigemList = tramoOrigemList; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public TipoParada getTipoParada() { + return tipoParada; + } + + public void setTipoParada(TipoParada tipoParada) { + this.tipoParada = tipoParada; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Integer getCodantt() { + return codantt; + } + + public void setCodantt(Integer codantt) { + this.codantt = codantt; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getParadaId() != null ? getParadaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Parada)) { + return false; + } + Parada other = (Parada) object; + if ((this.getParadaId() == null && other.getParadaId() != null) || (this.getParadaId() != null && !this.getParadaId().equals(other.getParadaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescparada(); + } + + public String toStringCve() { + return getCveparada(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaEquivalencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaEquivalencia.java new file mode 100644 index 000000000..1613b86d2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "PARADA_EQUIVALENCIA") +@SequenceGenerator(name = "PARADA_EQUIVALENCIA_SEQ", sequenceName = "PARADA_EQUIVALENCIA_SEQ", allocationSize = 1) +public class ParadaEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARADA_EQUIVALENCIA_SEQ") + @Basic(optional = false) + @Column(name = "PARADAEQUIVALENCIA_ID") + private Integer paradaequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "PARADA_ID") + private Parada parada; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public ParadaEquivalencia() { + } + + public ParadaEquivalencia(Integer paradaequivalenciaId) { + this.paradaequivalenciaId = paradaequivalenciaId; + } + + public Integer getParadaequivalenciaId() { + return paradaequivalenciaId; + } + + public void setParadaequivalenciaId(Integer paradaequivalenciaId) { + this.paradaequivalenciaId = paradaequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paradaequivalenciaId != null ? paradaequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParadaEquivalencia)) { + return false; + } + ParadaEquivalencia other = (ParadaEquivalencia) object; + if ((this.paradaequivalenciaId == null && other.paradaequivalenciaId != null) || (this.paradaequivalenciaId != null && !this.paradaequivalenciaId.equals(other.paradaequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia[ paradaequivalenciaId=" + paradaequivalenciaId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaEsquema.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaEsquema.java new file mode 100644 index 000000000..968584022 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaEsquema.java @@ -0,0 +1,81 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +/** + * + * @author Administrador + */ +public class ParadaEsquema { + + private Short numsecuencia; + private Date tiempoEstancia; + private Date padraoRecorrido; + private Date excepcionRecorrido; + private Parada parada; + private Boolean activo; + private String plataforma; + + public ParadaEsquema() { + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Date getTiempoEstancia() { + return tiempoEstancia; + } + + public void setTiempoEstancia(Date tiempoEstancia) { + this.tiempoEstancia = tiempoEstancia; + } + + public String getPlataforma() { + return plataforma; + } + + public void setPlataforma(String plataforma) { + this.plataforma = plataforma; + } + + public Date getPadraoRecorrido() { + return padraoRecorrido; + } + + public void setPadraoRecorrido(Date padraoRecorrido) { + this.padraoRecorrido = padraoRecorrido; + } + + public Date getExcepcionRecorrido() { + return excepcionRecorrido; + } + + public void setExcepcionRecorrido(Date excepcionRecorrido) { + this.excepcionRecorrido = excepcionRecorrido; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuencia.java new file mode 100644 index 000000000..744b31196 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuencia.java @@ -0,0 +1,91 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.List; + +/** + * + * @author Administrador + */ +public class ParadaSecuencia { + + private Short secuencia; + private Parada parada; + private Via via; + private List casetas; + private String casetasTxt =""; + private String kmReal = ""; + private String tempoReal = ""; + + public ParadaSecuencia() { + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Short getSecuencia() { + return secuencia; + } + + public void setSecuencia(Short secuencia) { + this.secuencia = secuencia; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public List getCasetas() { + return casetas; + } + + public void setCasetas(List casetas) { + this.casetas = casetas; + } + + public String getCasetasTxt() { + if(casetas != null){ + for( int i = 0 ; i < casetas.size() ; i ++){ + RutaCaseta cs = casetas.get(i); + if(i == casetas.size()-1){ + casetasTxt = casetasTxt + cs.getCasetaPeaje().getDesccaseta(); + }else{ + casetasTxt = casetasTxt + cs.getCasetaPeaje().getDesccaseta()+", "; + } + } + } + return casetasTxt; + } + + public void setCasetasTxt(String casetasTxt) { + this.casetasTxt = casetasTxt; + } + + public String getKmReal() { + return kmReal; + } + + public void setKmReal(String kmReal) { + this.kmReal = kmReal; + } + + public String getTempoReal() { + return tempoReal; + } + + public void setTempoReal(String tempoReal) { + this.tempoReal = tempoReal; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaMasivo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaMasivo.java new file mode 100644 index 000000000..90f2b7f3b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaMasivo.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_ACUMULA_MASIVO_SEQ", sequenceName = "PARAM_ACUMULA_MASIVO_SEQ", allocationSize = 1) +@Table(name = "PARAM_ACUMULA_MASIVO") +public class ParamAcumulaMasivo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_ACUMULA_MASIVO_SEQ") + @Column(name = "PARAMACUMULAMASIVO") + private Integer paramacumulamasivo; + @Column(name = "MAXPUNTOOTORGA") + private Integer maxpuntootorga; + @Column(name = "MINPUNTOOTORGA") + private Integer minpuntootorga; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public ParamAcumulaMasivo() { + } + + public ParamAcumulaMasivo(Integer paramacumulamasivo) { + this.paramacumulamasivo = paramacumulamasivo; + } + + public Integer getParamacumulamasivo() { + return paramacumulamasivo; + } + + public void setParamacumulamasivo(Integer paramacumulamasivo) { + this.paramacumulamasivo = paramacumulamasivo; + } + + public Integer getMaxpuntootorga() { + return maxpuntootorga; + } + + public void setMaxpuntootorga(Integer maxpuntootorga) { + this.maxpuntootorga = maxpuntootorga; + } + + public Integer getMinpuntootorga() { + return minpuntootorga; + } + + public void setMinpuntootorga(Integer minpuntootorga) { + this.minpuntootorga = minpuntootorga; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramacumulamasivo != null ? paramacumulamasivo.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamAcumulaMasivo)) { + return false; + } + ParamAcumulaMasivo other = (ParamAcumulaMasivo) object; + if ((this.paramacumulamasivo == null && other.paramacumulamasivo != null) || (this.paramacumulamasivo != null && !this.paramacumulamasivo.equals(other.paramacumulamasivo))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.ParamAcumulaMasivo[paramacumulamasivo=" + paramacumulamasivo + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaPunto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaPunto.java new file mode 100644 index 000000000..d9594a0b0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaPunto.java @@ -0,0 +1,226 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_ACUMULA_PUNTO_SEQ", sequenceName = "PARAM_ACUMULA_PUNTO_SEQ", allocationSize = 1) +@Table(name = "PARAM_ACUMULA_PUNTO") +public class ParamAcumulaPunto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_ACUMULA_PUNTO_SEQ") + @Column(name = "PARAMACUMULAPUNTO_ID") + private Integer paramacumulapuntoId; + @Column(name = "CANTOPERACIONDIA") + private Short cantoperaciondia; + @Column(name = "CANTBOLETOOPERACION") + private Integer cantboletooperacion; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "PORCCLIENTE") + private BigDecimal porccliente; + @Column(name = "PORCEMPRESA") + private BigDecimal porcempresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + public ParamAcumulaPunto() { + } + + public ParamAcumulaPunto(Integer paramacumulapuntoId) { + this.paramacumulapuntoId = paramacumulapuntoId; + } + + public Integer getParamacumulapuntoId() { + return paramacumulapuntoId; + } + + public void setParamacumulapuntoId(Integer paramacumulapuntoId) { + this.paramacumulapuntoId = paramacumulapuntoId; + } + + public Short getCantoperaciondia() { + return cantoperaciondia; + } + + public void setCantoperaciondia(Short cantoperaciondia) { + this.cantoperaciondia = cantoperaciondia; + } + + public Integer getCantboletooperacion() { + return cantboletooperacion; + } + + public void setCantboletooperacion(Integer cantboletooperacion) { + this.cantboletooperacion = cantboletooperacion; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public BigDecimal getPorccliente() { + return porccliente; + } + + public void setPorccliente(BigDecimal porccliente) { + this.porccliente = porccliente; + } + + public BigDecimal getPorcempresa() { + return porcempresa; + } + + public void setPorcempresa(BigDecimal porcempresa) { + this.porcempresa = porcempresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramacumulapuntoId != null ? paramacumulapuntoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamAcumulaPunto)) { + return false; + } + ParamAcumulaPunto other = (ParamAcumulaPunto) object; + if ((this.paramacumulapuntoId == null && other.paramacumulapuntoId != null) || (this.paramacumulapuntoId != null && !this.paramacumulapuntoId.equals(other.paramacumulapuntoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "novasEntidades.ParamAcumulaPunto[paramacumulapuntoId=" + paramacumulapuntoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamArticulo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamArticulo.java new file mode 100644 index 000000000..2bc51217c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamArticulo.java @@ -0,0 +1,79 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "PARAM_ARTICULO_SEQ", sequenceName = "PARAM_ARTICULO_SEQ", allocationSize = 1) +@Table(name = "PARAM_ARTICULO") +public class ParamArticulo implements Serializable{ + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_ARTICULO_SEQ") + @Basic(optional = false) + @Column(name = "PARAMARTICULO_ID") + private Integer paramArticuloID; + @Column(name = "CONCEPTO") + private String concepto; + @Column(name = "ARTICULO") + private String articulo; + + public Integer getParamArticuloID() { + return paramArticuloID; + } + public void setParamArticuloID(Integer paramArticuloID) { + this.paramArticuloID = paramArticuloID; + } + public String getConcepto() { + return concepto; + } + public void setConcepto(String concepto) { + this.concepto = concepto; + } + public String getArticulo() { + return articulo; + } + public void setArticulo(String articulo) { + this.articulo = articulo; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((paramArticuloID == null) ? 0 : paramArticuloID.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ParamArticulo other = (ParamArticulo) obj; + if (paramArticuloID == null) { + if (other.paramArticuloID != null) + return false; + } else if (!paramArticuloID.equals(other.paramArticuloID)) + return false; + return true; + } + @Override + public String toString() { + return this.getParamArticuloID() + " - " + this.getConcepto(); + } + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCanjePunto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCanjePunto.java new file mode 100644 index 000000000..bf700ee09 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCanjePunto.java @@ -0,0 +1,181 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_CANJE_PUNTO_SEQ", sequenceName = "PARAM_CANJE_PUNTO_SEQ", allocationSize = 1) +@Table(name = "PARAM_CANJE_PUNTO") +public class ParamCanjePunto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_CANJE_PUNTO_SEQ") + @Column(name = "PARAMCANJEPUNTO_ID") + private Integer paramcanjepuntoId; + @Column(name = "CANTOPERACIONDIA") + private Short cantoperaciondia; + @Column(name = "CANTBOLETOOPERACION") + private Short cantboletooperacion; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "PORCENTAJE") + private BigDecimal porcentaje; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + + public ParamCanjePunto() { + } + + public ParamCanjePunto(Integer paramcanjepuntoId) { + this.paramcanjepuntoId = paramcanjepuntoId; + } + + public Integer getParamcanjepuntoId() { + return paramcanjepuntoId; + } + + public void setParamcanjepuntoId(Integer paramcanjepuntoId) { + this.paramcanjepuntoId = paramcanjepuntoId; + } + + public Short getCantoperaciondia() { + return cantoperaciondia; + } + + public void setCantoperaciondia(Short cantoperaciondia) { + this.cantoperaciondia = cantoperaciondia; + } + + public Short getCantboletooperacion() { + return cantboletooperacion; + } + + public void setCantboletooperacion(Short cantboletooperacion) { + this.cantboletooperacion = cantboletooperacion; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramcanjepuntoId != null ? paramcanjepuntoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamCanjePunto)) { + return false; + } + ParamCanjePunto other = (ParamCanjePunto) object; + if ((this.paramcanjepuntoId == null && other.paramcanjepuntoId != null) || (this.paramcanjepuntoId != null && !this.paramcanjepuntoId.equals(other.paramcanjepuntoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "novasEntidades.ParamCanjePunto[paramcanjepuntoId=" + paramcanjepuntoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCompraPunto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCompraPunto.java new file mode 100644 index 000000000..d83e36739 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCompraPunto.java @@ -0,0 +1,127 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_COMPRA_PUNTO_SEQ", sequenceName = "PARAM_COMPRA_PUNTO_SEQ", allocationSize=1) +@Table(name = "PARAM_COMPRA_PUNTO") +public class ParamCompraPunto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_COMPRA_PUNTO_SEQ") + @Column(name = "PARAMCOMPRAPUNTO_ID") + private Integer paramcomprapuntoId; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ParamCompraPunto() { + } + + public ParamCompraPunto(Integer paramcomprapuntoId) { + this.paramcomprapuntoId = paramcomprapuntoId; + } + + public Integer getParamcomprapuntoId() { + return paramcomprapuntoId; + } + + public void setParamcomprapuntoId(Integer paramcomprapuntoId) { + this.paramcomprapuntoId = paramcomprapuntoId; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramcomprapuntoId != null ? paramcomprapuntoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamCompraPunto)) { + return false; + } + ParamCompraPunto other = (ParamCompraPunto) object; + if ((this.paramcomprapuntoId == null && other.paramcomprapuntoId != null) || (this.paramcomprapuntoId != null && !this.paramcomprapuntoId.equals(other.paramcomprapuntoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "te.ParamCompraPunto[paramcomprapuntoId=" + paramcomprapuntoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamConexion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamConexion.java new file mode 100644 index 000000000..8cf16f497 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamConexion.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author gleimar + */ +@Entity +@Table(name = "PARAM_CONEXION") +public class ParamConexion implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "PARAM_CONEXION_ID") + private Integer paramConexionId; + @Column(name = "DESCPARAMETRO") + private String descparametro; + @Column(name = "NOMBPARAMETRO") + private String nombparametro; + @Column(name = "VALOR_PARAMETRO") + private Integer valorParametro; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + + public ParamConexion() { + } + + public ParamConexion(Integer paramConexionId) { + this.paramConexionId = paramConexionId; + } + + public Integer getParamConexionId() { + return paramConexionId; + } + + public void setParamConexionId(Integer paramConexionId) { + this.paramConexionId = paramConexionId; + } + + public String getDescparametro() { + return descparametro; + } + + public void setDescparametro(String descparametro) { + this.descparametro = descparametro; + } + + public String getNombparametro() { + return nombparametro; + } + + public void setNombparametro(String nombparametro) { + this.nombparametro = nombparametro; + } + + public Integer getValorParametro() { + return valorParametro; + } + + public void setValorParametro(Integer valorParametro) { + this.valorParametro = valorParametro; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramConexionId != null ? paramConexionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamConexion)) { + return false; + } + ParamConexion other = (ParamConexion) object; + if ((this.paramConexionId == null && other.paramConexionId != null) || (this.paramConexionId != null && !this.paramConexionId.equals(other.paramConexionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ParamConexion[ paramConexionId=" + paramConexionId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCostoTarjeta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCostoTarjeta.java new file mode 100644 index 000000000..30573ee3b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamCostoTarjeta.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_COSTO_TARJETA_SEQ", sequenceName = "PARAM_COSTO_TARJETA_SEQ", allocationSize=1) +@Table(name = "PARAM_COSTO_TARJETA") +public class ParamCostoTarjeta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_COSTO_TARJETA_SEQ") + @Column(name = "PARAMCOSTOTARJETA_ID") + private Integer paramcostotarjetaId; + @Column(name = "VALCOSTOINICIAL") + private BigDecimal valcostoinicial; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public ParamCostoTarjeta() { + } + + public ParamCostoTarjeta(Integer paramcostotarjetaId) { + this.paramcostotarjetaId = paramcostotarjetaId; + } + + public Integer getParamcostotarjetaId() { + return paramcostotarjetaId; + } + + public void setParamcostotarjetaId(Integer paramcostotarjetaId) { + this.paramcostotarjetaId = paramcostotarjetaId; + } + + public BigDecimal getValcostoinicial() { + return valcostoinicial; + } + + public void setValcostoinicial(BigDecimal valcostoinicial) { + this.valcostoinicial = valcostoinicial; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramcostotarjetaId != null ? paramcostotarjetaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamCostoTarjeta)) { + return false; + } + ParamCostoTarjeta other = (ParamCostoTarjeta) object; + if ((this.paramcostotarjetaId == null && other.paramcostotarjetaId != null) || (this.paramcostotarjetaId != null && !this.paramcostotarjetaId.equals(other.paramcostotarjetaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "te.ParamCostoTarjeta[paramcostotarjetaId=" + paramcostotarjetaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java new file mode 100644 index 000000000..08a6a6d80 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "PARAM_RECOLECCION_SEQ", sequenceName = "PARAM_RECOLECCION_SEQ", allocationSize = 1) +@Table(name = "PARAM_RECOLECCION") +public class ParamRecoleccion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "PARAMRECOLECCION_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_RECOLECCION_SEQ") + private Integer paramrecoleccionId; + @Column(name = "IMPORTEINICIAL") + private BigDecimal importeinicial; + @Column(name = "IMPORTEADICIONAL") + private BigDecimal importeadicional; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + public ParamRecoleccion() { + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public ParamRecoleccion(Integer paramrecoleccionId) { + this.paramrecoleccionId = paramrecoleccionId; + } + + public Integer getParamrecoleccionId() { + return paramrecoleccionId; + } + + public void setParamrecoleccionId(Integer paramrecoleccionId) { + this.paramrecoleccionId = paramrecoleccionId; + } + + public BigDecimal getImporteinicial() { + return importeinicial; + } + + public void setImporteinicial(BigDecimal importeinicial) { + this.importeinicial = importeinicial; + } + + public BigDecimal getImporteadicional() { + return importeadicional; + } + + public void setImporteadicional(BigDecimal importeadicional) { + this.importeadicional = importeadicional; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramrecoleccionId != null ? paramrecoleccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamRecoleccion)) { + return false; + } + ParamRecoleccion other = (ParamRecoleccion) object; + if ((this.paramrecoleccionId == null && other.paramrecoleccionId != null) || (this.paramrecoleccionId != null && !this.paramrecoleccionId.equals(other.paramrecoleccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ParamRecoleccion[paramrecoleccionId=" + paramrecoleccionId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Peaje.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Peaje.java new file mode 100644 index 000000000..691dfa3b3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Peaje.java @@ -0,0 +1,139 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PEAJE_SEQ", sequenceName = "PEAJE_SEQ", allocationSize = 1) +@Table(name = "PEAJE") +public class Peaje implements Serializable{ + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PEAJE_SEQ") + @Column(name = "PEAJE_ID") + private Integer pejaeId; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne + @JoinColumn(name = "CASETAPEAJE_ID", referencedColumnName = "CASETAPEAJE_ID") + private CasetaPeaje casetaPeaje; + @Column(name = "CANTASIENTOS") + private BigDecimal cantAsientos; + @Column(name = "CANTEIXOS") + private BigDecimal cantEixos; + @Column(name = "IMPORTEPEAJE") + private BigDecimal importePeaje; + @Column(name = "INDICEPEAJE") + private BigDecimal indicePeaje; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getPejaeId() { + return pejaeId; + } + public void setPejaeId(Integer pejaeId) { + this.pejaeId = pejaeId; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Parada getOrigem() { + return origem; + } + public void setOrigem(Parada origem) { + this.origem = origem; + } + public Parada getDestino() { + return destino; + } + public void setDestino(Parada destino) { + this.destino = destino; + } + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + public CasetaPeaje getCasetaPeaje() { + return casetaPeaje; + } + public void setCasetaPeaje(CasetaPeaje casetaPeaje) { + this.casetaPeaje = casetaPeaje; + } + public BigDecimal getCantAsientos() { + return cantAsientos; + } + public void setCantAsientos(BigDecimal cantAsientos) { + this.cantAsientos = cantAsientos; + } + public BigDecimal getCantEixos() { + return cantEixos; + } + public void setCantEixos(BigDecimal cantEixos) { + this.cantEixos = cantEixos; + } + public BigDecimal getImportePeaje() { + return importePeaje; + } + public void setImportePeaje(BigDecimal importePeaje) { + this.importePeaje = importePeaje; + } + public BigDecimal getIndicePeaje() { + return indicePeaje; + } + public void setIndicePeaje(BigDecimal indicePeaje) { + this.indicePeaje = indicePeaje; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Perfil.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Perfil.java new file mode 100644 index 000000000..09a13f69d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Perfil.java @@ -0,0 +1,169 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PERFIL_SEQ", sequenceName = "PERFIL_SEQ", allocationSize = 1) +@Table(name = "PERFIL") +public class Perfil implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PERFIL_SEQ") + @Column(name = "PERFIL_ID") + private Integer perfilId; + @Column(name = "DESCPERFIL") + private String descperfil; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "INDJERARQUIA") + private Integer indJerarquia; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "perfil") + private List usuarioPerfilList; + @OneToMany(mappedBy = "perfil", cascade = CascadeType.ALL) + private List perfilFuncionList; + + public Perfil() { + } + + public Perfil(Integer perfilId) { + this.perfilId = perfilId; + } + + public Integer getPerfilId() { + return perfilId; + } + + public void setPerfilId(Integer perfilId) { + this.perfilId = perfilId; + } + + public String getDescperfil() { + return descperfil; + } + + public void setDescperfil(String descperfil) { + this.descperfil = descperfil; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getIndJerarquia() { + return indJerarquia; + } + + public void setIndJerarquia(Integer indJerarquia) { + this.indJerarquia = indJerarquia; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getUsuarioPerfilList() { + List tmp = new ArrayList(); + if (usuarioPerfilList != null) { + for (UsuarioPerfil cp : this.usuarioPerfilList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setUsuarioPerfilList(List usuarioPerfilList) { + this.usuarioPerfilList = usuarioPerfilList; + } + + public List getPerfilFuncionList() { + List tmp = new ArrayList(); + if (perfilFuncionList != null) { + for (PerfilFuncion cp : this.perfilFuncionList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setPerfilFuncionList(List perfilFuncionList) { + this.perfilFuncionList = perfilFuncionList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (perfilId != null ? perfilId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Perfil)) { + return false; + } + Perfil other = (Perfil) object; + if ((this.perfilId == null && other.perfilId != null) || (this.perfilId != null && !this.perfilId.equals(other.perfilId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescperfil(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PerfilFuncion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PerfilFuncion.java new file mode 100644 index 000000000..e48dc0ee8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PerfilFuncion.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "PERFIL_FUNCION") +@SequenceGenerator(name = "PERFIL_FUNCION_SEQ", sequenceName = "PERFIL_FUNCION_SEQ", allocationSize = 1) +public class PerfilFuncion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "PERFILFUNCION_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PERFIL_FUNCION_SEQ") + private Integer perfilfuncionId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PERFIL_ID", referencedColumnName = "PERFIL_ID") + @ManyToOne + private Perfil perfil; + @JoinColumn(name = "FUNCIONSISTEMA_ID", referencedColumnName = "FUNCIONSISTEMA_ID") + @ManyToOne + private FuncionSistema funcionSistema; + @Column(name = "INDLECTURA") + private Boolean indLectura; + + public PerfilFuncion() { + } + + public PerfilFuncion(Integer perfilfuncionId) { + this.perfilfuncionId = perfilfuncionId; + } + + public Integer getPerfilfuncionId() { + return perfilfuncionId; + } + + public void setPerfilfuncionId(Integer perfilfuncionId) { + this.perfilfuncionId = perfilfuncionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Perfil getPerfil() { + return perfil; + } + + public void setPerfil(Perfil perfil) { + this.perfil = perfil; + } + + public FuncionSistema getFuncionSistema() { + return funcionSistema; + } + + public void setFuncionSistema(FuncionSistema funcionSistema) { + this.funcionSistema = funcionSistema; + } + + public Boolean getIndLectura() { + return indLectura; + } + + public void setIndLectura(Boolean indLectura) { + this.indLectura = indLectura; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (perfilfuncionId != null ? perfilfuncionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PerfilFuncion)) { + return false; + } + PerfilFuncion other = (PerfilFuncion) object; + if ((this.perfilfuncionId == null && other.perfilfuncionId != null) || (this.perfilfuncionId != null && !this.perfilfuncionId.equals(other.perfilfuncionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PerfilFuncion[perfilfuncionId=" + perfilfuncionId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PeriodoVacacional.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PeriodoVacacional.java new file mode 100644 index 000000000..229f6bd6e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PeriodoVacacional.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PERIODO_VACACIONAL_SEQ", sequenceName = "PERIODO_VACACIONAL_SEQ", allocationSize = 1) +@Table(name = "PERIODO_VACACIONAL") +public class PeriodoVacacional implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PERIODO_VACACIONAL_SEQ") + @Column(name = "PERIODOVACACIONAL_ID") + private Integer periodovacacionalId; + @Column(name = "FECINICIO") + @Temporal(TemporalType.DATE) + private Date fecinicio; + @Column(name = "FECFINAL") + @Temporal(TemporalType.DATE) + private Date fecfinal; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public PeriodoVacacional() { + } + + public PeriodoVacacional(Integer periodovacacionalId) { + this.periodovacacionalId = periodovacacionalId; + } + + public Integer getPeriodovacacionalId() { + return periodovacacionalId; + } + + public void setPeriodovacacionalId(Integer periodovacacionalId) { + this.periodovacacionalId = periodovacacionalId; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecfinal() { + return fecfinal; + } + + public void setFecfinal(Date fecfinal) { + this.fecfinal = fecfinal; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (periodovacacionalId != null ? periodovacacionalId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PeriodoVacacional)) { + return false; + } + PeriodoVacacional other = (PeriodoVacacional) object; + if ((this.periodovacacionalId == null && other.periodovacacionalId != null) || (this.periodovacacionalId != null && !this.periodovacacionalId.equals(other.periodovacacionalId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PeriodoVacacional[periodovacacionalId=" + periodovacacionalId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Plaza.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Plaza.java new file mode 100644 index 000000000..f64fb239f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Plaza.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "PLAZA_SEQ", sequenceName = "PLAZA_SEQ", allocationSize=1) +@Table(name = "PLAZA") +public class Plaza implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PLAZA_SEQ") + @Column(name = "PLAZA_ID") + private Integer plazaId; + @Column(name = "NOMBPLAZA") + private String nombplaza; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Plaza() { + } + + public Plaza(Integer plazaId) { + this.plazaId = plazaId; + } + + public Integer getPlazaId() { + return plazaId; + } + + public void setPlazaId(Integer plazaId) { + this.plazaId = plazaId; + } + + public String getNombplaza() { + return nombplaza; + } + + public void setNombplaza(String nombplaza) { + this.nombplaza = nombplaza; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (plazaId != null ? plazaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Plaza)) { + return false; + } + Plaza other = (Plaza) object; + if ((this.plazaId == null && other.plazaId != null) || (this.plazaId != null && !this.plazaId.equals(other.plazaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombplaza(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PrecioVentaja.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PrecioVentaja.java new file mode 100644 index 000000000..4e4513b5b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PrecioVentaja.java @@ -0,0 +1,202 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author Thiago + * + */ +@Entity +@SequenceGenerator(name = "PRECIO_VENTAJA_SEQ", sequenceName = "PRECIO_VENTAJA_SEQ", allocationSize = 1) +@Table(name = "PRECIO_VENTAJA") +public class PrecioVentaja implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECIO_VENTAJA_SEQ") + @Column(name = "PRECIOVENTAJA_ID") + private Integer precioVentajaId; + + @OneToOne + @JoinColumn(name = "RUTA_ORIGINAL_ID", referencedColumnName = "RUTA_ID") + private Ruta rutaOriginalId; + + @OneToOne + @JoinColumn(name = "ORIGEN_ORIGINAL_ID", referencedColumnName = "PARADA_ID") + private Parada origenOriginalId; + + @OneToOne + @JoinColumn(name = "DESTINO_ORIGINAL_ID", referencedColumnName = "PARADA_ID") + private Parada destinoOriginalId; + + @Column(name = "INDPREFIXOORIGEN") + private Boolean indPrefixoOrigen; + + @Column(name = "FECINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaInicio; + + @Column(name = "FECFINAL") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaFinal; + + @OneToOne + @JoinColumn(name = "RUTA_PRECIO_ID", referencedColumnName = "RUTA_ID") + private Ruta rutaPrecioId; + + @Column(name = "CORRIDA_ID") + private Integer corridaId; + + @OneToOne + @JoinColumn(name = "ORIGEN_PRECIO_ID", referencedColumnName = "PARADA_ID") + private Parada origenPrecioId; + + @OneToOne + @JoinColumn(name = "DESTINO_PRECIO_ID", referencedColumnName = "PARADA_ID") + private Parada destinoPrecioId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getPrecioVentajaId() { + return precioVentajaId; + } + + public void setPrecioVentajaId(Integer precioVentajaId) { + this.precioVentajaId = precioVentajaId; + } + + public Ruta getRutaOriginalId() { + return rutaOriginalId; + } + + public void setRutaOriginalId(Ruta rutaOriginalId) { + this.rutaOriginalId = rutaOriginalId; + } + + public Parada getOrigenOriginalId() { + return origenOriginalId; + } + + public void setOrigenOriginalId(Parada origenOriginalId) { + this.origenOriginalId = origenOriginalId; + } + + public Parada getDestinoOriginalId() { + return destinoOriginalId; + } + + public void setDestinoOriginalId(Parada destinoOriginalId) { + this.destinoOriginalId = destinoOriginalId; + } + + public Boolean getIndPrefixoOrigen() { + return indPrefixoOrigen; + } + + public void setIndPrefixoOrigen(Boolean indPrefixoOrigen) { + this.indPrefixoOrigen = indPrefixoOrigen; + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFinal() { + return fechaFinal; + } + + public void setFechaFinal(Date fechaFinal) { + this.fechaFinal = fechaFinal; + } + + public Ruta getRutaPrecioId() { + return rutaPrecioId; + } + + public void setRutaPrecioId(Ruta rutaPrecioId) { + this.rutaPrecioId = rutaPrecioId; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Parada getOrigenPrecioId() { + return origenPrecioId; + } + + public void setOrigenPrecioId(Parada origenPrecioId) { + this.origenPrecioId = origenPrecioId; + } + + public Parada getDestinoPrecioId() { + return destinoPrecioId; + } + + public void setDestinoPrecioId(Parada destinoPrecioId) { + this.destinoPrecioId = destinoPrecioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java new file mode 100644 index 000000000..541dbfa73 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java @@ -0,0 +1,146 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PRECO_APANHE") +@SequenceGenerator(name = "PRECO_APANHE_SEQ", sequenceName = "PRECO_APANHE_SEQ", allocationSize = 1) +public class PrecoApanhe implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECO_APANHE_SEQ") + @Column(name = "PRECOAPANHE_ID") + private Long precoapanheId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "HOTEL_ID") + private Hotel hotel; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "COLONIA_ID") + private Colonia colonia; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CIUDAD_ID") + private Ciudad ciudad; + + @Column(name = "PRECO", columnDefinition = "NUMBER(5,2)") + private BigDecimal preco; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getPrecoapanheId() { + return precoapanheId; + } + + public void setPrecoapanheId(Long precoapanheId) { + this.precoapanheId = precoapanheId; + } + + public Hotel getHotel() { + return hotel; + } + + public void setHotel(Hotel hotel) { + this.hotel = hotel; + } + + public Colonia getColonia() { + return colonia; + } + + public void setColonia(Colonia colonia) { + this.colonia = colonia; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((precoapanheId == null) ? 0 : precoapanheId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + PrecoApanhe other = (PrecoApanhe) obj; + if (precoapanheId == null) { + if (other.precoapanheId != null) + return false; + } else if (!precoapanheId.equals(other.precoapanheId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pricing.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pricing.java new file mode 100644 index 000000000..c7414526f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Pricing.java @@ -0,0 +1,518 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_SEQ", sequenceName = "PRICING_SEQ", allocationSize = 1) +@Table(name = "PRICING") +public class Pricing implements Serializable { + + private static final long serialVersionUID = 1L; + public static final Integer ATIVO = 1; + public static final Integer INATIVO = 2; + public static final Integer EXCLUIDO = 0; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_SEQ") + @Column(name = "PRICING_ID") + private Integer pricingId; + @Column(name = "NOMBPRICING") + private String nombPricing; + @Column(name = "CANTBOLETO") + private Short cantboleto; + // Rafael - Campo retirado pela Leticia no dia 15/02/2011. + // @Column(name = "DESCUENTOIMPORTE") + // private BigDecimal descuentoimporte; + @Column(name = "DESCUENTOPORCENTAJE") + private BigDecimal descuentoporcentaje; + @Column(name = "DESCUENTOPORCREDONDO") + private BigDecimal descuentoporcredondo; + @Column(name = "INDTRANSFERIBLE") + private Boolean indtransferible; + @Column(name = "INDRESERVABLE") + private Boolean indreservable; + @Column(name = "INDCANCELABLE") + private Boolean indcancelable; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "CANTDIASANTICIPACION") + private Integer cantdiasanticipacion; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingAsientoList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingMercadoList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingMarcaList; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingRutaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingDiaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingImporteList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingTipoptovtaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingCategoriaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingVigenciaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingClaseList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingCorridaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingPuntoventaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingTipoServicioList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingOcupaAntecipaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingFormapagoList; + @Column(name = "INDGENERAFERIADOVIAJE") + private String indGeneraFeriadoViaje; + @Column(name = "INDGENERAFERIADOVENTA") + private String indGeneraFeriadoVenta; + + public enum GerarFeriado { + // Declaração dos enum + GERARSEMPRE("GERAR SEMPRE", "S"), + + GERARQUANDOFERIADO("GERAR SÓ QUANDO FOR FERIADO", "F"), + + GERARQUANDONAOFERIADO("GERAR QUANDO NÃO FOR FERIADO", "N"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private GerarFeriado(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + } + + public Pricing() { + } + + public Pricing(Integer pricingId) { + this.pricingId = pricingId; + } + + public Integer getPricingId() { + return pricingId; + } + + public void setPricingId(Integer pricingId) { + this.pricingId = pricingId; + } + + public Short getCantboleto() { + return cantboleto; + } + + public Integer getCantdiasanticipacion() { + return cantdiasanticipacion; + } + + public void setCantdiasanticipacion(Integer cantdiasanticipacion) { + this.cantdiasanticipacion = cantdiasanticipacion; + } + + public void setCantboleto(Short cantboleto) { + this.cantboleto = cantboleto; + } + + public BigDecimal getDescuentoporcentaje() { + return descuentoporcentaje; + } + + public void setDescuentoporcentaje(BigDecimal descuentoporcentaje) { + this.descuentoporcentaje = descuentoporcentaje; + } + + public BigDecimal getDescuentoporcredondo() { + return descuentoporcredondo; + } + + public void setDescuentoporcredondo(BigDecimal descuentoporcredondo) { + this.descuentoporcredondo = descuentoporcredondo; + } + + public Boolean getIndtransferible() { + return indtransferible; + } + + public void setIndtransferible(Boolean indtransferible) { + this.indtransferible = indtransferible; + } + + public Boolean getIndreservable() { + return indreservable; + } + + public void setIndreservable(Boolean indreservable) { + this.indreservable = indreservable; + } + + public Boolean getIndcancelable() { + return indcancelable; + } + + public void setIndcancelable(Boolean indcancelable) { + this.indcancelable = indcancelable; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPricingOcupaAntecipaList() { + List poaList = new ArrayList(); + for (PricingOcupaAntecipa poa : this.pricingOcupaAntecipaList) { + if (poa.getActivo() != EXCLUIDO.intValue()) { + poaList.add(poa); + } + } + return poaList; + } + + public void setPricingOcupaAntecipaList(List pricingOcupaAntecipaList) { + this.pricingOcupaAntecipaList = pricingOcupaAntecipaList; + } + + public List getPricingAsientoList() { + List paList = new ArrayList(); + for (PricingAsiento pa : this.pricingAsientoList) { + if (pa.getActivo() != EXCLUIDO.intValue()) { + paList.add(pa); + } + } + + return paList; + } + + public void setPricingAsientoList(List pricingAsientoList) { + this.pricingAsientoList = pricingAsientoList; + } + + public List getPricingMercadoList() { + List pmList = new ArrayList(); + for (PricingMercado pm : this.pricingMercadoList) { + if (pm.getActivo() != EXCLUIDO.intValue()) { + pmList.add(pm); + } + } + + return pmList; + } + + public void setPricingMercadoList(List pricingMercadoList) { + this.pricingMercadoList = pricingMercadoList; + } + + public List getPricingMarcaList() { + List pmList = new ArrayList(); + for (PricingMarca pm : this.pricingMarcaList) { + if (pm.getActivo() != EXCLUIDO.intValue()) { + pmList.add(pm); + } + } + + return pmList; + } + + public void setPricingMarcaList(List pricingMarcaList) { + this.pricingMarcaList = pricingMarcaList; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public List getPricingRutaList() { + List prList = new ArrayList(); + for (PricingRuta pr : this.pricingRutaList) { + if (pr.getActivo() != EXCLUIDO.intValue()) { + prList.add(pr); + } + } + + return prList; + } + + public void setPricingRutaList(List pricingRutaList) { + this.pricingRutaList = pricingRutaList; + } + + public List getPricingDiaList() { + List pdList = new ArrayList(); + for (PricingDia pd : this.pricingDiaList) { + if (pd.getActivo() != EXCLUIDO.intValue()) { + pdList.add(pd); + } + } + + return pdList; + } + + public void setPricingDiaList(List pricingDiaList) { + this.pricingDiaList = pricingDiaList; + } + + public List getPricingImporteList() { + List piList = new ArrayList(); + for (PricingImporte pi : this.pricingImporteList) { + if (pi.getActivo() != EXCLUIDO.intValue()) { + piList.add(pi); + } + } + + return piList; + } + + public void setPricingImporteList(List pricingImporteList) { + this.pricingImporteList = pricingImporteList; + } + + public List getPricingTipoptovtaList() { + List ptList = new ArrayList(); + for (PricingTipoPtoVta pt : this.pricingTipoptovtaList) { + if (pt.getActivo() != EXCLUIDO.intValue()) { + ptList.add(pt); + } + } + + return ptList; + } + + public void setPricingTipoptovtaList(List pricingTipoptovtaList) { + this.pricingTipoptovtaList = pricingTipoptovtaList; + } + + public List getPricingCategoriaList() { + List pcList = new ArrayList(); + for (PricingCategoria pc : this.pricingCategoriaList) { + if (pc.getActivo() != EXCLUIDO.intValue()) { + pcList.add(pc); + } + } + + return pcList; + } + + public void setPricingCategoriaList(List pricingCategoriaList) { + this.pricingCategoriaList = pricingCategoriaList; + } + + public List getPricingVigenciaList() { + List pvList = new ArrayList(); + if (this.pricingVigenciaList != null) { + for (PricingVigencia pv : this.pricingVigenciaList) { + if (pv.getActivo() != EXCLUIDO.intValue()) { + pvList.add(pv); + } + } + } + + return pvList; + } + + public void setPricingVigenciaList(List pricingVigenciaList) { + this.pricingVigenciaList = pricingVigenciaList; + } + + public List getPricingClaseList() { + List pcList = new ArrayList(); + for (PricingClase pc : this.pricingClaseList) { + if (pc.getActivo() != EXCLUIDO.intValue()) { + pcList.add(pc); + } + } + + return pcList; + } + + public void setPricingClaseList(List pricingClaseList) { + this.pricingClaseList = pricingClaseList; + } + + public List getPricingCorridaList() { + List pcList = new ArrayList(); + if (pricingCorridaList == null) { + return null; + } + + for (PricingCorrida pc : this.pricingCorridaList) { + if (pc.getActivo() != EXCLUIDO.intValue()) { + pcList.add(pc); + } + } + + return pcList; + } + + public void setPricingCorridaList(List pricingCorridaList) { + this.pricingCorridaList = pricingCorridaList; + } + + public List getPricingPuntoventaList() { + List ppList = new ArrayList(); + for (PricingPuntoVenta pp : this.pricingPuntoventaList) { + if (pp.getActivo() != EXCLUIDO.intValue()) { + ppList.add(pp); + } + } + + return ppList; + } + + public void setPricingPuntoventaList(List pricingPuntoventaList) { + this.pricingPuntoventaList = pricingPuntoventaList; + } + + public List getPricingTipoServicioList() { + List ppList = new ArrayList(); + for (PricingTipoServicio pp : this.pricingTipoServicioList) { + if (pp.getActivo() != EXCLUIDO.intValue()) { + ppList.add(pp); + } + } + + return ppList; + } + + public void setPricingTipoServicioList(List pricingTipoServicioList) { + this.pricingTipoServicioList = pricingTipoServicioList; + } + + public List getPricingFormapagoList() { + + List pfpList = new ArrayList(); + for (PricingFormapago pfp : this.pricingFormapagoList) { + if (pfp.getActivo() != EXCLUIDO.intValue()) { + pfpList.add(pfp); + } + } + + return pfpList; + } + + public void setPricingFormapagoList(List pricingFormapagoList) { + this.pricingFormapagoList = pricingFormapagoList; + } + + public String getIndGeneraFeriadoViaje() { + return indGeneraFeriadoViaje; + } + + public void setIndGeneraFeriadoViaje(String indGeneraFeriadoViaje) { + this.indGeneraFeriadoViaje = indGeneraFeriadoViaje; + } + + public String getIndGeneraFeriadoVenta() { + return indGeneraFeriadoVenta; + } + + public void setIndGeneraFeriadoVenta(String indGeneraFeriadoVenta) { + this.indGeneraFeriadoVenta = indGeneraFeriadoVenta; + } + + public String getNombPricing() { + return nombPricing; + } + + public void setNombPricing(String nombPricing) { + this.nombPricing = nombPricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingId != null ? pricingId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Pricing)) { + return false; + } + Pricing other = (Pricing) object; + if ((this.pricingId == null && other.pricingId != null) || (this.pricingId != null && !this.pricingId.equals(other.pricingId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.Pricing[pricingId=" + pricingId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingAsiento.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingAsiento.java new file mode 100644 index 000000000..3148bbfac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingAsiento.java @@ -0,0 +1,149 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_ASIENTO_SEQ", sequenceName = "PRICING_ASIENTO_SEQ", allocationSize = 1) +@Table(name = "PRICING_ASIENTO") +public class PricingAsiento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ASIENTO_SEQ") + @Column(name = "PRICINGASIENTO_ID") + private Integer pricingasientoId; + @Column(name = "NUMEASIENTO") + private String numeasiento; + @Column(name = "NOMBIMAGEN") + private String nombImagen; + @Column(name = "PORCENTAJE") + private BigDecimal porcentaje; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingAsiento() { + } + + public PricingAsiento(Integer pricingasientoId) { + this.pricingasientoId = pricingasientoId; + } + + public Integer getPricingasientoId() { + return pricingasientoId; + } + + public void setPricingasientoId(Integer pricingasientoId) { + this.pricingasientoId = pricingasientoId; + } + + public String getNumeasiento() { + return numeasiento; + } + + public void setNumeasiento(String numeasiento) { + this.numeasiento = numeasiento; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public String getNombImagen() { + return nombImagen; + } + + public void setNombImagen(String nombImagen) { + this.nombImagen = nombImagen; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingasientoId != null ? pricingasientoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingAsiento)) { + return false; + } + PricingAsiento other = (PricingAsiento) object; + if ((this.pricingasientoId == null && other.pricingasientoId != null) || (this.pricingasientoId != null && !this.pricingasientoId.equals(other.pricingasientoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingAsiento[pricingasientoId=" + pricingasientoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingCategoria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingCategoria.java new file mode 100644 index 000000000..ed0aa8a88 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingCategoria.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_CATEGORIA_SEQ", sequenceName = "PRICING_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_CATEGORIA") +public class PricingCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CATEGORIA_SEQ") + @Column(name = "PRICINGCATEGORIA_ID") + private Integer pricingcategoriaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + public PricingCategoria() { + } + + public PricingCategoria(Integer pricingcategoriaId) { + this.pricingcategoriaId = pricingcategoriaId; + } + + public Integer getPricingcategoriaId() { + return pricingcategoriaId; + } + + public void setPricingcategoriaId(Integer pricingcategoriaId) { + this.pricingcategoriaId = pricingcategoriaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingcategoriaId != null ? pricingcategoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingCategoria)) { + return false; + } + PricingCategoria other = (PricingCategoria) object; + if ((this.pricingcategoriaId == null && other.pricingcategoriaId != null) || (this.pricingcategoriaId != null && !this.pricingcategoriaId.equals(other.pricingcategoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingCategoria[pricingcategoriaId=" + pricingcategoriaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingClase.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingClase.java new file mode 100644 index 000000000..e0833e344 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingClase.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_CLASE_SEQ", sequenceName = "PRICING_CLASE_SEQ", allocationSize = 1) +@Table(name = "PRICING_CLASE") +public class PricingClase implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CLASE_SEQ") + @Column(name = "PRICINGCLASE_ID") + private Integer pricingclaseId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public PricingClase() { + } + + public PricingClase(Integer pricingclaseId) { + this.pricingclaseId = pricingclaseId; + } + + public Integer getPricingclaseId() { + return pricingclaseId; + } + + public void setPricingclaseId(Integer pricingclaseId) { + this.pricingclaseId = pricingclaseId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingclaseId != null ? pricingclaseId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingClase)) { + return false; + } + PricingClase other = (PricingClase) object; + if ((this.pricingclaseId == null && other.pricingclaseId != null) || (this.pricingclaseId != null && !this.pricingclaseId.equals(other.pricingclaseId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingClase[pricingclaseId=" + pricingclaseId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingClasseTarifaria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingClasseTarifaria.java new file mode 100644 index 000000000..ae0ecbc08 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingClasseTarifaria.java @@ -0,0 +1,127 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_CLASSE_TARIFARIA_SEQ", sequenceName = "PRICING_CLASSE_TARIFARIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_CLASSE_TARIFARIA") +public class PricingClasseTarifaria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CLASSE_TARIFARIA_SEQ") + @Column(name = "PRICINGCLASSETARIFARIA_ID") + private Integer pricingClasseTarifariaId; + @Column(name = "DESCCLASSE_TARIFARIA") + private String descClasseTarifaria; + @Column(name = "SIGLA") + private String sigla; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getPricingClasseTarifariaId() { + return pricingClasseTarifariaId; + } + + public void setPricingClasseTarifariaId(Integer pricingClasseTarifariaId) { + this.pricingClasseTarifariaId = pricingClasseTarifariaId; + } + + public String getDescClasseTarifaria() { + return descClasseTarifaria; + } + + public void setDescClasseTarifaria(String descClasseTarifaria) { + this.descClasseTarifaria = descClasseTarifaria; + } + + public String getSigla() { + return sigla; + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pricingClasseTarifariaId == null) ? 0 : pricingClasseTarifariaId.hashCode()); + result = prime * result + ((sigla == null) ? 0 : sigla.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PricingClasseTarifaria other = (PricingClasseTarifaria) obj; + if (pricingClasseTarifariaId == null) { + if (other.pricingClasseTarifariaId != null) + return false; + } else if (!pricingClasseTarifariaId.equals(other.pricingClasseTarifariaId)) + return false; + if (sigla == null) { + if (other.sigla != null) + return false; + } else if (!sigla.equals(other.sigla)) + return false; + return true; + } + + @Override + public String toString() { + return descClasseTarifaria + " - " + sigla; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingCorrida.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingCorrida.java new file mode 100644 index 000000000..dffc1443b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingCorrida.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_CORRIDA_SEQ", sequenceName = "PRICING_CORRIDA_SEQ", allocationSize = 1) +@Table(name = "PRICING_CORRIDA") +public class PricingCorrida implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CORRIDA_SEQ") + @Column(name = "PRICINGCORRIDA_ID") + private Integer pricingcorridaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID") + @ManyToOne + private CorridaCtrl corridaCtrl; + + public PricingCorrida() { + } + + public PricingCorrida(Integer pricingcorridaId) { + this.pricingcorridaId = pricingcorridaId; + } + + public Integer getPricingcorridaId() { + return pricingcorridaId; + } + + public void setPricingcorridaId(Integer pricingcorridaId) { + this.pricingcorridaId = pricingcorridaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public CorridaCtrl getCorridaCtrl() { + return corridaCtrl; + } + + public void setCorridaCtrl(CorridaCtrl corridaCtrl) { + this.corridaCtrl = corridaCtrl; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingcorridaId != null ? pricingcorridaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingCorrida)) { + return false; + } + PricingCorrida other = (PricingCorrida) object; + if ((this.pricingcorridaId == null && other.pricingcorridaId != null) || (this.pricingcorridaId != null && !this.pricingcorridaId.equals(other.pricingcorridaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingCorrida[pricingcorridaId=" + pricingcorridaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingDia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingDia.java new file mode 100644 index 000000000..5394500e5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingDia.java @@ -0,0 +1,232 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_DIA_SEQ", sequenceName = "PRICING_DIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_DIA") +public class PricingDia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_DIA_SEQ") + @Column(name = "PRICINGDIA_ID") + private Integer pricingdiaId; + @Column(name = "INDLUNES") + private Boolean indlunes; + @Column(name = "INDMARTES") + private Boolean indmartes; + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + @Column(name = "INDJUEVES") + private Boolean indjueves; + @Column(name = "INDVIERNES") + private Boolean indviernes; + @Column(name = "INDSABADO") + private Boolean indsabado; + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + @Column(name = "HORARIOINICIO") + @Temporal(TemporalType.TIMESTAMP) + // Fue cambido de TIME para TIMESTAMP porque cuando está time el año que se salva el 1900 y no 1970. + private Date horarioinicio; + @Column(name = "HORARIOFIN") + @Temporal(TemporalType.TIMESTAMP) + // Fue cambido de TIME para TIMESTAMP porque cuando está time el año que se salva el 1900 y no 1970. + private Date horariofin; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDFECVIAJE") + private Boolean indfecviaje; + @Column(name = "INDFECVENTA") + private Boolean indfecventa; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingDia() { + } + + public PricingDia(Integer pricingdiaId) { + this.pricingdiaId = pricingdiaId; + } + + public Integer getPricingdiaId() { + return pricingdiaId; + } + + public void setPricingdiaId(Integer pricingdiaId) { + this.pricingdiaId = pricingdiaId; + } + + public Boolean getInddomingo() { + return inddomingo; + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + public Boolean getIndjueves() { + return indjueves; + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndlunes() { + return indlunes; + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return indmartes; + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return indmiercoles; + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndsabado() { + return indsabado; + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getIndviernes() { + return indviernes; + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Date getHorarioinicio() { + return horarioinicio; + } + + public void setHorarioinicio(Date horarioinicio) { + this.horarioinicio = horarioinicio; + } + + public Date getHorariofin() { + return horariofin; + } + + public void setHorariofin(Date horariofin) { + this.horariofin = horariofin; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndfecviaje() { + return indfecviaje; + } + + public void setIndfecviaje(Boolean indfecviaje) { + this.indfecviaje = indfecviaje; + } + + public Boolean getIndfecventa() { + return indfecventa; + } + + public void setIndfecventa(Boolean indfecventa) { + this.indfecventa = indfecventa; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingdiaId != null ? pricingdiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingDia)) { + return false; + } + PricingDia other = (PricingDia) object; + if ((this.pricingdiaId == null && other.pricingdiaId != null) || (this.pricingdiaId != null && !this.pricingdiaId.equals(other.pricingdiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingDia[pricingdiaId=" + pricingdiaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingEspecifico.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingEspecifico.java new file mode 100644 index 000000000..1d47e6130 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingEspecifico.java @@ -0,0 +1,279 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_ESPECIFICO_SEQ", sequenceName = "PRICING_ESPECIFICO_SEQ", allocationSize = 1) +@Table(name = "PRICING_ESPECIFICO") +public class PricingEspecifico implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESPECIFICO_SEQ") + @Column(name = "PRICINGESPECIFICO_ID") + private Long pricingespecificoId; + @Column(name = "NOMBPRICING") + private String nombPricing; + @Column(name = "FECHORINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorinicio; + @Column(name = "FECHORFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorfin; + @Column(name = "TARIFA") + private BigDecimal tarifa; + @Column(name = "TARIFAREDABIERTO") + private BigDecimal tarifaredabierto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPtovta; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada1; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @OneToMany(mappedBy = "pricingEspecifico", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List pricingEspecificoOcupacionsList; + + public PricingEspecifico() { + } + + public PricingEspecifico(Long pricingespecificoId) { + this.pricingespecificoId = pricingespecificoId; + } + + public Long getPricingespecificoId() { + return pricingespecificoId; + } + + public void setPricingespecificoId(Long pricingespecificoId) { + this.pricingespecificoId = pricingespecificoId; + } + + public Date getFechorinicio() { + return fechorinicio; + } + + public void setFechorinicio(Date fechorinicio) { + this.fechorinicio = fechorinicio; + } + + public Date getFechorfin() { + return fechorfin; + } + + public void setFechorfin(Date fechorfin) { + this.fechorfin = fechorfin; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getTarifaredabierto() { + return tarifaredabierto; + } + + public void setTarifaredabierto(BigDecimal tarifaredabierto) { + this.tarifaredabierto = tarifaredabierto; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPtovta() { + return tipoPtovta; + } + + public void setTipoPtovta(TipoPuntoVenta tipoPtovta) { + this.tipoPtovta = tipoPtovta; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Parada getParada1() { + return parada1; + } + + public void setParada1(Parada parada1) { + this.parada1 = parada1; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public String getNombPricing() { + return nombPricing; + } + + public void setNombPricing(String nombPricing) { + this.nombPricing = nombPricing; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public List getPricingEspecificoOcupacionsList() { + return this.pricingEspecificoOcupacionsList; + } + + public void setPricingEspecificoOcupacionsList(List pricingEspecificoOcupacionsList) { + this.pricingEspecificoOcupacionsList = pricingEspecificoOcupacionsList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingespecificoId != null ? pricingespecificoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PricingEspecifico)) { + return false; + } + PricingEspecifico other = (PricingEspecifico) object; + if ((this.pricingespecificoId == null && other.pricingespecificoId != null) || (this.pricingespecificoId != null && !this.pricingespecificoId.equals(other.pricingespecificoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingEspecifico[pricingespecificoId=" + pricingespecificoId + "]"; + } + + @Transient + public List getPricingEspecificoOcupacionsListActivos() { + List peoList = new ArrayList(); + if(getPricingEspecificoOcupacionsList() != null) { + for (PricingEspecificoOcupacion peo : getPricingEspecificoOcupacionsList()) { + if (peo.getActivo()) { + peoList.add(peo); + } + } + } + return peoList; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoOcupacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoOcupacion.java new file mode 100644 index 000000000..8b7128824 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoOcupacion.java @@ -0,0 +1,146 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_ESPECIFICO_OCUP_SEQ", sequenceName = "PRICING_ESPECIFICO_OCUP_SEQ", allocationSize = 1) +@Table(name = "PRICING_ESPECIFICO_OCUPACION") +public class PricingEspecificoOcupacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESPECIFICO_OCUP_SEQ") + @Column(name = "PRICINGESPECIFICOOCUPACION_ID") + private Integer pricingEspecificoOcupacionId; + @Column(name = "OCUPACIONINICIAL") + private BigDecimal ocupacioninicial; + @Column(name = "OCUPACIONFINAL") + private BigDecimal ocupacionfinal; + @Column(name = "TARIFA") + private BigDecimal tarifa; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID") + @ManyToOne + private PricingEspecifico pricingEspecifico; + + public Integer getPricingEspecificoOcupacionId() { + return pricingEspecificoOcupacionId; + } + + public void setPricingEspecificoOcupacionId(Integer pricingEspecificoOcupacionId) { + this.pricingEspecificoOcupacionId = pricingEspecificoOcupacionId; + } + + public BigDecimal getOcupacioninicial() { + return ocupacioninicial; + } + + public void setOcupacioninicial(BigDecimal ocupacioninicial) { + this.ocupacioninicial = ocupacioninicial; + } + + public BigDecimal getOcupacionfinal() { + return ocupacionfinal; + } + + public void setOcupacionfinal(BigDecimal ocupacionfinal) { + this.ocupacionfinal = ocupacionfinal; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PricingEspecifico getPricingEspecifico() { + return pricingEspecifico; + } + + public void setPricingEspecifico(PricingEspecifico pricingEspecifico) { + this.pricingEspecifico = pricingEspecifico; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pricingEspecificoOcupacionId == null) ? 0 : pricingEspecificoOcupacionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PricingEspecificoOcupacion other = (PricingEspecificoOcupacion) obj; + if (pricingEspecificoOcupacionId == null) { + if (other.pricingEspecificoOcupacionId != null) + return false; + } else if (!pricingEspecificoOcupacionId.equals(other.pricingEspecificoOcupacionId)) + return false; + return true; + } + + @Override + public String toString() { + return "PricingEspecificoOcupacion [pricingEspecificoOcupacionId=" + pricingEspecificoOcupacionId + ", ocupacioninicial=" + ocupacioninicial + ", ocupacionfinal=" + ocupacionfinal + ", tarifa=" + tarifa + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", pricingEspecifico=" + pricingEspecifico + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingFormapago.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingFormapago.java new file mode 100644 index 000000000..28b8462e9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingFormapago.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_FORMAPAGO_SEQ", sequenceName = "PRICING_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "PRICING_FORMAPAGO") +public class PricingFormapago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_FORMAPAGO_SEQ") + @Column(name = "PRICINGFORMAPAGO_ID") + private Integer pricingformapagoId; + @Column(name = "INDEXCEPCION") + private Boolean indexcepcion; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + + public PricingFormapago() { + } + + public PricingFormapago(Integer pricingformapagoId) { + this.pricingformapagoId = pricingformapagoId; + } + + public PricingFormapago(Integer pricingformapagoId, Boolean indexcepcion, Integer activo, Date fecmodif, Integer usuarioId, Pricing pricing, FormaPago formaPago) { + this.pricingformapagoId = pricingformapagoId; + this.indexcepcion = indexcepcion; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.pricing = pricing; + this.formaPago = formaPago; + } + + public Integer getPricingformapagoId() { + return pricingformapagoId; + } + + public void setPricingformapagoId(Integer pricingformapagoId) { + this.pricingformapagoId = pricingformapagoId; + } + + public Boolean getIndexcepcion() { + return indexcepcion; + } + + public void setIndexcepcion(Boolean indexcepcion) { + this.indexcepcion = indexcepcion; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingformapagoId != null ? pricingformapagoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingFormapago)) { + return false; + } + PricingFormapago other = (PricingFormapago) object; + if ((this.pricingformapagoId == null && other.pricingformapagoId != null) || (this.pricingformapagoId != null && !this.pricingformapagoId.equals(other.pricingformapagoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PricingFormapago[pricingformapagoId=" + pricingformapagoId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingImporte.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingImporte.java new file mode 100644 index 000000000..93ce57ec2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingImporte.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_IMPORTE_SEQ", sequenceName = "PRICING_IMPORTE_SEQ", allocationSize = 1) +@Table(name = "PRICING_IMPORTE") +public class PricingImporte implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_IMPORTE_SEQ") + @Column(name = "PRICINGIMPORTE_ID") + private Integer pricingimporteId; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + + public PricingImporte() { + } + + public PricingImporte(Integer pricingimporteId) { + this.pricingimporteId = pricingimporteId; + } + + public Integer getPricingimporteId() { + return pricingimporteId; + } + + public void setPricingimporteId(Integer pricingimporteId) { + this.pricingimporteId = pricingimporteId; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingimporteId != null ? pricingimporteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingImporte)) { + return false; + } + PricingImporte other = (PricingImporte) object; + if ((this.pricingimporteId == null && other.pricingimporteId != null) || (this.pricingimporteId != null && !this.pricingimporteId.equals(other.pricingimporteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingImporte[pricingimporteId=" + pricingimporteId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingMarca.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingMarca.java new file mode 100644 index 000000000..7cebd48d7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingMarca.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_MARCA_SEQ", sequenceName = "PRICING_MARCA_SEQ", allocationSize = 1) +@Table(name = "PRICING_MARCA") +public class PricingMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_MARCA_SEQ") + @Column(name = "PRICINGMARCA_ID") + private Integer pricingmarcaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public PricingMarca() { + } + + public PricingMarca(Integer pricingmarcaId) { + this.pricingmarcaId = pricingmarcaId; + } + + public Integer getPricingmarcaId() { + return pricingmarcaId; + } + + public void setPricingmarcaId(Integer pricingmarcaId) { + this.pricingmarcaId = pricingmarcaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingmarcaId != null ? pricingmarcaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingMarca)) { + return false; + } + PricingMarca other = (PricingMarca) object; + if ((this.pricingmarcaId == null && other.pricingmarcaId != null) || (this.pricingmarcaId != null && !this.pricingmarcaId.equals(other.pricingmarcaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingMarca[pricingmarcaId=" + pricingmarcaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingMercado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingMercado.java new file mode 100644 index 000000000..7fbfd84e3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingMercado.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_MERCADO_SEQ", sequenceName = "PRICING_MERCADO_SEQ", allocationSize = 1) +@Table(name = "PRICING_MERCADO") +public class PricingMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_MERCADO_SEQ") + @Column(name = "PRICINGPARADA_ID") + private Integer pricingparadaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origen; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + + public PricingMercado() { + } + + public PricingMercado(Integer pricingparadaId) { + this.pricingparadaId = pricingparadaId; + } + + public Integer getPricingparadaId() { + return pricingparadaId; + } + + public void setPricingparadaId(Integer pricingparadaId) { + this.pricingparadaId = pricingparadaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingparadaId != null ? pricingparadaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingMercado)) { + return false; + } + PricingMercado other = (PricingMercado) object; + if ((this.pricingparadaId == null && other.pricingparadaId != null) || (this.pricingparadaId != null && !this.pricingparadaId.equals(other.pricingparadaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingMercado[pricingparadaId=" + pricingparadaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java new file mode 100644 index 000000000..e7da8b816 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java @@ -0,0 +1,199 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_OCUPA_ANTECIPA_SEQ", sequenceName = "PRICING_OCUPA_ANTECIPA_SEQ", allocationSize = 1) +@Table(name = "PRICING_OCUPA_ANTECIPA") +public class PricingOcupaAntecipa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_OCUPA_ANTECIPA_SEQ") + @Column(name = "PRICINGOCUPAANTECIPA_ID") + private Integer pricingocupaantecipaId; + @Column(name = "CANTDIASMIN") + private Integer cantdiasmin; + @Column(name = "CANTDIASMAX") + private Integer cantdiasmax; + @Column(name = "CANTASIENTOSMIN") + private Integer cantasientosmin; + @Column(name = "CANTASIENTOSMAX") + private Integer cantasientosmax; + @Column(name = "PORCENTAJE") + private BigDecimal porcentaje; + @Column(name = "OCUPACIONINICIAL") + private BigDecimal ocupacioninicial; + @Column(name = "OCUPACIONFINAL") + private BigDecimal ocupacionfinal; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Integer activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "PRICINGCLASSETARIFARIA_ID", referencedColumnName = "PRICINGCLASSETARIFARIA_ID") + @ManyToOne + private PricingClasseTarifaria pricingClasseTarifaria; + + public Integer getPricingocupaantecipaId() { + return pricingocupaantecipaId; + } + + public void setPricingocupaantecipaId(Integer pricingocupaantecipaId) { + this.pricingocupaantecipaId = pricingocupaantecipaId; + } + + public Integer getCantdiasmin() { + return cantdiasmin; + } + + public void setCantdiasmin(Integer cantdiasmin) { + this.cantdiasmin = cantdiasmin; + } + + public Integer getCantdiasmax() { + return cantdiasmax; + } + + public void setCantdiasmax(Integer cantdiasmax) { + this.cantdiasmax = cantdiasmax; + } + + public Integer getCantasientosmin() { + return cantasientosmin; + } + + public void setCantasientosmin(Integer cantasientosmin) { + this.cantasientosmin = cantasientosmin; + } + + public Integer getCantasientosmax() { + return cantasientosmax; + } + + public void setCantasientosmax(Integer cantasientosmax) { + this.cantasientosmax = cantasientosmax; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public BigDecimal getOcupacioninicial() { + return ocupacioninicial; + } + + public void setOcupacioninicial(BigDecimal ocupacioninicial) { + this.ocupacioninicial = ocupacioninicial; + } + + public BigDecimal getOcupacionfinal() { + return ocupacionfinal; + } + + public void setOcupacionfinal(BigDecimal ocupacionfinal) { + this.ocupacionfinal = ocupacionfinal; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public PricingClasseTarifaria getPricingClasseTarifaria() { + return pricingClasseTarifaria; + } + + public void setPricingClasseTarifaria(PricingClasseTarifaria pricingClasseTarifaria) { + this.pricingClasseTarifaria = pricingClasseTarifaria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingocupaantecipaId != null ? pricingocupaantecipaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingOcupaAntecipa)) { + return false; + } + PricingOcupaAntecipa other = (PricingOcupaAntecipa) object; + if ((this.pricingocupaantecipaId == null && other.pricingocupaantecipaId != null) || (this.pricingocupaantecipaId != null && !this.pricingocupaantecipaId.equals(other.pricingocupaantecipaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa[ pricingocupaantecipaId=" + pricingocupaantecipaId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingPuntoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingPuntoVenta.java new file mode 100644 index 000000000..f6b6e78df --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingPuntoVenta.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_PUNTOVENTA_SEQ", sequenceName = "PRICING_PUNTOVENTA_SEQ", allocationSize = 1) +@Table(name = "PRICING_PUNTOVENTA") +public class PricingPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_PUNTOVENTA_SEQ") + @Column(name = "PRICINGPTOVTA_ID") + private Integer pricingptovtaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingPuntoVenta() { + } + + public PricingPuntoVenta(Integer pricingptovtaId) { + this.pricingptovtaId = pricingptovtaId; + } + + public Integer getPricingptovtaId() { + return pricingptovtaId; + } + + public void setPricingptovtaId(Integer pricingptovtaId) { + this.pricingptovtaId = pricingptovtaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingptovtaId != null ? pricingptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingPuntoVenta)) { + return false; + } + PricingPuntoVenta other = (PricingPuntoVenta) object; + if ((this.pricingptovtaId == null && other.pricingptovtaId != null) || (this.pricingptovtaId != null && !this.pricingptovtaId.equals(other.pricingptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingPuntoventa[pricingptovtaId=" + pricingptovtaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingRuta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingRuta.java new file mode 100644 index 000000000..86ec04f4e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingRuta.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_RUTA_SEQ", sequenceName = "PRICING_RUTA_SEQ", allocationSize = 1) +@Table(name = "PRICING_RUTA") +public class PricingRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_RUTA_SEQ") + @Column(name = "PRICINGRUTA_ID") + private Integer pricingrutaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingRuta() { + } + + public PricingRuta(Integer pricingrutaId) { + this.pricingrutaId = pricingrutaId; + } + + public Integer getPricingrutaId() { + return pricingrutaId; + } + + public void setPricingrutaId(Integer pricingrutaId) { + this.pricingrutaId = pricingrutaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingrutaId != null ? pricingrutaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingRuta)) { + return false; + } + PricingRuta other = (PricingRuta) object; + if ((this.pricingrutaId == null && other.pricingrutaId != null) || (this.pricingrutaId != null && !this.pricingrutaId.equals(other.pricingrutaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingRuta[pricingrutaId=" + pricingrutaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingTipoPtoVta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingTipoPtoVta.java new file mode 100644 index 000000000..de9edb817 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingTipoPtoVta.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_TIPOPTOVTA_SEQ", sequenceName = "PRICING_TIPOPTOVTA_SEQ", allocationSize = 1) +@Table(name = "PRICING_TIPOPTOVTA") +public class PricingTipoPtoVta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_TIPOPTOVTA_SEQ") + @Column(name = "PRICINGTIPOPTOVTA_ID") + private Integer pricingtipoptovtaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPtovta; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingTipoPtoVta() { + } + + public PricingTipoPtoVta(Integer pricingtipoptovtaId) { + this.pricingtipoptovtaId = pricingtipoptovtaId; + } + + public Integer getPricingtipoptovtaId() { + return pricingtipoptovtaId; + } + + public void setPricingtipoptovtaId(Integer pricingtipoptovtaId) { + this.pricingtipoptovtaId = pricingtipoptovtaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPtovta() { + return tipoPtovta; + } + + public void setTipoPtovta(TipoPuntoVenta tipoPtovta) { + this.tipoPtovta = tipoPtovta; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingtipoptovtaId != null ? pricingtipoptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingTipoPtoVta)) { + return false; + } + PricingTipoPtoVta other = (PricingTipoPtoVta) object; + if ((this.pricingtipoptovtaId == null && other.pricingtipoptovtaId != null) || (this.pricingtipoptovtaId != null && !this.pricingtipoptovtaId.equals(other.pricingtipoptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingTipoptovta[pricingtipoptovtaId=" + pricingtipoptovtaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingTipoServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingTipoServicio.java new file mode 100644 index 000000000..c97087d99 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingTipoServicio.java @@ -0,0 +1,132 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "PRICING_TIPOSERVICIO_SEQ", sequenceName = "PRICING_TIPOSERVICIO_SEQ", allocationSize = 1) +@Table(name = "PRICING_TIPOSERVICIO") +public class PricingTipoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_TIPOSERVICIO_SEQ") + @Column(name = "PRICINGTIPOSERVICIO_ID") + private Integer pricingtiposervicioId; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Integer activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "TIPOSERVICIO_ID", referencedColumnName = "TIPOSERVICIO_ID") + @ManyToOne + private TipoServicio tipoServicio; + + public PricingTipoServicio() { + } + + public PricingTipoServicio(Integer pricingtiposervicioId) { + this.pricingtiposervicioId = pricingtiposervicioId; + } + + public Integer getPricingtiposervicioId() { + return pricingtiposervicioId; + } + + public void setPricingtiposervicioId(Integer pricingtiposervicioId) { + this.pricingtiposervicioId = pricingtiposervicioId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public TipoServicio getTipoServicio() { + return tipoServicio; + } + + public void setTipoServicio(TipoServicio tipoServicio) { + this.tipoServicio = tipoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingtiposervicioId != null ? pricingtiposervicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingTipoServicio)) { + return false; + } + PricingTipoServicio other = (PricingTipoServicio) object; + if ((this.pricingtiposervicioId == null && other.pricingtiposervicioId != null) || (this.pricingtiposervicioId != null && !this.pricingtiposervicioId.equals(other.pricingtiposervicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PricingTiposervicio[pricingtiposervicioId=" + pricingtiposervicioId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingVigencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingVigencia.java new file mode 100644 index 000000000..6ba07c630 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PricingVigencia.java @@ -0,0 +1,162 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_VIGENCIA_SEQ", sequenceName = "PRICING_VIGENCIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_VIGENCIA") +public class PricingVigencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_VIGENCIA_SEQ") + @Column(name = "PRICINGVIGENCIA_ID") + private Integer pricingvigenciaId; + @Column(name = "FECINICIOVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicioviaje; + @Column(name = "FECFINVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinviaje; + @Column(name = "FECINICIOVENTA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicioventa; + @Column(name = "FECFINVENTA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinventa; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingVigencia() { + } + + public PricingVigencia(Integer pricingvigenciaId) { + this.pricingvigenciaId = pricingvigenciaId; + } + + public Integer getPricingvigenciaId() { + return pricingvigenciaId; + } + + public void setPricingvigenciaId(Integer pricingvigenciaId) { + this.pricingvigenciaId = pricingvigenciaId; + } + + public Date getFecinicioviaje() { + return fecinicioviaje; + } + + public void setFecinicioviaje(Date fecinicioviaje) { + this.fecinicioviaje = fecinicioviaje; + } + + public Date getFecfinviaje() { + return fecfinviaje; + } + + public void setFecfinviaje(Date fecfinviaje) { + this.fecfinviaje = fecfinviaje; + } + + public Date getFecinicioventa() { + return fecinicioventa; + } + + public void setFecinicioventa(Date fecinicioventa) { + this.fecinicioventa = fecinicioventa; + } + + public Date getFecfinventa() { + return fecfinventa; + } + + public void setFecfinventa(Date fecfinventa) { + this.fecfinventa = fecfinventa; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingvigenciaId != null ? pricingvigenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingVigencia)) { + return false; + } + PricingVigencia other = (PricingVigencia) object; + if ((this.pricingvigenciaId == null && other.pricingvigenciaId != null) || (this.pricingvigenciaId != null && !this.pricingvigenciaId.equals(other.pricingvigenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingVigencia[pricingvigenciaId=" + pricingvigenciaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdClaseServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdClaseServicio.java new file mode 100644 index 000000000..4d35011f4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdClaseServicio.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_CLASESERVICIO_SEQ", sequenceName = "PROD_CLASESERVICIO_SEQ", allocationSize = 1) +@Table(name = "PROD_CLASESERVICIO") +public class ProdClaseServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_CLASESERVICIO_SEQ") + @Column(name = "PRODCLASESERVICIO_ID") + private Integer prodclaseservicioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public ProdClaseServicio() { + } + + public ProdClaseServicio(Integer prodclaseservicioId) { + this.prodclaseservicioId = prodclaseservicioId; + } + + public Integer getProdclaseservicioId() { + return prodclaseservicioId; + } + + public void setProdclaseservicioId(Integer prodclaseservicioId) { + this.prodclaseservicioId = prodclaseservicioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodclaseservicioId != null ? prodclaseservicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdClaseServicio)) { + return false; + } + ProdClaseServicio other = (ProdClaseServicio) object; + if ((this.prodclaseservicioId == null && other.prodclaseservicioId != null) || (this.prodclaseservicioId != null && !this.prodclaseservicioId.equals(other.prodclaseservicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdClaseservicio[prodclaseservicioId=" + prodclaseservicioId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdFormaPago.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdFormaPago.java new file mode 100644 index 000000000..deb07048b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdFormaPago.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_FORMAPAGO_SEQ", sequenceName = "PROD_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "PROD_FORMAPAGO") +public class ProdFormaPago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_FORMAPAGO_SEQ") + @Column(name = "PRODFORMAPAGO_ID") + private Integer prodformapagoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + + public ProdFormaPago() { + } + + public ProdFormaPago(Integer prodformapagoId) { + this.prodformapagoId = prodformapagoId; + } + + public Integer getProdformapagoId() { + return prodformapagoId; + } + + public void setProdformapagoId(Integer prodformapagoId) { + this.prodformapagoId = prodformapagoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodformapagoId != null ? prodformapagoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdFormaPago)) { + return false; + } + ProdFormaPago other = (ProdFormaPago) object; + if ((this.prodformapagoId == null && other.prodformapagoId != null) || (this.prodformapagoId != null && !this.prodformapagoId.equals(other.prodformapagoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdFormapago[prodformapagoId=" + prodformapagoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdMarca.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdMarca.java new file mode 100644 index 000000000..7a0d8fdfe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdMarca.java @@ -0,0 +1,131 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_MARCA_SEQ", sequenceName = "PROD_MARCA_SEQ", allocationSize = 1) +@Table(name = "PROD_MARCA") +public class ProdMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_MARCA_SEQ") + @Column(name = "PRODMARCA_ID") + private Integer prodmarcaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public ProdMarca() { + } + + public ProdMarca(Integer prodmarcaId) { + this.prodmarcaId = prodmarcaId; + } + + public Integer getProdmarcaId() { + return prodmarcaId; + } + + public void setProdmarcaId(Integer prodmarcaId) { + this.prodmarcaId = prodmarcaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodmarcaId != null ? prodmarcaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdMarca)) { + return false; + } + ProdMarca other = (ProdMarca) object; + if ((this.prodmarcaId == null && other.prodmarcaId != null) || (this.prodmarcaId != null && !this.prodmarcaId.equals(other.prodmarcaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdMarca[prodmarcaId=" + prodmarcaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdMercado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdMercado.java new file mode 100644 index 000000000..37b2fcbc4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdMercado.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_MERCADO_SEQ", sequenceName = "PROD_MERCADO_SEQ", allocationSize = 1) +@Table(name = "PROD_MERCADO") +public class ProdMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_MERCADO_SEQ") + @Column(name = "PRODMERCADO_ID") + private Integer prodmercadoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada1; + + public ProdMercado() { + } + + public ProdMercado(Integer prodmercadoId) { + this.prodmercadoId = prodmercadoId; + } + + public Integer getProdmercadoId() { + return prodmercadoId; + } + + public void setProdmercadoId(Integer prodmercadoId) { + this.prodmercadoId = prodmercadoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Parada getParada1() { + return parada1; + } + + public void setParada1(Parada parada1) { + this.parada1 = parada1; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodmercadoId != null ? prodmercadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdMercado)) { + return false; + } + ProdMercado other = (ProdMercado) object; + if ((this.prodmercadoId == null && other.prodmercadoId != null) || (this.prodmercadoId != null && !this.prodmercadoId.equals(other.prodmercadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdMercado[prodmercadoId=" + prodmercadoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdPrecio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdPrecio.java new file mode 100644 index 000000000..6987d5ec3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdPrecio.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "PROD_PRECIO_SEQ", sequenceName = "PROD_PRECIO_SEQ", allocationSize = 1) +@Table(name = "PROD_PRECIO") +public class ProdPrecio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_PRECIO_SEQ") + @Column(name = "PRODPRECIO") + private Integer prodprecio; + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "IMPORTEINICIAL") + private BigDecimal importeinicial; + @Column(name = "IMPORTEFINAL") + private BigDecimal importefinal; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoservicio; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public ProdPrecio() { + } + + public ProdPrecio(Integer prodprecio) { + this.prodprecio = prodprecio; + } + + public Integer getProdprecio() { + return prodprecio; + } + + public void setProdprecio(Integer prodprecio) { + this.prodprecio = prodprecio; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getImporteinicial() { + return importeinicial; + } + + public void setImporteinicial(BigDecimal importeinicial) { + this.importeinicial = importeinicial; + } + + public BigDecimal getImportefinal() { + return importefinal; + } + + public void setImportefinal(BigDecimal importefinal) { + this.importefinal = importefinal; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ProductoServicio getProductoservicio() { + return productoservicio; + } + + public void setProductoservicio(ProductoServicio productoservicio) { + this.productoservicio = productoservicio; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ProdPrecio other = (ProdPrecio) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.productoservicio != other.productoservicio && (this.productoservicio == null || !this.productoservicio.equals(other.productoservicio))) { + return false; + } + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 53 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 53 * hash + (this.productoservicio != null ? this.productoservicio.hashCode() : 0); + hash = 53 * hash + (this.marca != null ? this.marca.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ProdPrecio[ prodprecio=" + prodprecio + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdPuntoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdPuntoVenta.java new file mode 100644 index 000000000..6c3844775 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdPuntoVenta.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_PUNTOVENTA_SEQ", sequenceName = "PROD_PUNTOVENTA_SEQ", allocationSize = 1) +@Table(name = "PROD_PUNTOVENTA") +public class ProdPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_PUNTOVENTA_SEQ") + @Column(name = "PRODPUNTOVENTA_ID") + private Integer prodpuntoventaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdPuntoVenta() { + } + + public ProdPuntoVenta(Integer prodpuntoventaId) { + this.prodpuntoventaId = prodpuntoventaId; + } + + public Integer getProdpuntoventaId() { + return prodpuntoventaId; + } + + public void setProdpuntoventaId(Integer prodpuntoventaId) { + this.prodpuntoventaId = prodpuntoventaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodpuntoventaId != null ? prodpuntoventaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdPuntoVenta)) { + return false; + } + ProdPuntoVenta other = (ProdPuntoVenta) object; + if ((this.prodpuntoventaId == null && other.prodpuntoventaId != null) || (this.prodpuntoventaId != null && !this.prodpuntoventaId.equals(other.prodpuntoventaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdPuntoventa[prodpuntoventaId=" + prodpuntoventaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdRuta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdRuta.java new file mode 100644 index 000000000..622435d40 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdRuta.java @@ -0,0 +1,131 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity + +@SequenceGenerator(name = "PROD_RUTA_SEQ", sequenceName = "PROD_RUTA_SEQ", allocationSize = 1) +@Table(name = "PROD_RUTA") +public class ProdRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_RUTA_SEQ") + @Column(name = "PRODRUTA_ID") + private Integer prodrutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdRuta() { + } + + public ProdRuta(Integer prodrutaId) { + this.prodrutaId = prodrutaId; + } + + public Integer getProdrutaId() { + return prodrutaId; + } + + public void setProdrutaId(Integer prodrutaId) { + this.prodrutaId = prodrutaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodrutaId != null ? prodrutaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdRuta)) { + return false; + } + ProdRuta other = (ProdRuta) object; + if ((this.prodrutaId == null && other.prodrutaId != null) || (this.prodrutaId != null && !this.prodrutaId.equals(other.prodrutaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdRuta[prodrutaId=" + prodrutaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdTipoptovta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdTipoptovta.java new file mode 100644 index 000000000..388f85e9c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdTipoptovta.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_TIPOPTOVTA_SEQ", sequenceName = "PROD_TIPOPTOVTA_SEQ", allocationSize = 1) +@Table(name = "PROD_TIPOPTOVTA") +public class ProdTipoptovta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_TIPOPTOVTA_SEQ") + @Column(name = "PRODTIPOPTOVTA_ID") + private Integer prodtipoptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPtovta; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdTipoptovta() { + } + + public ProdTipoptovta(Integer prodtipoptovtaId) { + this.prodtipoptovtaId = prodtipoptovtaId; + } + + public Integer getProdtipoptovtaId() { + return prodtipoptovtaId; + } + + public void setProdtipoptovtaId(Integer prodtipoptovtaId) { + this.prodtipoptovtaId = prodtipoptovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPtovta() { + return tipoPtovta; + } + + public void setTipoPtovta(TipoPuntoVenta tipoPtovta) { + this.tipoPtovta = tipoPtovta; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodtipoptovtaId != null ? prodtipoptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdTipoptovta)) { + return false; + } + ProdTipoptovta other = (ProdTipoptovta) object; + if ((this.prodtipoptovtaId == null && other.prodtipoptovtaId != null) || (this.prodtipoptovtaId != null && !this.prodtipoptovtaId.equals(other.prodtipoptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdTipoptovta[prodtipoptovtaId=" + prodtipoptovtaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdVigencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdVigencia.java new file mode 100644 index 000000000..e9e0ee471 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProdVigencia.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_VIGENCIA_SEQ", sequenceName = "PROD_VIGENCIA_SEQ", allocationSize = 1) +@Table(name = "PROD_VIGENCIA") +public class ProdVigencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_VIGENCIA_SEQ") + @Basic(optional = false) + @Column(name = "PRODVIGENCIA_ID") + private Integer prodvigenciaId; + @Column(name = "FECVIGENCIAINICIO") + @Temporal(TemporalType.DATE) + private Date fecvigenciainicio; + @Column(name = "FECVIGENCIAFIN") + @Temporal(TemporalType.DATE) + private Date fecvigenciafin; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdVigencia() { + } + + public ProdVigencia(Integer prodvigenciaId) { + this.prodvigenciaId = prodvigenciaId; + } + + public Integer getProdvigenciaId() { + return prodvigenciaId; + } + + public void setProdvigenciaId(Integer prodvigenciaId) { + this.prodvigenciaId = prodvigenciaId; + } + + public Date getFecvigenciainicio() { + return fecvigenciainicio; + } + + public void setFecvigenciainicio(Date fecvigenciainicio) { + this.fecvigenciainicio = fecvigenciainicio; + } + + public Date getFecvigenciafin() { + return fecvigenciafin; + } + + public void setFecvigenciafin(Date fecvigenciafin) { + this.fecvigenciafin = fecvigenciafin; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodvigenciaId != null ? prodvigenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdVigencia)) { + return false; + } + ProdVigencia other = (ProdVigencia) object; + if ((this.prodvigenciaId == null && other.prodvigenciaId != null) || (this.prodvigenciaId != null && !this.prodvigenciaId.equals(other.prodvigenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdVigencia[prodvigenciaId=" + prodvigenciaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProductoServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProductoServicio.java new file mode 100644 index 000000000..dbd845123 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ProductoServicio.java @@ -0,0 +1,299 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRODUCTO_SERVICIO_SEQ", sequenceName = "PRODUCTO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "PRODUCTO_SERVICIO") +public class ProductoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRODUCTO_SERVICIO_SEQ") + @Basic(optional = false) + @Column(name = "PRODUCTOSERVICIO_ID") + private Integer productoservicioId; + @Column(name = "DESCPRODUCTOSERVICIO") + private String descproductoservicio; + @Column(name = "INDTIPO") + private String indtipo; + @Column(name = "DESCIMPRESIONBOLETO") + private String descImpresionBoleto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodRutaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodMarcaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodTipoptovtaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodPuntoVentaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodFormaPagoList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodMercadoList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodVigenciaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodClaseServicioList; + @OneToMany(mappedBy = "productoservicio", cascade = CascadeType.ALL) + private List prodPrecioList; + + public ProductoServicio() { + } + + public ProductoServicio(Integer productoservicioId) { + this.productoservicioId = productoservicioId; + } + + public Integer getProductoservicioId() { + return productoservicioId; + } + + public void setProductoservicioId(Integer productoservicioId) { + this.productoservicioId = productoservicioId; + } + + public String getDescproductoservicio() { + return descproductoservicio; + } + + public void setDescproductoservicio(String descproductoservicio) { + this.descproductoservicio = descproductoservicio; + } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public List getProdClaseServicioList() { + List poList = new ArrayList(); + for (ProdClaseServicio po : this.prodClaseServicioList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdClaseServicioList(List prodClaseServicioList) { + this.prodClaseServicioList = prodClaseServicioList; + } + + public List getProdFormaPagoList() { + List poList = new ArrayList(); + for (ProdFormaPago po : this.prodFormaPagoList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdFormaPagoList(List prodFormaPagoList) { + this.prodFormaPagoList = prodFormaPagoList; + } + + public List getProdMarcaList() { + List poList = new ArrayList(); + for (ProdMarca po : this.prodMarcaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdMarcaList(List prodMarcaList) { + this.prodMarcaList = prodMarcaList; + } + + public List getProdMercadoList() { + + List poList = new ArrayList(); + for (ProdMercado po : this.prodMercadoList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdMercadoList(List prodMercadoList) { + this.prodMercadoList = prodMercadoList; + } + + public List getProdPuntoVentaList() { + + List poList = new ArrayList(); + for (ProdPuntoVenta po : this.prodPuntoVentaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdPuntoVentaList(List prodPuntoVentaList) { + this.prodPuntoVentaList = prodPuntoVentaList; + } + + public List getProdRutaList() { + List poList = new ArrayList(); + for (ProdRuta po : this.prodRutaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdRutaList(List prodRutaList) { + this.prodRutaList = prodRutaList; + } + + public List getProdTipoptovtaList() { + List poList = new ArrayList(); + for (ProdTipoptovta po : this.prodTipoptovtaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdTipoptovtaList(List prodTipoptovtaList) { + this.prodTipoptovtaList = prodTipoptovtaList; + } + + public List getProdVigenciaList() { + List poList = new ArrayList(); + for (ProdVigencia po : this.prodVigenciaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdVigenciaList(List prodVigenciaList) { + this.prodVigenciaList = prodVigenciaList; + } + + public List getProdPrecioList() { + List ppList = new ArrayList(); + for (ProdPrecio pp : this.prodPrecioList) { + if (pp.getActivo() == Boolean.TRUE) { + ppList.add(pp); + } + } + return ppList; + } + + public void setProdPrecioList(List prodPrecioList) { + this.prodPrecioList = prodPrecioList; + } + + public String getDescImpresionBoleto() { + return descImpresionBoleto; + } + + public void setDescImpresionBoleto(String descImpresionBoleto) { + this.descImpresionBoleto = descImpresionBoleto; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (productoservicioId != null ? productoservicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProductoServicio)) { + return false; + } + ProductoServicio other = (ProductoServicio) object; + if ((this.productoservicioId == null && other.productoservicioId != null) || (this.productoservicioId != null && !this.productoservicioId.equals(other.productoservicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProductoServicio[productoservicioId=" + productoservicioId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java new file mode 100644 index 000000000..632948295 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "PTOVTA_CHECKIN_SEQ", sequenceName = "PTOVTA_CHECKIN_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_CHECKIN") +public class PtoVtaCheckin implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_CHECKIN_SEQ") + @Column(name = "PTOVTACHECKIN_ID") + private Integer ptoVtaCheckinId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @OneToOne + private PuntoVenta puntoventaId; + + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaId; + + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + public PtoVtaCheckin() { + } + + public PtoVtaCheckin(Integer ptoVtaCheckinId) { + this.ptoVtaCheckinId = ptoVtaCheckinId; + } + + public Integer getPtoVtaCheckinId() { + return ptoVtaCheckinId; + } + + public void setPtoVtaCheckinId(Integer ptoVtaCheckinId) { + this.ptoVtaCheckinId = ptoVtaCheckinId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Parada getParadaId() { + return paradaId; + } + + public void setParadaId(Parada paradaId) { + this.paradaId = paradaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptoVtaCheckinId != null ? ptoVtaCheckinId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PtoVtaCheckin)) { + return false; + } + PtoVtaCheckin other = (PtoVtaCheckin) object; + if ((this.ptoVtaCheckinId == null && other.ptoVtaCheckinId != null) || (this.ptoVtaCheckinId != null && !this.ptoVtaCheckinId.equals(other.ptoVtaCheckinId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin[ ptoVtaCheckinId=" + ptoVtaCheckinId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java new file mode 100644 index 000000000..01b634ec1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java @@ -0,0 +1,196 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "PTOVTA_SEGURO_SEQ", sequenceName = "PTOVTA_SEGURO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_SEGURO") +public class PtoVtaSeguro implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_SEGURO_SEQ") + @Column(name = "PTOVTASEGURO_ID") + private Integer ptoVtaSeguroId; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Basic(optional = false) + @Column(name = "INDVENDSEGOPCIONAL") + private Boolean indVendeSegOpcional; + + @Basic(optional = false) + @Column(name = "INDESTANSEGOPCIONAL") + private Boolean indEstanSegOpcional; + + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @OneToOne + private PuntoVenta puntoventaId; + + @Basic(optional = false) + @Column(name = "INDESTANTASAEMBARQUE") + private Boolean indEstanTasaEmbarque; + + @Basic(optional = false) + @Column(name = "INDPERMISOTASAEMBARQUE") + private Boolean indPermisoTasaEmbarque; + + @Basic(optional = false) + @Column(name = "INDPERMISOTASAEMBARQUEVTAMAN") + private Boolean indPermisoTasaEmbarqueVtaManual; + + public PtoVtaSeguro() { + } + + public PtoVtaSeguro(Integer ptoVtaSeguroId) { + this.ptoVtaSeguroId = ptoVtaSeguroId; + } + + public Integer getPtoVtaSeguroId() { + return ptoVtaSeguroId; + } + + public void setPtoVtaSeguroId(Integer ptoVtaSeguroId) { + this.ptoVtaSeguroId = ptoVtaSeguroId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndVendeSegOpcional() { + return indVendeSegOpcional; + } + + public void setIndVendeSegOpcional(Boolean indVendeSegOpcional) { + this.indVendeSegOpcional = indVendeSegOpcional; + } + + public Boolean getIndEstanSegOpcional() { + return indEstanSegOpcional; + } + + public void setIndEstanSegOpcional(Boolean indEstanSegOpcional) { + this.indEstanSegOpcional = indEstanSegOpcional; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptoVtaSeguroId != null ? ptoVtaSeguroId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PtoVtaSeguro)) { + return false; + } + PtoVtaSeguro other = (PtoVtaSeguro) object; + if ((this.ptoVtaSeguroId == null && other.ptoVtaSeguroId != null) || (this.ptoVtaSeguroId != null && !this.ptoVtaSeguroId.equals(other.ptoVtaSeguroId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro[ ptoVtaSeguroId=" + ptoVtaSeguroId + " ]"; + } + + public Boolean getIndEstanTasaEmbarque() { + return indEstanTasaEmbarque; + } + + public void setIndEstanTasaEmbarque(Boolean indEstanTasaEmbarque) { + this.indEstanTasaEmbarque = indEstanTasaEmbarque; + } + + public Boolean getIndPermisoTasaEmbarque() { + return indPermisoTasaEmbarque; + } + + public void setIndPermisoTasaEmbarque(Boolean indPermisoTasaEmbarque) { + this.indPermisoTasaEmbarque = indPermisoTasaEmbarque; + } + + public Boolean getIndPermisoTasaEmbarqueVtaManual() { + return indPermisoTasaEmbarqueVtaManual; + } + + public void setIndPermisoTasaEmbarqueVtaManual(Boolean indPermisoTasaEmbarqueVtaManual) { + this.indPermisoTasaEmbarqueVtaManual = indPermisoTasaEmbarqueVtaManual; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java new file mode 100644 index 000000000..faea97fa4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java @@ -0,0 +1,149 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@Table(name = "PTOVTA_USUARIO_BANCARIO") +public class PtoVtaUsuarioBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "PTOVTAUSUARIOBANCARIO_ID") + private Integer ptovtaUsuarioBancarioID; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "USUARIOBANCARIO_ID", referencedColumnName = "USUARIOBANCARIO_ID") + @ManyToOne + private UsuarioBancario usuarioBancario; + + public PtoVtaUsuarioBancario() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getPtovtaUsuarioBancarioID() { + return ptovtaUsuarioBancarioID; + } + + public void setPtovtaUsuarioBancarioID(Integer ptovtaUsuarioBancarioID) { + this.ptovtaUsuarioBancarioID = ptovtaUsuarioBancarioID; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public UsuarioBancario getUsuarioBancario() { + return usuarioBancario; + } + + public void setUsuarioBancario(UsuarioBancario usuarioBancario) { + this.usuarioBancario = usuarioBancario; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final PtoVtaUsuarioBancario other = (PtoVtaUsuarioBancario) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.empresa != other.empresa && (this.empresa == null || !this.empresa.equals(other.empresa))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + if (this.usuarioBancario != other.usuarioBancario && (this.usuarioBancario == null || !this.usuarioBancario.equals(other.usuarioBancario))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 97 * hash + (this.empresa != null ? this.empresa.hashCode() : 0); + hash = 97 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); + hash = 97 * hash + (this.usuarioBancario != null ? this.usuarioBancario.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "PtoVtaUsuarioBancario{" + "ptovtaUsuarioBancarioID=" + ptovtaUsuarioBancarioID + '}'; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaAgencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaAgencia.java new file mode 100644 index 000000000..060f17c89 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaAgencia.java @@ -0,0 +1,300 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_AGENCIA_SEQ", sequenceName = "PTOVTA_AGENCIA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_AGENCIA") + +public class PtovtaAgencia implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_AGENCIA_SEQ") + @Column(name = "PTOVTAAGENCIA_ID") + private Integer ptovtaAgenciaId; + + @Column(name = "NUMAGENCIA") + private String numagencia; + + @Column(name = "NUMCONTA") + private String numconta; + + @Column(name = "DIGITO") + private String digito; + + @Column(name = "PESSOA") + private String pessoa; + + @Column(name = "TIPO") + private String tipo; + + @Column(name = "BILHETES") + private String bilhetes; + + @Column(name = "CARGA") + private String carga; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @JoinColumn(name = "INSTIFINANCEIRA_ID", referencedColumnName = "INSTIFINANCEIRA_ID") + @ManyToOne + private InstiFinanceira instiFinanceiraId; + + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "agenciaId") + private List puntoVentaList; + + public PtovtaAgencia() { + } + + public PtovtaAgencia(Integer ptovtaAgenciaId) { + this.ptovtaAgenciaId = ptovtaAgenciaId; + } + + + + public enum enumTipoConta { + // Declaração dos enum + CONTACORRENTE ("CONTA CORRENTE C/C", "CC"), + + POUPANÇA ("POUPANÇA", "P"); + + + + // Definição das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private enumTipoConta( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + + public enum enumTipoPessoa { + // Declaração dos enum + PESSOAFISICA ("PESSOA FÍSICA", "F"), + + PESSOAJURIDICA ("PESSOA JURÍDICA", "J"); + + + + // Definição das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private enumTipoPessoa( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + + public PtovtaAgencia(Integer ptovtaAgenciaId, String numagencia, String digito, String numconta, String pessoa, String tipo, String bilhetes, String carga, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaAgenciaId = ptovtaAgenciaId; + this.numagencia = numagencia; + this.numconta = numconta; + this.digito = digito; + this.pessoa = pessoa; + this.tipo = tipo; + this.bilhetes = bilhetes; + this.carga = carga; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaAgenciaId() { + return ptovtaAgenciaId; + } + + public void setPtovtaAgenciaId(Integer ptovtaAgenciaId) { + this.ptovtaAgenciaId = ptovtaAgenciaId; + } + + public String getNumagencia() { + return numagencia; + } + + public void setNumagencia(String numagencia) { + this.numagencia = numagencia; + } + + public String getNumconta() { + return numconta; + } + + public void setNumconta(String numconta) { + this.numconta = numconta; + } + + public String getDigito() { + return digito; + } + + public void setDigito(String digito) { + this.digito = digito; + } + + public String getPessoa() { + return pessoa; + } + + public void setPessoa(String pessoa) { + this.pessoa = pessoa; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public String getBilhetes() { + return bilhetes; + } + + public void setBilhetes(String bilhetes) { + this.bilhetes = bilhetes; + } + + public String getCarga() { + return carga; + } + + public void setCarga(String carga) { + this.carga = carga; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + + + public InstiFinanceira getInstiFinanceiraId() { + return instiFinanceiraId; + } + + public void setInstiFinanceiraId(InstiFinanceira instiFinanceiraId) { + this.instiFinanceiraId = instiFinanceiraId; + } + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + +// public static List getPessoaList() { +// return pessoaList; +// } +// +// public static List getTipoContaList() { +// return tpContaList; +// } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaAgenciaId != null ? ptovtaAgenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaAgencia)) { + return false; + } + PtovtaAgencia other = (PtovtaAgencia) object; + if ((this.ptovtaAgenciaId == null && other.ptovtaAgenciaId != null) || (this.ptovtaAgenciaId != null && !this.ptovtaAgenciaId.equals(other.ptovtaAgenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaAgencia[ ptovtaAgenciaId=" + ptovtaAgenciaId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java new file mode 100644 index 000000000..2761eff60 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java @@ -0,0 +1,173 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_ANTECIPACOMISSAO_SEQ", sequenceName = "PTOVTA_ANTECIPACOMISSAO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_ANTECIPACOMISSAO") + +public class PtovtaAntecipacomissao implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_ANTECIPACOMISSAO_SEQ") + @Column(name = " PTOVTAANTECIPACOMISSAO_ID") + private Integer ptovtaAntecipaComissaoId; + + @Column(name = "DATA") + @Temporal(TemporalType.TIMESTAMP) + private Date data; + + @Column(name = "RETEM") + private BigDecimal retem; + @Basic(optional = false) + @Column(name = "PERCENTUAL") + private BigDecimal percentual; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + public PtovtaAntecipacomissao() { + } + + public PtovtaAntecipacomissao(Integer ptovtaAntecipaComissaoId) { + this.ptovtaAntecipaComissaoId = ptovtaAntecipaComissaoId; + } + + public PtovtaAntecipacomissao(Integer ptovtaAntecipaComissaoId, Date data, BigDecimal retem, BigDecimal percentual, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaAntecipaComissaoId = ptovtaAntecipaComissaoId; + this.data = data; + this.retem = retem; + this.percentual = percentual; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaAntecipaComissaoId() { + return ptovtaAntecipaComissaoId; + } + + public void setPtovtaAntecipaComissaoId(Integer ptovtaAntecipaComissaoId) { + this.ptovtaAntecipaComissaoId = ptovtaAntecipaComissaoId; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public BigDecimal getRetem() { + return retem; + } + + public void setRetem(BigDecimal retem) { + this.retem = retem; + } + + public BigDecimal getPercentual() { + return percentual; + } + + public void setPercentual(BigDecimal percentual) { + this.percentual = percentual; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaAntecipaComissaoId != null ? ptovtaAntecipaComissaoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaAntecipacomissao)) { + return false; + } + PtovtaAntecipacomissao other = (PtovtaAntecipacomissao) object; + if ((this.ptovtaAntecipaComissaoId == null && other.ptovtaAntecipaComissaoId != null) || (this.ptovtaAntecipaComissaoId != null && !this.ptovtaAntecipaComissaoId.equals(other.ptovtaAntecipaComissaoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao[ ptovtaAntecipaComissaoId=" + ptovtaAntecipaComissaoId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java new file mode 100644 index 000000000..b7f903ec4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java @@ -0,0 +1,147 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PTOVTA_CAT_IND_SEQ", sequenceName = "PTOVTA_CAT_IND_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_CAT_IND") +public class PtovtaCatInd implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_CAT_IND_SEQ") + @Column(name = "PTOVTACATEGORIA_ID") + private Integer ptovtaCategoriaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + public Integer getPtovtaCategoriaId() { + return ptovtaCategoriaId; + } + + public void setPtovtaCategoriaId(Integer ptovtaCategoriaId) { + this.ptovtaCategoriaId = ptovtaCategoriaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((categoria == null) ? 0 : categoria.hashCode()); + result = prime * result + ((fecmodif == null) ? 0 : fecmodif.hashCode()); + result = prime * result + ((ptovtaCategoriaId == null) ? 0 : ptovtaCategoriaId.hashCode()); + result = prime * result + ((puntoVenta == null) ? 0 : puntoVenta.hashCode()); + result = prime * result + ((usuarioId == null) ? 0 : usuarioId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PtovtaCatInd other = (PtovtaCatInd) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (categoria == null) { + if (other.categoria != null) + return false; + } else if (!categoria.equals(other.categoria)) + return false; + if (fecmodif == null) { + if (other.fecmodif != null) + return false; + } else if (!fecmodif.equals(other.fecmodif)) + return false; + if (ptovtaCategoriaId == null) { + if (other.ptovtaCategoriaId != null) + return false; + } else if (!ptovtaCategoriaId.equals(other.ptovtaCategoriaId)) + return false; + if (puntoVenta == null) { + if (other.puntoVenta != null) + return false; + } else if (!puntoVenta.equals(other.puntoVenta)) + return false; + if (usuarioId == null) { + if (other.usuarioId != null) + return false; + } else if (!usuarioId.equals(other.usuarioId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java new file mode 100644 index 000000000..1edd4f0a4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java @@ -0,0 +1,473 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_COMISSAO_SEQ", sequenceName = "PTOVTA_COMISSAO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_COMISSAO") +public class PtovtaComissao implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_COMISSAO_SEQ") + @Column(name = "PTOVTACOMISSAO_ID") + private Integer ptovtaComissaoId; + + @Column(name = "ISSRETIDO") + private BigDecimal issretido; + + @Column(name = "ROYALTIES") + private BigDecimal royalties; + + @Column(name = "ENVIARRECIBO") + private Boolean enviarRecibo; + + @Column(name = "RECEITA") + private String receita; + + @OneToOne + @JoinColumn(name = "PTOVTADESCOMISSAO_ID") + private PuntoVenta descComissaoId; + + @Column(name = "PASSAGEMALTA") + private BigDecimal passagemAlta; + + @Column(name = "PASSAGEMBAIXA") + private BigDecimal passagemBaixa; + + @Column(name = "SEGUROALTA") + private BigDecimal seguroAlta; + + @Column(name = "SEGUROBAIXA") + private BigDecimal seguroBaixa; + + @Column(name = "OUTROSBAIXA") + private BigDecimal outrosBaixa; + + @Column(name = " OUTROSALTA") + private BigDecimal outrosAlta; + + @Column(name = "EXCESSOALTA") + private BigDecimal excessoAlta; + + @Column(name = "EXCESSOBAIXA") + private BigDecimal excessoBaixa; + + @Column(name = "TARIFARECEITA") + private Boolean tarifaReceita; + + @Column(name = " SEGURORECEITA") + private Boolean seguroReceita; + + @Column(name = "TAXARECEITA") + private Boolean taxaReceita; + + @Column(name = "PEDAGIORECEITA") + private Boolean pedagioReceita; + + @Column(name = " TARIFADEV") + private Boolean tarifaDev; + + @Column(name = " SEGURO_DEV") + private Boolean seguroDev; + + @Column(name = "TAXADEV") + private Boolean taxaDev; + + @Column(name = "PEDAGIODEV") + private Boolean pedagioDev; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @Column(name = "INDIMPRESSAOGAPPORC") + private Boolean indimpressaogapporc; + + @Column(name = "VALOR_IMPRESSAO_GAP") + private BigDecimal valorImpressaoGap; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresaId; + + public PtovtaComissao() { + super(); + this.tarifaDev = Boolean.TRUE; + this.tarifaReceita = Boolean.TRUE; + } + + public enum Receita { + // Declaração dos enum + RECEITABRUTA("RECEITA BRUTA", "RB"), + + RECEITALIQUIDA("RECEITA LÍQUIDA ", "RL"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private Receita(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + public static Receita getByValor(String valor) { + if (valor == null) { + return Receita.RECEITABRUTA; + } else { + if (valor.equals("RB")) + return Receita.RECEITABRUTA; + if (valor.equals("RL")) + return Receita.RECEITALIQUIDA; + } + + return null; + + } + + } + + public PtovtaComissao(Integer ptovtaComissaoId) { + this.ptovtaComissaoId = ptovtaComissaoId; + } + + public PtovtaComissao(Integer ptovtaComissaoId, BigDecimal issretido, BigDecimal royalties, Boolean enviarrecibo, String receita, BigDecimal passagemAlta, BigDecimal passagemBaixa, BigDecimal seguroAlta, BigDecimal seguroBaixa, BigDecimal outrosBaixa, BigDecimal outrosAlta, BigDecimal excessoAlta, BigDecimal excessoBaixa, Boolean tarifaReceita, Boolean seguroReceita, Boolean taxaReceita, Boolean pedagioReceita, Boolean tarifaDev, Boolean seguroDev, Boolean taxaDev, Boolean pegagioDev, Boolean activo, Date fecmodif, int usuarioId, Boolean indimpressaogapporc, BigDecimal valorImpressaoGap) { + super(); + this.ptovtaComissaoId = ptovtaComissaoId; + this.issretido = issretido; + this.royalties = royalties; + this.enviarRecibo = enviarrecibo; + this.receita = receita; + this.passagemAlta = passagemAlta; + this.passagemBaixa = passagemBaixa; + this.seguroAlta = seguroAlta; + this.seguroBaixa = seguroBaixa; + this.outrosBaixa = outrosBaixa; + this.outrosAlta = outrosAlta; + this.excessoAlta = excessoAlta; + this.excessoBaixa = excessoBaixa; + this.tarifaReceita = tarifaReceita; + this.seguroReceita = seguroReceita; + this.taxaReceita = taxaReceita; + this.pedagioReceita = pedagioReceita; + this.tarifaDev = tarifaDev; + this.seguroDev = seguroDev; + this.taxaDev = taxaDev; + this.pedagioDev = pegagioDev; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.indimpressaogapporc = indimpressaogapporc; + this.valorImpressaoGap = valorImpressaoGap; + } + + public Integer getPtovtaComissaoId() { + return ptovtaComissaoId; + } + + public void setPtovtaComissaoId(Integer ptovtaComissaoId) { + this.ptovtaComissaoId = ptovtaComissaoId; + } + + public PuntoVenta getDescComissaoId() { + return descComissaoId; + } + + public void setDescComissaoId(PuntoVenta descComissaoId) { + this.descComissaoId = descComissaoId; + } + + public BigDecimal getIssretido() { + return issretido; + } + + public void setIssretido(BigDecimal issretido) { + this.issretido = issretido; + } + + public BigDecimal getRoyalties() { + return royalties; + } + + public void setRoyalties(BigDecimal royalties) { + this.royalties = royalties; + } + + public Boolean getEnviarrecibo() { + return enviarRecibo; + } + + public void setEnviarrecibo(Boolean enviarRecibo) { + this.enviarRecibo = enviarRecibo; + } + + public String getReceita() { + return receita; + } + + public void setReceita(String receita) { + this.receita = receita; + } + + public BigDecimal getPassagemAlta() { + return passagemAlta; + } + + public void setPassagemAlta(BigDecimal passagemAlta) { + this.passagemAlta = passagemAlta; + } + + public BigDecimal getPassagemBaixa() { + return passagemBaixa; + } + + public void setPassagemBaixa(BigDecimal passagemBaixa) { + this.passagemBaixa = passagemBaixa; + } + + public BigDecimal getSeguroAlta() { + return seguroAlta; + } + + public void setSeguroAlta(BigDecimal seguroAlta) { + this.seguroAlta = seguroAlta; + } + + public BigDecimal getSeguroBaixa() { + return seguroBaixa; + } + + public void setSeguroBaixa(BigDecimal seguroBaixa) { + this.seguroBaixa = seguroBaixa; + } + + public BigDecimal getOutrosBaixa() { + return outrosBaixa; + } + + public void setOutrosBaixa(BigDecimal outrosBaixa) { + this.outrosBaixa = outrosBaixa; + } + + public BigDecimal getOutrosAlta() { + return outrosAlta; + } + + public void setOutrosAlta(BigDecimal outrosAlta) { + this.outrosAlta = outrosAlta; + } + + public BigDecimal getExcessoAlta() { + return excessoAlta; + } + + public void setExcessoAlta(BigDecimal excessoAlta) { + this.excessoAlta = excessoAlta; + } + + public BigDecimal getExcessoBaixa() { + return excessoBaixa; + } + + public void setExcessoBaixa(BigDecimal excessoBaixa) { + this.excessoBaixa = excessoBaixa; + } + + public Boolean getTarifaReceita() { + return tarifaReceita; + } + + public void setTarifaReceita(Boolean tarifaReceita) { + this.tarifaReceita = tarifaReceita; + } + + public Boolean getSeguroReceita() { + return seguroReceita; + } + + public void setSeguroReceita(Boolean seguroReceita) { + this.seguroReceita = seguroReceita; + } + + public Boolean getTaxaReceita() { + return taxaReceita; + } + + public void setTaxaReceita(Boolean taxaReceita) { + this.taxaReceita = taxaReceita; + } + + public Boolean getPedagioReceita() { + return pedagioReceita; + } + + public void setPedagioReceita(Boolean pedagioReceita) { + this.pedagioReceita = pedagioReceita; + } + + public Boolean getTarifaDev() { + return tarifaDev; + } + + public void setTarifaDev(Boolean tarifaDev) { + this.tarifaDev = tarifaDev; + } + + public Boolean getSeguroDev() { + return seguroDev; + } + + public void setSeguroDev(Boolean seguroDev) { + this.seguroDev = seguroDev; + } + + public Boolean getTaxaDev() { + return taxaDev; + } + + public void setTaxaDev(Boolean taxaDev) { + this.taxaDev = taxaDev; + } + + public Boolean getPedagioDev() { + return pedagioDev; + } + + public void setPedagioDev(Boolean pegagioDev) { + this.pedagioDev = pegagioDev; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + // + + /** + * @return the empresaId + */ + public Empresa getEmpresaId() { + return empresaId; + } + + /** + * @param empresaId + * the empresaId to set + */ + public void setEmpresaId(Empresa empresaId) { + this.empresaId = empresaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaComissaoId != null ? ptovtaComissaoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaComissao)) { + return false; + } + PtovtaComissao other = (PtovtaComissao) object; + if ((this.ptovtaComissaoId == null && other.ptovtaComissaoId != null) || (this.ptovtaComissaoId != null && !this.ptovtaComissaoId.equals(other.ptovtaComissaoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaComissao[ ptovtaComissaoId=" + ptovtaComissaoId + " ]"; + } + + public Boolean getIndimpressaogapporc() { + return indimpressaogapporc; + } + + public void setIndimpressaogapporc(Boolean indimpressaogapporc) { + this.indimpressaogapporc = indimpressaogapporc; + } + + public BigDecimal getValorImpressaoGap() { + return valorImpressaoGap; + } + + public void setValorImpressaoGap(BigDecimal valorImpressaoGap) { + this.valorImpressaoGap = valorImpressaoGap; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaDiversos.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaDiversos.java new file mode 100644 index 000000000..0c4a280cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaDiversos.java @@ -0,0 +1,324 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_DIVERSOS_SEQ", sequenceName = "PTOVTA_DIVERSOS_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_DIVERSOS") +public class PtovtaDiversos implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_DIVERSOS_SEQ") + @Column(name = "PTOVTADIVERSOS_ID ") + private Integer ptovtaDiversosId; + + @Column(name = "RESPONALUGUEL") + private String responAluguel; + + @Column(name = "RESPONTELEFONE") + private String responTelefone; + + @Column(name = "RESPONENERGIA") + private String responEnergia; + + @Column(name = "POSICAO") + private String posicao; + + @Column(name = "INFORMATIZADA") + private Boolean informatizada; + + @Column(name = "BILHETEINFO") + private Boolean bilheteInfo; + + @Column(name = "VENDAINTERNET") + private Boolean vendaInternet; + + @Column(name = "DIGITACAOSEQ") + private Boolean digitacaoSeq; + + @Column(name = "TELEENTREGA") + private Boolean teleEntrega; + + @Column(name = "TRABALHABILHETE") + private Boolean trabalhaBilhete; + + @Column(name = "TRABOFPSPROPRIA") + private Boolean ofpsPropria; + + @Column(name = "TRABOFPSTERCEIROS") + private Boolean ofpsTerceiros; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + public PtovtaDiversos() { + } + + public enum gerarEnum { + // Declaração dos enum + + + POSICAOFORAEIXO ("FORA DO EIXO DA LINHA", "FEL"), + POSICAONOEIXO ("NO EIXO DA LINHA", "EL"); + + + + // Definição das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private gerarEnum( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + +// private static List posicaoList = new ArrayList(); +// +// static{ +// posicaoList.add("FORA DO EIXO DA LINHA"); +// posicaoList.add("NO EIXO DA LINHA"); +// +// } +// + + public PtovtaDiversos(Integer ptovtaDiversosId, String responAluguel, String responTelefone, String responEnergia, String posicao, Boolean informatizada, Boolean bilheteInfo, Boolean vendaInternet, Boolean digitacaoSeq, Boolean teleEntrega, Boolean trabalhaBilhete, Boolean ofpsPropria, Boolean ofpsTerceiros, Boolean activo, Date fecmodif, int usuarioId) { + super(); + this.ptovtaDiversosId = ptovtaDiversosId; + this.responAluguel = responAluguel; + this.responTelefone = responTelefone; + this.responEnergia = responEnergia; + this.posicao = posicao; + this.informatizada = informatizada; + this.bilheteInfo = bilheteInfo; + this.vendaInternet = vendaInternet; + this.digitacaoSeq = digitacaoSeq; + this.teleEntrega = teleEntrega; + this.trabalhaBilhete = trabalhaBilhete; + this.ofpsPropria = ofpsPropria; + this.ofpsTerceiros = ofpsTerceiros; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + public Integer getPtovtaDiversosId() { + return ptovtaDiversosId; + } + + public void setPtovtaDiversosId(Integer ptovtaDiversosId) { + this.ptovtaDiversosId = ptovtaDiversosId; + } + + public String getResponAluguel() { + return responAluguel; + } + + public void setResponAluguel(String responAluguel) { + this.responAluguel = responAluguel; + } + + public String getResponTelefone() { + return responTelefone; + } + + public void setResponTelefone(String responTelefone) { + this.responTelefone = responTelefone; + } + + public String getResponEnergia() { + return responEnergia; + } + + public void setResponEnergia(String responEnergia) { + this.responEnergia = responEnergia; + } + + public String getPosicao() { + return posicao; + } + + public void setPosicao(String posicao) { + this.posicao = posicao; + } + + + public Boolean getInformatizada() { + return informatizada; + } + + public void setInformatizada(Boolean informatizada) { + this.informatizada = informatizada; + } + + public Boolean getBilheteInfo() { + return bilheteInfo; + } + + public void setBilheteInfo(Boolean bilheteInfo) { + this.bilheteInfo = bilheteInfo; + } + + public Boolean getVendaInternet() { + return vendaInternet; + } + + public void setVendaInternet(Boolean vendaInternet) { + this.vendaInternet = vendaInternet; + } + + public Boolean getDigitacaoSeq() { + return digitacaoSeq; + } + + public void setDigitacaoSeq(Boolean digitacaoSeq) { + this.digitacaoSeq = digitacaoSeq; + } + + public Boolean getTeleEntrega() { + return teleEntrega; + } + + public void setTeleEntrega(Boolean teleEntrega) { + this.teleEntrega = teleEntrega; + } + + public Boolean getTrabalhaBilhete() { + return trabalhaBilhete; + } + + public void setTrabalhaBilhete(Boolean trabalhaBilhete) { + this.trabalhaBilhete = trabalhaBilhete; + } + + public Boolean getOfpsPropria() { + return ofpsPropria; + } + + public void setOfpsPropria(Boolean ofpsPropria) { + this.ofpsPropria = ofpsPropria; + } + + public Boolean getOfpsTerceiros() { + return ofpsTerceiros; + } + + public void setOfpsTerceiros(Boolean ofpsTerceiros) { + this.ofpsTerceiros = ofpsTerceiros; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + + + + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaDiversosId != null ? ptovtaDiversosId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaDiversos)) { + return false; + } + PtovtaDiversos other = (PtovtaDiversos) object; + if ((this.ptovtaDiversosId == null && other.ptovtaDiversosId != null) || (this.ptovtaDiversosId != null && !this.ptovtaDiversosId.equals(other.ptovtaDiversosId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaDiversos[ ptovtaDiversosId=" + ptovtaDiversosId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java new file mode 100644 index 000000000..78ed9043a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java @@ -0,0 +1,206 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "PTOVTA_EMPRESA_SEQ", sequenceName = "PTOVTA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_EMPRESA") +public class PtovtaEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_EMPRESA_SEQ") + @Column(name = "PTOVTAEMPRESA_ID") + private Integer ptovtaempresaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + @Column(name = "INDTERCEIRIZADA") + private Boolean indTerceirizada; + + @Column(name = "INDBLOQUEADA") + private Boolean indBloqueada; + + @Column(name = "INDMOSTRARCAJA") + private Boolean indMostrarCaja; + + @Column(name = "NUMSITEF") + private String numeroSitef; + + @JoinColumn(name = "EMPRESACONTABANCARIA_ID", referencedColumnName = "EMPRESACONTABANCARIA_ID") + @ManyToOne + private EmpresaContaBancaria empresaContaBancaria; + + public PtovtaEmpresa() { + } + + public PtovtaEmpresa(Integer ptovtaempresaId) { + this.ptovtaempresaId = ptovtaempresaId; + } + + public Integer getPtovtaempresaId() { + return ptovtaempresaId; + } + + public void setPtovtaempresaId(Integer ptovtaempresaId) { + this.ptovtaempresaId = ptovtaempresaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public EmpresaContaBancaria getEmpresaContaBancaria() { + return empresaContaBancaria; + } + + public void setEmpresaContaBancaria(EmpresaContaBancaria empresaContaBancaria) { + this.empresaContaBancaria = empresaContaBancaria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaempresaId != null ? ptovtaempresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final PtovtaEmpresa other = (PtovtaEmpresa) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.empresa != other.empresa && (this.empresa == null || !this.empresa.equals(other.empresa))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa[ptovtaempresaId=" + ptovtaempresaId + "]"; + } + + public Boolean getIndTerceirizada() { + return indTerceirizada; + } + + public void setIndTerceirizada(Boolean indTerceirizada) { + this.indTerceirizada = indTerceirizada; + } + + public Boolean getIndBloqueada() { + return indBloqueada; + } + + public void setIndBloqueada(Boolean indBloqueada) { + this.indBloqueada = indBloqueada; + } + + /** + * @return the indMostrarCaja + */ + public Boolean getIndMostrarCaja() { + return indMostrarCaja; + } + + /** + * @param indMostrarCaja the indMostrarCaja to set + */ + public void setIndMostrarCaja(Boolean indMostrarCaja) { + this.indMostrarCaja = indMostrarCaja; + } + + public String getNumeroSitef() { + return numeroSitef; + } + + public void setNumeroSitef(String numeroSitef) { + this.numeroSitef = numeroSitef; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java new file mode 100644 index 000000000..e9fcac867 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java @@ -0,0 +1,108 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PTOVTA_EMP_BLOQUEADA_SEQ", sequenceName = "PTOVTA_EMP_BLOQUEADA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_EMP_BLOQUEADA") +public class PtovtaEmpresaBloqueada implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_EMP_BLOQUEADA_SEQ") + @Column(name = "PTOVTAEMPBLOQUEADA_ID") + private Integer ptovtaempbloqueadaId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getPtovtaempbloqueadaId() { + return ptovtaempbloqueadaId; + } + + public void setPtovtaempbloqueadaId(Integer ptovtaempbloqueadaId) { + this.ptovtaempbloqueadaId = ptovtaempbloqueadaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object o){ + if (!(o instanceof PtovtaEmpresaBloqueada)) { + return false; + } + PtovtaEmpresaBloqueada other = (PtovtaEmpresaBloqueada) o; + if ((this.ptovtaempbloqueadaId == null && other.ptovtaempbloqueadaId != null) || (this.ptovtaempbloqueadaId != null && !this.ptovtaempbloqueadaId.equals(other.ptovtaempbloqueadaId))) { + return false; + } + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java new file mode 100644 index 000000000..cad5b11ad --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java @@ -0,0 +1,218 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_ESTOQUE_SEQ ", sequenceName = "PTOVTA_ESTOQUE_SEQ ", allocationSize = 1) +@Table(name = "PTOVTA_ESTOQUE") + +public class PtovtaEstoque implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_ESTOQUE_SEQ ") + @Column(name = "PTOVTAESTOQUE_ID") + private Integer ptovtaEstoqueId; + + @Column(name = "ESPECIE") + private String especie; + + @Column(name = "FORMCONT") + private Integer formCont; + + @Column(name = "QUANTIDADE") + private int quantidade; + + @Column(name = "LOTEFORM") + private Integer loteform; + + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + public PtovtaEstoque() { + } + + public PtovtaEstoque(Integer ptovtaEstoqueId) { + this.ptovtaEstoqueId = ptovtaEstoqueId; + } + + + + + public enum gerarEnum { + // Declaração dos enum + SIM ("SIM", "1"), + + NAO ("NAO", "0"); + + + + // Definição das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private gerarEnum( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + + public PtovtaEstoque(Integer ptovtaEstoqueId, String especie, Integer formCont, int quantidade, Integer loteform, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaEstoqueId = ptovtaEstoqueId; + this.especie = especie; + this.formCont = formCont; + this.quantidade = quantidade; + this.loteform = loteform; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaEstoqueId() { + return ptovtaEstoqueId; + } + + public void setPtovtaEstoqueId(Integer ptovtaEstoqueId) { + this.ptovtaEstoqueId = ptovtaEstoqueId; + } + + public String getEspecie() { + return especie; + } + + public void setEspecie(String especie) { + this.especie = especie; + } + + public Integer getFormCont() { + return formCont; + } + + public void setFormCont(Integer formCont) { + this.formCont = formCont; + } + + public int getQuantidade() { + return quantidade; + } + + public void setQuantidade(int quantidade) { + this.quantidade = quantidade; + } + + public Integer getLoteform() { + return loteform; + } + + public void setLoteform(Integer loteform) { + this.loteform = loteform; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaEstoqueId != null ? ptovtaEstoqueId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaEstoque)) { + return false; + } + PtovtaEstoque other = (PtovtaEstoque) object; + if ((this.ptovtaEstoqueId == null && other.ptovtaEstoqueId != null) || (this.ptovtaEstoqueId != null && !this.ptovtaEstoqueId.equals(other.ptovtaEstoqueId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaEstoque[ ptovtaEstoqueId=" + ptovtaEstoqueId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java new file mode 100644 index 000000000..129547784 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java @@ -0,0 +1,233 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_HORARIO_SEQ", sequenceName = "PTOVTA_HORARIO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_HORARIO") + +public class PtovtaHorario implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_HORARIO_SEQ") + @Column(name = "PTOVTAHORARIO_ID") + private Integer ptovtaHorarioId; + + @Column(name = "INICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date inicio; + + @Column(name = "FIM") + @Temporal(TemporalType.TIMESTAMP) + private Date fim; + + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @Column(name = "INDLUNES") + private Boolean indlunes; + @Column(name = "INDMARTES") + private Boolean indmartes; + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + @Column(name = "INDJUEVES") + private Boolean indjueves; + @Column(name = "INDVIERNES") + private Boolean indviernes; + @Column(name = "INDSABADO") + private Boolean indsabado; + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + + public PtovtaHorario() { + } + + public PtovtaHorario(Integer ptovtaHorarioId) { + this.ptovtaHorarioId = ptovtaHorarioId; + } + + public PtovtaHorario(Integer ptovtaHorarioId, Date inicio, Date fim, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaHorarioId = ptovtaHorarioId; + this.inicio = inicio; + this.fim = fim; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaHorarioId() { + return ptovtaHorarioId; + } + + public void setPtovtaHorarioId(Integer ptovtaHorarioId) { + this.ptovtaHorarioId = ptovtaHorarioId; + } + + public Date getInicio() { + return inicio; + } + + public void setInicio(Date inicio) { + this.inicio = inicio; + } + + public Date getFim() { + return fim; + } + + public void setFim(Date fim) { + this.fim = fim; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Boolean getIndlunes() { + return indlunes; + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return indmartes; + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return indmiercoles; + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndjueves() { + return indjueves; + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndviernes() { + return indviernes; + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Boolean getIndsabado() { + return indsabado; + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getInddomingo() { + return inddomingo; + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaHorarioId != null ? ptovtaHorarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaHorario)) { + return false; + } + PtovtaHorario other = (PtovtaHorario) object; + if ((this.ptovtaHorarioId == null && other.ptovtaHorarioId != null) || (this.ptovtaHorarioId != null && !this.ptovtaHorarioId.equals(other.ptovtaHorarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaHorario[ ptovtaHorarioId=" + ptovtaHorarioId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java new file mode 100644 index 000000000..36ba3d3f3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * PtovtaTipoEstoque generated by hbm2java + */ +@Entity +@Table(name = "PTOVTA_TIPO_ESTOQUE") +public class PtovtaTipoEstoque implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final int TIPO_CONTABILIDAD = 1; + public static final int TIPO_SUMINISTRO = 2; + public static final int TIPO_NORMAL = 3; + + private Integer ptovtatipoestId; + private String desctipoest; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public PtovtaTipoEstoque() { + } + + public PtovtaTipoEstoque(Integer ptovtatipoestId) { + this.ptovtatipoestId = ptovtatipoestId; + } + + public PtovtaTipoEstoque(Integer ptovtatipoestId, String desctipoest, Boolean activo, Date fecmodif, Integer usuarioId) { + this.ptovtatipoestId = ptovtatipoestId; + this.desctipoest = desctipoest; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return desctipoest; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtatipoestId != null ? ptovtatipoestId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaTipoEstoque)) + return false; + + PtovtaTipoEstoque other = (PtovtaTipoEstoque) object; + if ((this.ptovtatipoestId == null && other.ptovtatipoestId != null) || (this.ptovtatipoestId != null && !this.ptovtatipoestId.equals(other.ptovtatipoestId))) { + return false; + } + return true; + } + + @Id + @Column(name = "PTOVTATIPOEST_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getPtovtatipoestId() { + return this.ptovtatipoestId; + } + + public void setPtovtatipoestId(Integer ptovtatipoestId) { + this.ptovtatipoestId = ptovtatipoestId; + } + + @Column(name = "DESCTIPOEST", length = 20) + public String getDesctipoest() { + return this.desctipoest; + } + + public void setDesctipoest(String desctipoest) { + this.desctipoest = desctipoest; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java new file mode 100644 index 000000000..4430adbe6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java @@ -0,0 +1,198 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@Table(name = "PTOVTA_TITULAR") +@SequenceGenerator(name = "PTOVTA_TITULAR_SEQ ", sequenceName = "PTOVTA_TITULAR_SEQ ", allocationSize = 1) +public class PtovtaTitular implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_TITULAR_SEQ ") + @Column(name = "PTOVTATITULAR_ID") + private Integer ptovtaTitularId; + + @Column(name = "NOME") + private String nome; + + @Column(name = "CPF") + private String cpf; + + @Column(name = "RG") + private String rg; + + @Column(name = "ORGAOEMISSOR") + private String orgaoemissor; + @Lob + @Column(name = "IMAGEM") + private byte[] imagem; + + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "titularId") + private List puntoVentaList; + + public PtovtaTitular() { + } + + public PtovtaTitular(Integer ptovtaTitularId) { + this.ptovtaTitularId = ptovtaTitularId; + } + + public PtovtaTitular(Integer ptovtaTitularId, String nome, String cpf, String rg, String orgaoemissor, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaTitularId = ptovtaTitularId; + this.nome = nome; + this.cpf = cpf; + this.rg = rg; + this.orgaoemissor = orgaoemissor; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaTitularId() { + return ptovtaTitularId; + } + + public void setPtovtaTitularId(Integer ptovtaTitularId) { + this.ptovtaTitularId = ptovtaTitularId; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getCpf() { + return cpf; + } + + public void setCpf(String cpf) { + this.cpf = cpf; + } + + public String getRg() { + return rg; + } + + public void setRg(String rg) { + this.rg = rg; + } + + public String getOrgaoemissor() { + return orgaoemissor; + } + + public void setOrgaoemissor(String orgaoemissor) { + this.orgaoemissor = orgaoemissor; + } + + public byte[] getImagem() { + return imagem; + } + + public void setImagem(byte[] imagem) { + this.imagem = imagem; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaTitularId != null ? ptovtaTitularId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaTitular)) { + return false; + } + PtovtaTitular other = (PtovtaTitular) object; + if ((this.ptovtaTitularId == null && other.ptovtaTitularId != null) || (this.ptovtaTitularId != null && !this.ptovtaTitularId.equals(other.ptovtaTitularId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaTitular[ ptovtaTitularId=" + ptovtaTitularId + " ]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java new file mode 100644 index 000000000..64d714cba --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -0,0 +1,865 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1) +@Table(name = "PUNTO_VENTA") +public class PuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PUNTO_VENTA_SEQ") + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "NOMBPUNTOVENTA") + private String nombpuntoventa; + @Column(name = "DIRECCIONCALLE") + private String direccioncalle; + @Column(name = "DIRECCIONNUMERO") + private String direccionnumero; + @Column(name = "STATUSAPROBACION") + private String statusaprobacion; + @Column(name = "COMENTARIOS") + private String comentarios; + @Column(name = "NUMTELEFONOUNO") + private String numtelefonouno; + @Column(name = "NUMTELEFONODOS") + private String numtelefonodos; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "DESCCORREO") + private String descCorreo; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @OneToOne (fetch = FetchType.EAGER) + @JoinColumn(name = "COLONIA_ID") + private Colonia colonia; + @OneToOne + @JoinColumn(name = "MONEDA_ID") + private Moneda moneda; + @OneToOne + @JoinColumn(name = "PARADA_ID") + private Parada parada; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPuntoVenta; + @OneToMany(mappedBy = "puntoVenta") + private List reservacionPuntoventaList; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @Column(name = "INDCONEXIONBANCARIA") + private String conexionBancaria; + @Column(name = "DSCUSUARIOINTERNET") + private String dscUsuarioInternet; + @Column(name = "DSCCONTRASENAINTERNET") + private String dscContrasenaInternet; + @OneToOne + @JoinColumn(name = "USUARIOBANCARIO_ID") + private UsuarioBancario usuarioBancario; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsFormaPagoDet; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsParamRecoleccion; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsPtovtaEmpresa; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsPtovtaUsuarioBancario; + @Column(name = "NUMFAX") + private String numfax; + @Column(name = "COMPLE") + private String compl; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + private List ptovtaEstoqueList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + private List ptovtaHorarioList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + private List ptovtaAntecipacomissaoList; + @JoinColumn(name = "PTOVTACOMISSAO_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaComissao comissaoId; + @JoinColumn(name = "PTOVTADIVERSOS_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaDiversos diversosId; + @JoinColumn(name = "PTOVTAAGENCIA_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaAgencia agenciaId; + @JoinColumn(name = "PTOVTATITULAR_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaTitular titularId; + @Column(name = "NUMPUNTOVENTA") + private String numPuntoVenta; + @Column(name = "INDVALIDASTOCK") + private Boolean indValidaStock; + @Column(name = "INDPERMISOTASAEMBARQUE") + private Boolean indPermisoTasaEmbarque; + @Column(name = "TIEMPOCANCELACION") + private Integer tiempoCancelacion; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "PUNTOVENTAPADRE_ID") + private PuntoVenta puntoVentaPadre; + @Column(name = "INDESTOQUEMOTORISTA") + private Boolean indEstoqueMotorista; + + @JoinColumn(name = "PTOVTATIPOEST_ID") + @ManyToOne + private PtovtaTipoEstoque ptovtaTipoEstoque; + + @Column(name = "INDCTRLESTCENTRAL") + private Boolean usaCrtlEstCentral; + + @Column(name = "NUMDOCPUNTOVENTA") + private String numDoCPuntoVenta; + + @Column(name = "RAZONSOCIAL") + private String razonSocial; + + @Column(name = "INCPROGCONCESSAOCREDITO") + private Boolean incProgConcessaoCredito; + + @Column(name = "NUMIEPUNTOVENTA") + private String numIEPuntoVenta; + + @Column(name = "INDINTEGRACION") + private Integer indIntegracion; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaEmpresaBloqueadaList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaCheckinList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaSeguroList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaCatIndList; + + @Column(name = "CODPOSTAL") + private Long codpostal; + + + @Column(name = "INDBLOQCANCIMPPOSTERIOR ") + private Boolean indBloqueiaCancelamentoImpressaoPosterior; + @Column (name="TEMPOMINIMOIMPRESSAO") + @Temporal(TemporalType.TIMESTAMP) + private Date tempoMinimoParaImpressao; + @Column(name = "VALIDATEMPOPARAIMPRESSAO") + private Boolean validaTempoParaImpressao; + + public PtovtaEmpresaBloqueada addEmpresaBloqueada(Empresa e) { + PtovtaEmpresaBloqueada eb = new PtovtaEmpresaBloqueada(); + eb.setEmpresa(e); + eb.setPuntoventaId(this); + eb.setActivo(Boolean.TRUE); + eb.setFecmodif(Calendar.getInstance().getTime()); + eb.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.ptovtaEmpresaBloqueadaList.add(eb); + return eb; + } + + public void removeEmpresaBloqueada(PtovtaEmpresaBloqueada e) { + this.ptovtaEmpresaBloqueadaList.remove(e); + } + + public void removeEmpresaBloqueada(Empresa e) { + for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList) { + if (eb.getEmpresa().equals(e)) { + this.ptovtaEmpresaBloqueadaList.remove(e); + break; + } + } + } + + public PtovtaTipoEstoque getPtovtaTipoEstoque() { + return ptovtaTipoEstoque; + } + + public void setPtovtaTipoEstoque(PtovtaTipoEstoque ptovtaTipoEstoque) { + this.ptovtaTipoEstoque = ptovtaTipoEstoque; + } + + public PtovtaComissao getComissaoId() { + return comissaoId; + } + + public void setComissaoId(PtovtaComissao comissaoId) { + this.comissaoId = comissaoId; + } + + public PtovtaDiversos getDiversosId() { + return diversosId; + } + + public void setDiversosId(PtovtaDiversos diversosId) { + this.diversosId = diversosId; + } + + public PtovtaTitular getTitularId() { + return titularId; + } +public void setTitularId(PtovtaTitular titularId) { + this.titularId = titularId; + } + + public PtovtaAgencia getAgenciaId() { + return agenciaId; + } + + public void setAgenciaId(PtovtaAgencia agenciaId) { + this.agenciaId = agenciaId; + } + + public PuntoVenta() { + this.colonia = new Colonia(); + this.agenciaId = new PtovtaAgencia(); + this.titularId = new PtovtaTitular(); + this.comissaoId = new PtovtaComissao(); + this.diversosId = new PtovtaDiversos(); + this.ptovtaCheckinList = new ArrayList(); + this.ptovtaSeguroList = new ArrayList(); + this.ptovtaCatIndList = new ArrayList(); + this.ptovtaEmpresaBloqueadaList = new ArrayList(); + } + + public PuntoVenta(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getDireccioncalle() { + return direccioncalle; + } + + public void setDireccioncalle(String direccioncalle) { + this.direccioncalle = direccioncalle; + } + + public String getDireccionnumero() { + return direccionnumero; + } + + public void setDireccionnumero(String direccionnumero) { + this.direccionnumero = direccionnumero; + } + + public String getStatusaprobacion() { + return statusaprobacion; + } + + public void setStatusaprobacion(String statusaprobacion) { + this.statusaprobacion = statusaprobacion; + } + + public String getComentarios() { + return comentarios; + } + + public void setComentarios(String comentarios) { + this.comentarios = comentarios; + } + + public String getNumtelefonouno() { + return numtelefonouno; + } + + public void setNumtelefonouno(String numtelefonouno) { + this.numtelefonouno = numtelefonouno; + } + + public String getNumtelefonodos() { + return numtelefonodos; + } + + public void setNumtelefonodos(String numtelefonodos) { + this.numtelefonodos = numtelefonodos; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public List getReservacionPuntoventaList() { + return reservacionPuntoventaList; + } + + public void setReservacionPuntoventaList(List reservacionPuntoventaList) { + this.reservacionPuntoventaList = reservacionPuntoventaList; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public List getLsFormaPagoDet() { + List tmp = new ArrayList(); + if (lsFormaPagoDet != null) { + for (FormaPagoDet ddab : this.lsFormaPagoDet) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.lsFormaPagoDet = tmp; + return tmp; + } + + public List getLsParamRecoleccion() { + List tmp = new ArrayList(); + if (this.lsParamRecoleccion != null) { + for (ParamRecoleccion ddab : this.lsParamRecoleccion) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.lsParamRecoleccion = tmp; + return tmp; + } + + public List getLsPtovtaEmpresa() { + List tmp = new ArrayList(); + if (this.lsPtovtaEmpresa != null) { + for (PtovtaEmpresa ddab : this.lsPtovtaEmpresa) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.lsPtovtaEmpresa = tmp; + return tmp; + } + + public void setLsPtovtaEmpresa(List lsPtovtaEmpresa) { + this.lsPtovtaEmpresa = lsPtovtaEmpresa; + } + + public List getLsPtovtaUsuarioBancario() { + List tmp = new ArrayList(); + if (this.lsPtovtaUsuarioBancario != null) { + for (PtoVtaUsuarioBancario ddab : this.lsPtovtaUsuarioBancario) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.lsPtovtaUsuarioBancario = tmp; + return tmp; + } + + public String getNumfax() { + return numfax; + } + + public void setNumfax(String numfax) { + this.numfax = numfax; + } + + public String getCompl() { + return compl; + } + + public void setCompl(String compl) { + this.compl = compl; + } + + public List getPtovtaEstoqueList() { + return ptovtaEstoqueList; + } + + public void setPtovtaEstoqueList(List ptovtaEstoqueList) { + this.ptovtaEstoqueList = ptovtaEstoqueList; + } + + public List getPtovtaHorarioList() { + + List tmp = new ArrayList(); + if (this.ptovtaHorarioList != null) { + for (PtovtaHorario ddab : this.ptovtaHorarioList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.ptovtaHorarioList = tmp; + return tmp; + } + + public void setPtovtaHorarioList(List ptovtaHorarioList) { + this.ptovtaHorarioList = ptovtaHorarioList; + } + + public List getPtovtaAntecipacomissaoList() { + + List tmp = new ArrayList(); + if (this.ptovtaAntecipacomissaoList != null) { + for (PtovtaAntecipacomissao ddab : this.ptovtaAntecipacomissaoList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.ptovtaAntecipacomissaoList = tmp; + return tmp; + + } + + public void setPtovtaAntecipacomissaoList(List ptovtaAntecipacomissaoList) { + this.ptovtaAntecipacomissaoList = ptovtaAntecipacomissaoList; + } + + public void setLsPtovtaUsuarioBancario(List lsPtovtaUsuarioBancario) { + this.lsPtovtaUsuarioBancario = lsPtovtaUsuarioBancario; + } + + public void setLsParamRecoleccion(List lsParamRecoleccion) { + this.lsParamRecoleccion = lsParamRecoleccion; + } + + public String getConexionBancaria() { + return conexionBancaria; + } + + public void setConexionBancaria(String conexionBancaria) { + this.conexionBancaria = conexionBancaria; + } + + public UsuarioBancario getUsuarioBancario() { + return usuarioBancario; + } + + public void setUsuarioBancario(UsuarioBancario usuarioBancario) { + this.usuarioBancario = usuarioBancario; + } + + public void setLsFormaPagoDet(List lsFormaPagoDet) { + this.lsFormaPagoDet = lsFormaPagoDet; + } + + // public List getRequisicionBoletoList() { + // return requisicionBoletoList; + // } + // + // public void setRequisicionBoletoList(List requisicionBoletoList) { + // this.requisicionBoletoList = requisicionBoletoList; + // } + + @Override + public int hashCode() { + int hash = 0; + hash += (puntoventaId != null ? puntoventaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PuntoVenta)) { + return false; + } + PuntoVenta other = (PuntoVenta) object; + if ((this.puntoventaId == null && other.puntoventaId != null) || (this.puntoventaId != null && !this.puntoventaId.equals(other.puntoventaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombpuntoventa(); + } + + /** + * @return the colonia + */ + public Colonia getColonia() { + return colonia; + } + + /** + * @param colonia + * the colonia to set + */ + public void setColonia(Colonia colonia) { + this.colonia = colonia; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + public String getDscContrasenaInternet() { + return dscContrasenaInternet; + } + + public void setDscContrasenaInternet(String dscContrasenaInternet) { + this.dscContrasenaInternet = dscContrasenaInternet; + } + + public String getDscUsuarioInternet() { + return dscUsuarioInternet; + } + + public void setDscUsuarioInternet(String dscUsuarioInternet) { + this.dscUsuarioInternet = dscUsuarioInternet; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public Boolean getIndValidaStock() { + return indValidaStock; + } + + public void setIndValidaStock(Boolean indValidaStock) { + this.indValidaStock = indValidaStock; + } + + public Boolean getIndPermisoTasaEmbarque() { + return indPermisoTasaEmbarque; + } + + public void setIndPermisoTasaEmbarque(Boolean indPermisoTasaEmbarque) { + this.indPermisoTasaEmbarque = indPermisoTasaEmbarque; + } + + public Integer getTiempoCancelacion() { + return tiempoCancelacion; + } + + public void setTiempoCancelacion(Integer tiempoCancelacion) { + this.tiempoCancelacion = tiempoCancelacion; + } + + public PuntoVenta getPuntoVentaPadre() { + return puntoVentaPadre; + } + + public void setPuntoVentaPadre(PuntoVenta puntoVentaPadre) { + this.puntoVentaPadre = puntoVentaPadre; + } + + public Boolean isUsaCrtlEstCentral() { + return usaCrtlEstCentral; + } + + public void setUsaCrtlEstCentral(Boolean usaCrtlEstCentral) { + this.usaCrtlEstCentral = usaCrtlEstCentral; + } + + public String getNumDoCPuntoVenta() { + return numDoCPuntoVenta; + } + + public void setNumDoCPuntoVenta(String numDoCPuntoVenta) { + this.numDoCPuntoVenta = numDoCPuntoVenta; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public List getPtovtaEmpresaBloqueadaList() { + List lista = new ArrayList(); + for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList) { + if (eb.getActivo()) { + lista.add(eb); + } + } + return lista; + } + + public void setPtovtaEmpresaBloqueadaList(List ptovtaEmpresaBloqueadaList) { + this.ptovtaEmpresaBloqueadaList = ptovtaEmpresaBloqueadaList; + } + + public List getPtovtaCheckinList() { + List lista = new ArrayList(); + for (PtoVtaCheckin ck : ptovtaCheckinList) { + if (ck.getActivo()) { + lista.add(ck); + } + } + return lista; + } + + public void setPtovtaCheckinList(List ptovtaCheckinList) { + this.ptovtaCheckinList = ptovtaCheckinList; + } + + public PtoVtaCheckin addPtovtaCheckin(PtoVtaCheckin pto) { + PtoVtaCheckin pt = new PtoVtaCheckin(); + pt.setPuntoventaId(pto.getPuntoventaId()); + pt.setParadaId(pto.getParadaId()); + pt.setActivo(Boolean.TRUE); + pt.setFecmodif(Calendar.getInstance().getTime()); + pt.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.ptovtaCheckinList.add(pt); + return pt; + } + + public void removePtovtaCheckin(PtoVtaCheckin pto) { + this.ptovtaCheckinList.remove(pto); + } + + public List getPtovtaSeguroList() { + List lista = new ArrayList(); + for (PtoVtaSeguro ck : ptovtaSeguroList) { + if (ck.getActivo()) { + lista.add(ck); + } + } + return lista; + } + + public void setPtovtaSeguroList(List ptovtaSeguroList) { + this.ptovtaSeguroList = ptovtaSeguroList; + } + + public PtoVtaSeguro addPtovtaSeguro(PtoVtaSeguro pto) { + PtoVtaSeguro pt = new PtoVtaSeguro(); + pt.setPuntoventaId(pto.getPuntoventaId()); + pt.setEmpresa(pto.getEmpresa()); + pt.setIndVendeSegOpcional(pto.getIndVendeSegOpcional()); + pt.setIndEstanSegOpcional(pto.getIndEstanSegOpcional()); + pt.setIndEstanTasaEmbarque(pto.getIndEstanTasaEmbarque()); + pt.setIndPermisoTasaEmbarque(pto.getIndPermisoTasaEmbarque()); + pt.setIndPermisoTasaEmbarqueVtaManual(pto.getIndPermisoTasaEmbarqueVtaManual()); + pt.setActivo(Boolean.TRUE); + pt.setFecmodif(Calendar.getInstance().getTime()); + pt.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.ptovtaSeguroList.add(pt); + return pt; + } + + public void removePtovtaSeguro(PtoVtaSeguro pto) { + this.ptovtaSeguroList.remove(pto); + } + + public List getPtovtaCatIndList() { + List lista = new ArrayList(); + for (PtovtaCatInd ck : ptovtaCatIndList) { + if (ck.getActivo()) { + lista.add(ck); + } + } + return lista; + } + + public void setPtovtaCatIndList(List ptovtaCatIndList) { + this.ptovtaCatIndList = ptovtaCatIndList; + } + + public PtovtaCatInd addPtovtaCatInd(PtovtaCatInd pto) { + pto.setActivo(Boolean.TRUE); + pto.setFecmodif(Calendar.getInstance().getTime()); + pto.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + this.ptovtaCatIndList.add(pto); + return pto; + } + + public void removePtovtaCatInd(PtovtaCatInd pto) { + this.ptovtaCatIndList.remove(pto); + } + + public String getNumIEPuntoVenta() { + return numIEPuntoVenta; + } + + public void setNumIEPuntoVenta(String numIEPuntoVenta) { + this.numIEPuntoVenta = numIEPuntoVenta; + } + + public Boolean getIncProgConcessaoCredito() { + return incProgConcessaoCredito; + } + + public void setIncProgConcessaoCredito(Boolean incProgConcessaoCredito) { + this.incProgConcessaoCredito = incProgConcessaoCredito; + } + + public Integer getIndIntegracion() { + return indIntegracion; + } + + public void setIndIntegracion(Integer indIntegracion) { + this.indIntegracion = indIntegracion; + } + + public Long getCodpostal() { + return codpostal; + } + + public void setCodpostal(Long codpostal) { + this.codpostal = codpostal; + } + + public Boolean getIndEstoqueMotorista() { + return indEstoqueMotorista; + } + + public void setIndEstoqueMotorista(Boolean indEstoqueMotorista) { + this.indEstoqueMotorista = indEstoqueMotorista; + } + + + + public Boolean getIndBloqueiaCancelamentoImpressaoPosterior() { + return indBloqueiaCancelamentoImpressaoPosterior; + } + + public void setIndBloqueiaCancelamentoImpressaoPosterior(Boolean indBloqueiaCancelamentoImpressaoPosterior) { + this.indBloqueiaCancelamentoImpressaoPosterior = indBloqueiaCancelamentoImpressaoPosterior; + } + + public Date getTempoMinimoParaImpressao() { + return tempoMinimoParaImpressao; + } + + public void setTempoMinimoParaImpressao(Date tempoMinimoParaImpressao) { + this.tempoMinimoParaImpressao = tempoMinimoParaImpressao; + } + + public Boolean getValidaTempoParaImpressao() { + return validaTempoParaImpressao; + } + + public void setValidaTempoParaImpressao(Boolean validaTempoParaImpressao) { + this.validaTempoParaImpressao = validaTempoParaImpressao; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Redondeo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Redondeo.java new file mode 100644 index 000000000..77dbc0a93 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Redondeo.java @@ -0,0 +1,169 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "REDONDEO_SEQ", sequenceName = "REDONDEO_SEQ", allocationSize = 1) +@Table(name = "REDONDEO") +public class Redondeo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_SEQ") + @Basic(optional = false) + @Column(name = "REDONDEO_ID") + private Integer redondeoId; + @Column(name = "VALORINICIAL") + private BigDecimal valorinicial; + @Column(name = "VALORFINAL") + private BigDecimal valorfinal; + @Column(name = "VALORREDONDEO") + private BigDecimal valorredondeo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "REDONDEOCTRL_ID", referencedColumnName = "REDONDEOCTRL_ID") + @ManyToOne + private RedondeoCtrl redondeoCtrl; + + public Redondeo() { + } + + public Redondeo(Integer redondeoId) { + this.redondeoId = redondeoId; + } + + public Integer getRedondeoId() { + return redondeoId; + } + + public void setRedondeoId(Integer redondeoId) { + this.redondeoId = redondeoId; + } + + public BigDecimal getValorinicial() { + return valorinicial; + } + + public void setValorinicial(BigDecimal valorinicial) { + this.valorinicial = valorinicial; + } + + public BigDecimal getValorfinal() { + return valorfinal; + } + + public void setValorfinal(BigDecimal valorfinal) { + this.valorfinal = valorfinal; + } + + public BigDecimal getValorredondeo() { + return valorredondeo; + } + + public void setValorredondeo(BigDecimal valorredondeo) { + this.valorredondeo = valorredondeo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public RedondeoCtrl getRedondeoCtrl() { + return redondeoCtrl; + } + + public void setRedondeoCtrl(RedondeoCtrl redondeoCtrl) { + this.redondeoCtrl = redondeoCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Redondeo other = (Redondeo) obj; + if (this.valorinicial != other.valorinicial && (this.valorinicial == null || !this.valorinicial.equals(other.valorinicial))) { + return false; + } + if (this.valorfinal != other.valorfinal && (this.valorfinal == null || !this.valorfinal.equals(other.valorfinal))) { + return false; + } + if (this.valorredondeo != other.valorredondeo && (this.valorredondeo == null || !this.valorredondeo.equals(other.valorredondeo))) { + return false; + } + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.redondeoCtrl != other.redondeoCtrl && (this.redondeoCtrl == null || !this.redondeoCtrl.equals(other.redondeoCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 41 * hash + (this.valorinicial != null ? this.valorinicial.hashCode() : 0); + hash = 41 * hash + (this.valorfinal != null ? this.valorfinal.hashCode() : 0); + hash = 41 * hash + (this.valorredondeo != null ? this.valorredondeo.hashCode() : 0); + hash = 41 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 41 * hash + (this.redondeoCtrl != null ? this.redondeoCtrl.hashCode() : 0); + return hash; + } + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Redondeo[redondeoId=" + redondeoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java new file mode 100644 index 000000000..795f4ce88 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java @@ -0,0 +1,162 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "REDONDEO_CTRL_SEQ", sequenceName = "REDONDEO_CTRL_SEQ", allocationSize = 1) +@Table(name = "REDONDEO_CTRL") +public class RedondeoCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_CTRL_SEQ") + @Basic(optional = false) + @Column(name = "REDONDEOCTRL_ID") + private Integer redondeoctrlId; + @Column(name = "INDAPLICADESCUENTO") + private Boolean indaplicadescuento; + @Column(name = "INDAPLICAPRICING") + private Boolean indaplicapricing; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL) + private List redondeoMarcaList; + @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL) + private List redondeoList; + + public RedondeoCtrl() { + } + + public RedondeoCtrl(Integer redondeoctrlId) { + this.redondeoctrlId = redondeoctrlId; + } + + public Integer getRedondeoctrlId() { + return redondeoctrlId; + } + + public void setRedondeoctrlId(Integer redondeoctrlId) { + this.redondeoctrlId = redondeoctrlId; + } + + public Boolean getIndaplicadescuento() { + return indaplicadescuento; + } + + public void setIndaplicadescuento(Boolean indaplicadescuento) { + this.indaplicadescuento = indaplicadescuento; + } + + public Boolean getIndaplicapricing() { + return indaplicapricing; + } + + public void setIndaplicapricing(Boolean indaplicapricing) { + this.indaplicapricing = indaplicapricing; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getRedondeoMarcaList() { + List rmList = new ArrayList(); + for (RedondeoMarca rm : this.redondeoMarcaList) { + if (rm.getActivo() == Boolean.TRUE) { + rmList.add(rm); + } + } + return rmList; + } + + public void setRedondeoMarcaList(List redondeoMarcaList) { + this.redondeoMarcaList = redondeoMarcaList; + } + + public List getRedondeoList() { + List rmList = new ArrayList(); + for (Redondeo rm : this.redondeoList) { + if (rm.getActivo() == Boolean.TRUE) { + rmList.add(rm); + } + } + return rmList; + } + + public void setRedondeoList(List redondeoList) { + this.redondeoList = redondeoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (redondeoctrlId != null ? redondeoctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RedondeoCtrl)) { + return false; + } + RedondeoCtrl other = (RedondeoCtrl) object; + if ((this.redondeoctrlId == null && other.redondeoctrlId != null) || (this.redondeoctrlId != null && !this.redondeoctrlId.equals(other.redondeoctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RedondeoCtrl[redondeoctrlId=" + redondeoctrlId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RedondeoMarca.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RedondeoMarca.java new file mode 100644 index 000000000..6058d0508 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RedondeoMarca.java @@ -0,0 +1,144 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "REDONDEO_MARCA_SEQ", sequenceName = "REDONDEO_MARCA_SEQ", allocationSize = 1) +@Table(name = "REDONDEO_MARCA") +public class RedondeoMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_MARCA_SEQ") + @Basic(optional = false) + @Column(name = "REDONDEO_MARCA") + private Integer redondeoMarca; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "REDONDEOCTRL_ID", referencedColumnName = "REDONDEOCTRL_ID") + @ManyToOne + private RedondeoCtrl redondeoCtrl; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + + public RedondeoMarca() { + } + + public RedondeoMarca(Integer redondeoMarca) { + this.redondeoMarca = redondeoMarca; + } + + public Integer getRedondeoMarca() { + return redondeoMarca; + } + + public void setRedondeoMarca(Integer redondeoMarca) { + this.redondeoMarca = redondeoMarca; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public RedondeoCtrl getRedondeoCtrl() { + return redondeoCtrl; + } + + public void setRedondeoCtrl(RedondeoCtrl redondeoCtrl) { + this.redondeoCtrl = redondeoCtrl; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final RedondeoMarca other = (RedondeoMarca) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.redondeoCtrl != other.redondeoCtrl && (this.redondeoCtrl == null || !this.redondeoCtrl.equals(other.redondeoCtrl))) { + return false; + } + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 47 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 47 * hash + (this.redondeoCtrl != null ? this.redondeoCtrl.hashCode() : 0); + hash = 47 * hash + (this.marca != null ? this.marca.hashCode() : 0); + return hash; + } + + + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RedondeoMarca[redondeoMarca=" + redondeoMarca + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RequisicionBoleto.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RequisicionBoleto.java new file mode 100644 index 000000000..99b4e07ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RequisicionBoleto.java @@ -0,0 +1,175 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "REQUISICION_BOLETO_SEQ", sequenceName = "REQUISICION_BOLETO_SEQ", allocationSize = 1) +@Table(name = "REQUISICION_BOLETO") +public class RequisicionBoleto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REQUISICION_BOLETO_SEQ") + @Column(name = "REQUISICIONBOLETO_ID") + private Integer requisicionboletoId; + @Column(name = "CANTFAJILLA") + private Long cantfajilla; + @Column(name = "STATUSENVIO") + private Boolean statusenvio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + @ManyToOne + private Estacion estacion; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CLASIFICACION_ID", referencedColumnName = "CLASIFICACION_ID") + @ManyToOne + private Clasificacion clasificacion; + @JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID") + @ManyToOne + private Articulo articulo; + + public Integer getRequisicionboletoId() { + return requisicionboletoId; + } + + public void setRequisicionboletoId(Integer requisicionboletoId) { + this.requisicionboletoId = requisicionboletoId; + } + + public Long getCantfajilla() { + return cantfajilla; + } + + public void setCantfajilla(Long cantfajilla) { + this.cantfajilla = cantfajilla; + } + + public Boolean getStatusenvio() { + return statusenvio; + } + + public void setStatusenvio(Boolean statusenvio) { + this.statusenvio = statusenvio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Clasificacion getClasificacion() { + return clasificacion; + } + + public void setClasificacion(Clasificacion clasificacion) { + this.clasificacion = clasificacion; + } + + public Articulo getArticulo() { + return articulo; + } + + public void setArticulo(Articulo articulo) { + this.articulo = articulo; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((requisicionboletoId == null) ? 0 : requisicionboletoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + RequisicionBoleto other = (RequisicionBoleto) obj; + if (requisicionboletoId == null) { + if (other.requisicionboletoId != null) + return false; + } else if (!requisicionboletoId.equals(other.requisicionboletoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RequisicionBoleto [requisicionboletoId=" + requisicionboletoId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionCategoria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionCategoria.java new file mode 100644 index 000000000..823873551 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionCategoria.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_CATEGORIA_SEQ", sequenceName = "RESERVACION_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_CATEGORIA") +public class ReservacionCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_CATEGORIA_SEQ") + @Column(name = "RESERVACIONCATEGORIA_ID") + private Integer reservacioncategoriaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + public ReservacionCategoria() { + } + + public ReservacionCategoria(Integer reservacioncategoriaId) { + this.reservacioncategoriaId = reservacioncategoriaId; + } + + public Integer getReservacioncategoriaId() { + return reservacioncategoriaId; + } + + public void setReservacioncategoriaId(Integer reservacioncategoriaId) { + this.reservacioncategoriaId = reservacioncategoriaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionCategoria other = (ReservacionCategoria) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.categoria != other.categoria && (this.categoria == null || !this.categoria.equals(other.categoria))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 73 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 73 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 73 * hash + (this.categoria != null ? this.categoria.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionCategoria[reservacioncategoriaId=" + reservacioncategoriaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionClase.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionClase.java new file mode 100644 index 000000000..107cba96b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionClase.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_CLASE_SEQ", sequenceName = "RESERVACION_CLASE_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_CLASE") +public class ReservacionClase implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_CLASE_SEQ") + @Column(name = "RESERVACIONCLASE_ID") + private Integer reservacionclaseId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public ReservacionClase() { + } + + public ReservacionClase(Integer reservacionclaseId) { + this.reservacionclaseId = reservacionclaseId; + } + + public Integer getReservacionclaseId() { + return reservacionclaseId; + } + + public void setReservacionclaseId(Integer reservacionclaseId) { + this.reservacionclaseId = reservacionclaseId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionClase other = (ReservacionClase) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 97 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 97 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 97 * hash + (this.claseServicio != null ? this.claseServicio.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionClase[reservacionclaseId=" + reservacionclaseId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionCtrl.java new file mode 100644 index 000000000..d1140e13b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionCtrl.java @@ -0,0 +1,481 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_CTRL_SEQ", sequenceName = "RESERVACION_CTRL_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_CTRL") +public class ReservacionCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_CTRL_SEQ") + @Column(name = "RESERVACIONCTRL_ID") + private Integer reservacionctrlId; + @Column(name = "DESCCONFIG") + private String descConfig; + @Column(name = "FECINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicio; + @Column(name = "FECFINAL") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinal; + @Column(name = "TIEMPOLIBERACION") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacion; + @Column(name = "TIEMPOLIBERACIONINTERNET") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacioninternet; + @Column(name = "TIEMPOPREVIO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoprevio; + @Column(name = "TIEMPOPREVIOINTERNET") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempopreviointernet; + @Column(name = "NUMASIENTOSCORRIDA") + private Short numasientoscorrida; + @Column(name = "INDAPLICLUN") + private Boolean indapliclun; + @Column(name = "INDAPLICMAR") + private Boolean indaplicmar; + @Column(name = "INDAPLICMIE") + private Boolean indaplicmie; + @Column(name = "INDAPLICJUE") + private Boolean indaplicjue; + @Column(name = "INDAPLICVIE") + private Boolean indaplicvie; + @Column(name = "INDAPLICSAB") + private Boolean indaplicsab; + @Column(name = "INDAPLICDOM") + private Boolean indaplicdom; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionCategoriaList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionMercadoList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionMarcaList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionClaseList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionPuntoVentaList; + @Column(name = "TIEMPOLIBERACIONCADUC") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacionCaduc; + @Column(name = "TIEMPOLIBERACIONINTERNETCADUC") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacioninternetCaduc; + + public ReservacionCtrl() { + } + + public ReservacionCtrl(Integer reservacionctrlId) { + this.reservacionctrlId = reservacionctrlId; + } + + public ReservacionCtrl(Integer reservacionctrlId, Date fecmodif) { + this.reservacionctrlId = reservacionctrlId; + this.fecmodif = fecmodif; + } + + public Integer getReservacionctrlId() { + return reservacionctrlId; + } + + public void setReservacionctrlId(Integer reservacionctrlId) { + this.reservacionctrlId = reservacionctrlId; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecfinal() { + return fecfinal; + } + + public void setFecfinal(Date fecfinal) { + this.fecfinal = fecfinal; + } + + public Date getTiempoliberacion() { + return tiempoliberacion; + } + + public void setTiempoliberacion(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacion(c.getTime()); + } + + public void setTiempoliberacion(Date tiempoliberacion) { + this.tiempoliberacion = tiempoliberacion; + } + + public Date getTiempoliberacioninternet() { + return tiempoliberacioninternet; + } + + public void setTiempoliberacioninternet(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacioninternet(c.getTime()); + } + + public void setTiempoliberacioninternet(Date tiempoliberacioninternet) { + this.tiempoliberacioninternet = tiempoliberacioninternet; + } + + public Date getTiempoprevio() { + return tiempoprevio; + } + + public void setTiempoprevio(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoprevio(c.getTime()); + } + + public void setTiempoprevio(Date tiempoprevio) { + this.tiempoprevio = tiempoprevio; + } + + public Date getTiempopreviointernet() { + return tiempopreviointernet; + } + + public void setTiempopreviointernet(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempopreviointernet(c.getTime()); + } + + public void setTiempopreviointernet(Date tiempopreviointernet) { + this.tiempopreviointernet = tiempopreviointernet; + } + + public Short getNumasientoscorrida() { + return numasientoscorrida; + } + + public void setNumasientoscorrida(Short numasientoscorrida) { + this.numasientoscorrida = numasientoscorrida; + } + + public Boolean getIndaplicdom() { + return indaplicdom; + } + + public void setIndaplicdom(Boolean indaplicdom) { + this.indaplicdom = indaplicdom; + } + + public Boolean getIndaplicjue() { + return indaplicjue; + } + + public void setIndaplicjue(Boolean indaplicjue) { + this.indaplicjue = indaplicjue; + } + + public Boolean getIndapliclun() { + return indapliclun; + } + + public void setIndapliclun(Boolean indapliclun) { + this.indapliclun = indapliclun; + } + + public Boolean getIndaplicmar() { + return indaplicmar; + } + + public void setIndaplicmar(Boolean indaplicmar) { + this.indaplicmar = indaplicmar; + } + + public Boolean getIndaplicmie() { + return indaplicmie; + } + + public void setIndaplicmie(Boolean indaplicmie) { + this.indaplicmie = indaplicmie; + } + + public Boolean getIndaplicsab() { + return indaplicsab; + } + + public void setIndaplicsab(Boolean indaplicsab) { + this.indaplicsab = indaplicsab; + } + + public Boolean getIndaplicvie() { + return indaplicvie; + } + + public void setIndaplicvie(Boolean indaplicvie) { + this.indaplicvie = indaplicvie; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getReservacionCategoriaList() { + List rcList = new ArrayList(); + if (reservacionCategoriaList != null) { + for (ReservacionCategoria rc : this.reservacionCategoriaList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + } + + return rcList; + } + + public void setReservacionCategoriaList(List reservacionCategoriaList) { + this.reservacionCategoriaList = reservacionCategoriaList; + } + + public List getReservacionMercadoList() { + List rmList = new ArrayList(); + for (ReservacionMercado rc : this.reservacionMercadoList) { + if (rc.getActivo() == Boolean.TRUE) { + rmList.add(rc); + } + } + return rmList; + } + + public void setReservacionMercadoList(List reservacionMercadoList) { + this.reservacionMercadoList = reservacionMercadoList; + } + + public List getReservacionMarcaList() { + List rmList = new ArrayList(); + for (ReservacionMarca rm : this.reservacionMarcaList) { + if (rm.getActivo() == Boolean.TRUE) { + rmList.add(rm); + } + } + return rmList; + } + + public void setReservacionMarcaList(List reservacionMarcaList) { + this.reservacionMarcaList = reservacionMarcaList; + } + + public List getReservacionClaseList() { + List rcList = new ArrayList(); + for (ReservacionClase rc : this.reservacionClaseList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + return rcList; + } + + public void setReservacionClaseList(List reservacionClaseList) { + this.reservacionClaseList = reservacionClaseList; + } + + public String getDescConfig() { + return descConfig; + } + + public void setDescConfig(String descConfig) { + this.descConfig = descConfig; + } + + public Date getTiempoliberacionCaduc() { + return tiempoliberacionCaduc; + } + + public void setTiempoliberacionCaduc(Date tiempoliberacionCaduc) { + this.tiempoliberacionCaduc = tiempoliberacionCaduc; + } + + public Date getTiempoliberacioninternetCaduc() { + return tiempoliberacioninternetCaduc; + } + + public void setTiempoliberacioninternetCaduc(Date tiempoliberacioninternetCaduc) { + this.tiempoliberacioninternetCaduc = tiempoliberacioninternetCaduc; + } + + public void setTiempoliberacionCaduc(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacionCaduc(c.getTime()); + } + + public void setTiempoliberacioninternetCaduc(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacioninternetCaduc(c.getTime()); + } + + public List getReservacionPuntoVentaList() { + List rpvList = new ArrayList(); + for (ReservacionPuntoVenta rpv : this.reservacionPuntoVentaList) { + if (rpv.getActivo() == Boolean.TRUE) { + rpvList.add(rpv); + } + } + return rpvList; + } + + public void setReservacionPuntoVentaList(List reservacionPuntoventaList) { + this.reservacionPuntoVentaList = reservacionPuntoventaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (reservacionctrlId != null ? reservacionctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ReservacionCtrl)) { + return false; + } + ReservacionCtrl other = (ReservacionCtrl) object; + if ((this.reservacionctrlId == null && other.reservacionctrlId != null) || (this.reservacionctrlId != null && !this.reservacionctrlId.equals(other.reservacionctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionCtrl[reservacionctrlId=" + reservacionctrlId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionMarca.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionMarca.java new file mode 100644 index 000000000..4269abbf8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionMarca.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_MARCA_SEQ", sequenceName = "RESERVACION_MARCA_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_MARCA") +public class ReservacionMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_MARCA_SEQ") + @Column(name = "RESERVACIONMARCA_ID") + private Integer reservacionmarcaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public ReservacionMarca() { + } + + public ReservacionMarca(Integer reservacionmarcaId) { + this.reservacionmarcaId = reservacionmarcaId; + } + + public Integer getReservacionmarcaId() { + return reservacionmarcaId; + } + + public void setReservacionmarcaId(Integer reservacionmarcaId) { + this.reservacionmarcaId = reservacionmarcaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionMarca other = (ReservacionMarca) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 11 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 11 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 11 * hash + (this.marca != null ? this.marca.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionMarca[reservacionmarcaId=" + reservacionmarcaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionMercado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionMercado.java new file mode 100644 index 000000000..f54caa076 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionMercado.java @@ -0,0 +1,157 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_MERCADO_SEQ", sequenceName = "RESERVACION_MERCADO_SEQ", allocationSize=1) +@Table(name = "RESERVACION_MERCADO") +public class ReservacionMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_MERCADO_SEQ") + @Column(name = "RESERVACIONMERCADO_ID") + private Integer reservacionmercadoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaOrigem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaDestino; + + public ReservacionMercado() { + } + + public ReservacionMercado(Integer reservacionmercadoId) { + this.reservacionmercadoId = reservacionmercadoId; + } + + public Integer getReservacionmercadoId() { + return reservacionmercadoId; + } + + public void setReservacionmercadoId(Integer reservacionmercadoId) { + this.reservacionmercadoId = reservacionmercadoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public Parada getParadaDestino() { + return paradaDestino; + } + + public void setParadaDestino(Parada paradaDestino) { + this.paradaDestino = paradaDestino; + } + + public Parada getParadaOrigem() { + return paradaOrigem; + } + + public void setParadaOrigem(Parada paradaOrigem) { + this.paradaOrigem = paradaOrigem; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionMercado other = (ReservacionMercado) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.paradaOrigem != other.paradaOrigem && (this.paradaOrigem == null || !this.paradaOrigem.equals(other.paradaOrigem))) { + return false; + } + if (this.paradaDestino != other.paradaDestino && (this.paradaDestino == null || !this.paradaDestino.equals(other.paradaDestino))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 73 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 73 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 73 * hash + (this.paradaOrigem != null ? this.paradaOrigem.hashCode() : 0); + hash = 73 * hash + (this.paradaDestino != null ? this.paradaDestino.hashCode() : 0); + return hash; + } + + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionMercado[reservacionmercadoId=" + reservacionmercadoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java new file mode 100644 index 000000000..2afd57bcb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java @@ -0,0 +1,142 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize=1) +@Table(name = "RESERVACION_PUNTOVENTA") +public class ReservacionPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") + @Column(name = "RESERVACIONPTOVTA_ID") + private Integer reservacionptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + public ReservacionPuntoVenta() { + } + + public ReservacionPuntoVenta(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } + + public Integer getReservacionptovtaId() { + return reservacionptovtaId; + } + + public void setReservacionptovtaId(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); + return hash; + } + + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RestriccionPago.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RestriccionPago.java new file mode 100644 index 000000000..da664bbfe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RestriccionPago.java @@ -0,0 +1,134 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESTRICCION_SEQ", sequenceName = "RESTRICCION_SEQ", allocationSize=1) +@Table(name = "RESTRICCION") +public class RestriccionPago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESTRICCION_SEQ") + @Column(name = "RESTRICCION_ID") + private Short restriccionId; + @Column(name = "DESCRESTRICCION") + private String descrestriccion; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "restriccion") + private List configRestriccionPagoList; + + public RestriccionPago() { + } + + public Short getRestriccionId() { + return restriccionId; + } + + public void setRestriccionId(Short restriccionId) { + this.restriccionId = restriccionId; + } + + public String getDescrestriccion() { + return descrestriccion; + } + + public void setDescrestriccion(String descrestriccion) { + this.descrestriccion = descrestriccion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getConfigRestriccionPagoList() { + List tmp = new ArrayList(); + if (configRestriccionPagoList != null) { + for (ConfigRestriccionPago crp : this.configRestriccionPagoList) { + if (crp.getActivo()) { + tmp.add(crp); + } + } + } + + return tmp; + } + + public void setConfigRestriccionPagoList(List configRestriccionPagoList) { + this.configRestriccionPagoList = configRestriccionPagoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (restriccionId != null ? restriccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof RestriccionPago)) { + return false; + } + RestriccionPago other = (RestriccionPago) object; + if ((this.restriccionId == null && other.restriccionId != null) || (this.restriccionId != null && !this.restriccionId.equals(other.restriccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescrestriccion(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RhPagoConductor.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RhPagoConductor.java new file mode 100644 index 000000000..1e92fcb88 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RhPagoConductor.java @@ -0,0 +1,227 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@Table(name = "RH_SALIDAS") +public class RhPagoConductor implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "RHPAGOCONDUCTOR_ID") + private Integer rhpagoconductorId; +// @Column(name = "NUMPAGOCONDUCTOR") +// private Integer numpagoconductor; + @Column(name = "NUMAUTOBUS") + private Integer numautobus; + @Column(name = "NUMCORRIDA") + private Integer numcorrida; + @Column(name = "DESCRUTA") + private String descruta; + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalida; + @Column(name = "CVEOPERADOR1") + private String cveoperador1; + @Column(name = "NOMBREOPERADOR1") + private String nombreoperador1; + @Column(name = "CANTKMSOPERADOR1") + private BigDecimal cantkmsoperador1; + @Column(name = "CVEOPERADOR2") + private String cveoperador2; + @Column(name = "NOMBREOPERADOR2") + private String nombreoperador2; + @Column(name = "CANTKMSOPERADOR2") + private BigDecimal cantkmsoperador2; + @Column(name = "INDEXTRA") + private Boolean indextra; + @Column(name = "CVEORIGEN") + private String cveOrigen; + @Column(name = "CVEDESTINO") + private String cveDestino; + @Column(name = "RUTA_ID ") + private Integer ruta; + @Column(name = "MARCA_ID ") + private Short marca; + + public RhPagoConductor() { + } + + public RhPagoConductor(Integer rhpagoconductorId) { + this.rhpagoconductorId = rhpagoconductorId; + } + + public Integer getRhpagoconductorId() { + return rhpagoconductorId; + } + + public void setRhpagoconductorId(Integer rhpagoconductorId) { + this.rhpagoconductorId = rhpagoconductorId; + } + + public Integer getNumautobus() { + return numautobus; + } + + public void setNumautobus(Integer numautobus) { + this.numautobus = numautobus; + } + + public Integer getNumcorrida() { + return numcorrida; + } + + public void setNumcorrida(Integer numcorrida) { + this.numcorrida = numcorrida; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public Date getFechorsalida() { + return fechorsalida; + } + + public void setFechorsalida(Date fechorsalida) { + this.fechorsalida = fechorsalida; + } + + public String getCveoperador1() { + return cveoperador1; + } + + public void setCveoperador1(String cveoperador1) { + this.cveoperador1 = cveoperador1; + } + + public String getNombreoperador1() { + return nombreoperador1; + } + + public void setNombreoperador1(String nombreoperador1) { + this.nombreoperador1 = nombreoperador1; + } + + public BigDecimal getCantkmsoperador1() { + return cantkmsoperador1; + } + + public void setCantkmsoperador1(BigDecimal cantkmsoperador1) { + this.cantkmsoperador1 = cantkmsoperador1; + } + + public String getCveoperador2() { + return cveoperador2; + } + + public void setCveoperador2(String cveoperador2) { + this.cveoperador2 = cveoperador2; + } + + public String getNombreoperador2() { + return nombreoperador2; + } + + public void setNombreoperador2(String nombreoperador2) { + this.nombreoperador2 = nombreoperador2; + } + + public BigDecimal getCantkmsoperador2() { + return cantkmsoperador2; + } + + public void setCantkmsoperador2(BigDecimal cantkmsoperador2) { + this.cantkmsoperador2 = cantkmsoperador2; + } + + public Boolean getIndextra() { + return indextra; + } + + public void setIndextra(Boolean indextra) { + this.indextra = indextra; + } + + public String getCveDestino() { + return cveDestino; + } + + public void setCveDestino(String cveDestino) { + this.cveDestino = cveDestino; + } + + public String getCveOrigen() { + return cveOrigen; + } + + public void setCveOrigen(String cveOrigen) { + this.cveOrigen = cveOrigen; + } + + public Integer getRuta() { + return ruta; + } + + public void setRuta(Integer ruta) { + this.ruta = ruta; + } + + public Short getMarca() { + return marca; + } + + public void setMarca(Short marca) { + this.marca = marca; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (rhpagoconductorId != null ? rhpagoconductorId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RhPagoConductor)) { + return false; + } + RhPagoConductor other = (RhPagoConductor) object; + if ((this.rhpagoconductorId == null && other.rhpagoconductorId != null) || (this.rhpagoconductorId != null && !this.rhpagoconductorId.equals(other.rhpagoconductorId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RhPagoConductor[rhpagoconductorId=" + rhpagoconductorId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RolOperativo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RolOperativo.java new file mode 100644 index 000000000..22c2b6136 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RolOperativo.java @@ -0,0 +1,150 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ROL_OPERATIVO_SEQ", sequenceName = "ROL_OPERATIVO_SEQ", allocationSize=1) +@Table(name = "ROL_OPERATIVO") +public class RolOperativo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ROL_OPERATIVO_SEQ") + @Column(name = "ROLOPERATIVO_ID") + private Integer roloperativoId; + @Column(name = "DESCROLOPERATIVO") + private String descroloperativo; + @Column(name = "TIEMPOPREVIO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoprevio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "rolOperativo") + private List esquemaCorridaList; + @JoinColumn(name = "DIAGRAMAAUTOBUS_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobus; + + public RolOperativo() { + } + + public RolOperativo(Integer roloperativoId) { + this.roloperativoId = roloperativoId; + } + + public Integer getRoloperativoId() { + return roloperativoId; + } + + public void setRoloperativoId(Integer roloperativoId) { + this.roloperativoId = roloperativoId; + } + + public String getDescroloperativo() { + return descroloperativo; + } + + public void setDescroloperativo(String descroloperativo) { + this.descroloperativo = descroloperativo; + } + + public Date getTiempoprevio() { + return tiempoprevio; + } + + public void setTiempoprevio(Date tiempoprevio) { + this.tiempoprevio = tiempoprevio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getEsquemaCorridaList() { + return esquemaCorridaList; + } + + public void setEsquemaCorridaList(List esquemaCorridaList) { + this.esquemaCorridaList = esquemaCorridaList; + } + + public DiagramaAutobus getDiagramaAutobus() { + return diagramaAutobus; + } + + public void setDiagramaAutobus(DiagramaAutobus diagramaAutobus) { + this.diagramaAutobus = diagramaAutobus; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (roloperativoId != null ? roloperativoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RolOperativo)) { + return false; + } + RolOperativo other = (RolOperativo) object; + if ((this.roloperativoId == null && other.roloperativoId != null) || (this.roloperativoId != null && !this.roloperativoId.equals(other.roloperativoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescroloperativo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Ruta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Ruta.java new file mode 100644 index 000000000..78c806096 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Ruta.java @@ -0,0 +1,460 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RUTA_SEQ", sequenceName = "RUTA_SEQ", allocationSize = 1) +@org.hibernate.annotations.Entity(dynamicUpdate = true) +@Table(name = "RUTA") +public class Ruta implements Serializable, Comparable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_SEQ") + @Column(name = "RUTA_ID") + private Integer rutaId; + @Column(name = "DESCRUTA") + private String descruta; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "GRUPORUTA_ID", referencedColumnName = "GRUPORUTA_ID") + @ManyToOne + private GrupoRuta grupoRuta; + @OneToMany(mappedBy = "ruta", cascade=CascadeType.ALL) + private List rutaSecuenciaList; + @OneToMany(mappedBy = "ruta") + private List rutaCombinacionList; + @Column(name = "indnombreobligatorio") + private Boolean indNombreObligatorio; + @OneToMany(mappedBy = "ruta", cascade = CascadeType.ALL) + private List lsRutaEmpresa; + @Column(name = "INDVENTAOFFLINE") + private Boolean ventaOffLine; + @Column(name = "PREFIXO") + private String prefixo; + @Column(name = "PREFIXOAUXILIAR") + private String prefixoAuxiliar; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + @Column(name = "INDSENTIDOIDA") + private Boolean indSentidoIda; + @Column(name = "NUMRUTA") + private String numRuta; + + @Column(name = "INDTRIBTARIFA") + private Boolean indTribTarifa; + @Column(name = "INDTRIBPEDAGIO") + private Boolean indTribPedagio; + @Column(name = "INDTRIBTAXAEMBARQUE") + private Boolean indTribTaxaEmbarque; + @Column(name = "CANTEIXOS") + private Integer cantEixos; + @Column(name = "CANTASIENTOS") + private Integer cantAsientos; + @Column(name = "INDVENTARIOCARD") + private Boolean indVentaRioCard; + @Column(name = "NUMRIOCARD") + private String numRioCard; + @Column(name = "INDBLOQVTAABIERTA") + private Boolean indBloqueoVtaAbierta; + @Transient + private Boolean isClone; + + public Ruta() { + } + + public static Ruta clone(Ruta other){ + Ruta ruta = new Ruta(); + ruta.setIsClone(Boolean.TRUE); + ruta.activo = other.activo; + ruta.cantAsientos = other.cantAsientos; + ruta.cantEixos = other.cantEixos; + ruta.claseServicio = other.claseServicio; + ruta.descruta = other.descruta; + ruta.fecmodif = other.fecmodif; + ruta.grupoRuta = other.grupoRuta; + ruta.indNombreObligatorio = other.indNombreObligatorio; + ruta.indSentidoIda = other.indSentidoIda; + ruta.indTribPedagio = other.indTribPedagio; + ruta.indTribTarifa = other.indTribTarifa; + ruta.indTribTaxaEmbarque = other.indTribTaxaEmbarque; + ruta.indVentaRioCard = other.indVentaRioCard; + + /******* ruta.lsRutaEmpresa *************/ + if (ruta.lsRutaEmpresa == null){ + ruta.lsRutaEmpresa = new ArrayList(); + } + for (RutaEmpresa re : other.lsRutaEmpresa){ + RutaEmpresa r = new RutaEmpresa(); + r.setActivo(re.getActivo()); + r.setEmpresa(re.getEmpresa()); + r.setFecmodif(re.getFecmodif()); + r.setRuta(ruta); + r.setRutaEmpresaId(null); + r.setUsuarioId(re.getUsuarioId()); + ruta.lsRutaEmpresa.add(r); + } + /*****************************************/ + + ruta.numRioCard = other.numRioCard; + ruta.numRuta = other.numRuta; + ruta.orgaoConcedente = other.orgaoConcedente; + ruta.prefixo = other.prefixo; + ruta.prefixoAuxiliar = other.prefixoAuxiliar; + + /************* ruta.rutaCombinacionList **************/ +// if (ruta.rutaCombinacionList == null){ +// ruta.rutaCombinacionList = new ArrayList(); +// } +// for (RutaCombinacion rc : other.rutaCombinacionList){ +// RutaCombinacion rcnew = RutaCombinacion.clone(rc); +// rcnew.setRuta(ruta); +// rcnew.setRutacombinacionId(null); +// ruta.rutaCombinacionList.add(rcnew); +// } + /*******************************************************/ + + ruta.rutaId = other.rutaId; + + /************ ruta.rutaSecuenciaList ************/ + if (ruta.rutaSecuenciaList == null){ + ruta.rutaSecuenciaList = new ArrayList(); + } + for (RutaSecuencia rs : other.rutaSecuenciaList){ + RutaSecuencia rsnew = RutaSecuencia.clone(rs); + rsnew.setRuta(ruta); + rsnew.setRutasecuenciaId(null); + ruta.rutaSecuenciaList.add(rsnew); + } + /************************************************/ + + ruta.usuarioId = other.usuarioId; + ruta.ventaOffLine = other.ventaOffLine; + return ruta; + } + + + public Integer numSecuenciaOrigen(Integer origenId){ + Integer numSecuencia = -1; + for (RutaSecuencia rs : rutaSecuenciaList){ + if (rs.tieneOrigen(origenId)){ + numSecuencia = rs.getNumsecuencia().intValue(); + } + } + return numSecuencia; + } + + public Integer numSecuenciaDestino(Integer destinoId){ + Integer numSecuencia = -1; + for (RutaSecuencia rs : rutaSecuenciaList){ + if (rs.tieneDestino(destinoId)){ + numSecuencia = rs.getNumsecuencia().intValue(); + } + } + return numSecuencia; + } + + public Ruta(Integer rutaId) { + this.rutaId = rutaId; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + public List getRutaSecuenciaList() { + List rsList = new ArrayList(); + for (RutaSecuencia rs : this.rutaSecuenciaList) { + if (rs.getActivo() == Boolean.TRUE) { + rsList.add(rs); + } + } + + return rsList; + } + + public void setRutaSecuenciaList(List rutaSecuenciaList) { + this.rutaSecuenciaList = rutaSecuenciaList; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public List getRutaCombinacionList() { + + List rcList = new ArrayList(); + if (this.rutaCombinacionList == null) { + return rcList; + } + for (RutaCombinacion rc : this.rutaCombinacionList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + + return rcList; + } + + public void setRutaCombinacionList(List rutaCombinacionList) { + this.rutaCombinacionList = rutaCombinacionList; + } + + public List getLsRutaEmpresa() { + List rsList = new ArrayList(); + for (RutaEmpresa rs : this.lsRutaEmpresa) { + if (rs.getActivo() == Boolean.TRUE) { + rsList.add(rs); + } + } + + return rsList; + } + + public void setLsRutaEmpresa(List lsRutaEmpresa) { + this.lsRutaEmpresa = lsRutaEmpresa; + } + + public Boolean getVentaOffLine() { + return ventaOffLine; + } + + public void setVentaOffLine(Boolean ventaOffLine) { + this.ventaOffLine = ventaOffLine; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getPrefixoAuxiliar() { + return prefixoAuxiliar; + } + + public void setPrefixoAuxiliar(String prefixoAuxiliar) { + this.prefixoAuxiliar = prefixoAuxiliar; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Boolean getIndSentidoIda() { + return indSentidoIda; + } + + public void setIndSentidoIda(Boolean indSentidoIda) { + this.indSentidoIda = indSentidoIda; + } + + public GrupoRuta getGrupoRuta() { + return grupoRuta; + } + + public void setGrupoRuta(GrupoRuta grupoRuta) { + this.grupoRuta = grupoRuta; + } + + public Boolean getIndTribTarifa() { + return indTribTarifa; + } + + public void setIndTribTarifa(Boolean indTribTarifa) { + this.indTribTarifa = indTribTarifa; + } + + public Boolean getIndTribPedagio() { + return indTribPedagio; + } + + public void setIndTribPedagio(Boolean indTribPedagio) { + this.indTribPedagio = indTribPedagio; + } + + public Boolean getIndTribTaxaEmbarque() { + return indTribTaxaEmbarque; + } + + public void setIndTribTaxaEmbarque(Boolean indTribTaxaEmbarque) { + this.indTribTaxaEmbarque = indTribTaxaEmbarque; + } + + public Boolean getIndNombreObligatorio() { + return indNombreObligatorio; + } + + public void setIndNombreObligatorio(Boolean indNombreObligatorio) { + this.indNombreObligatorio = indNombreObligatorio; + } + + public Integer getCantEixos() { + return cantEixos; + } + + public void setCantEixos(Integer cantEixos) { + this.cantEixos = cantEixos; + } + + public Integer getCantAsientos() { + return cantAsientos; + } + + public void setCantAsientos(Integer cantAsientos) { + this.cantAsientos = cantAsientos; + } + + public Boolean getIndVentaRioCard() { + return indVentaRioCard; + } + + public void setIndVentaRioCard(Boolean indVentaRioCard) { + this.indVentaRioCard = indVentaRioCard; + } + + public String getNumRioCard() { + return numRioCard; + } + + public void setNumRioCard(String numRioCard) { + this.numRioCard = numRioCard; + } + + public Boolean getIndBloqueoVtaAbierta() { + return indBloqueoVtaAbierta; + } + + public void setIndBloqueoVtaAbierta(Boolean indBloqueoVtaAbierta) { + this.indBloqueoVtaAbierta = indBloqueoVtaAbierta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getRutaId() != null ? getRutaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Ruta)) { + return false; + } + Ruta other = (Ruta) object; + if ((this.getRutaId() == null && other.getRutaId() != null) || (this.getRutaId() != null && !this.getRutaId().equals(other.getRutaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescruta() + " - " + this.getRutaId(); + } + @Override + public int compareTo(Ruta ruta) { + return this.getRutaId().intValue() - ruta.getRutaId().intValue(); + } + + public Boolean getIsClone() { + return isClone; + } + + public void setIsClone(Boolean isClone) { + this.isClone = isClone; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaCaseta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaCaseta.java new file mode 100644 index 000000000..39a1f1096 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaCaseta.java @@ -0,0 +1,85 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "RUTA_CASETA_SEQ", sequenceName = "RUTA_CASETA_SEQ", allocationSize = 1) +@Table(name = "RUTA_CASETA") +public class RutaCaseta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_CASETA_SEQ") + @Column(name = "RUTACASETA_ID") + private Integer rutaCasetaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + @JoinColumn(name = "RUTASECUENCIA_ID", referencedColumnName = "RUTASECUENCIA_ID") + @ManyToOne + private RutaSecuencia rutaSecuencia; + @JoinColumn(name = "CASETAPEAJE_ID", referencedColumnName = "CASETAPEAJE_ID") + @ManyToOne + private CasetaPeaje casetaPeaje; + public Integer getRutaCasetaId() { + return rutaCasetaId; + } + public void setRutaCasetaId(Integer rutaCasetaId) { + this.rutaCasetaId = rutaCasetaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public RutaSecuencia getRutaSecuencia() { + return rutaSecuencia; + } + public void setRutaSecuencia(RutaSecuencia rutaSecuencia) { + this.rutaSecuencia = rutaSecuencia; + } + public CasetaPeaje getCasetaPeaje() { + return casetaPeaje; + } + public void setCasetaPeaje(CasetaPeaje casetaPeaje) { + this.casetaPeaje = casetaPeaje; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaCombinacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaCombinacion.java new file mode 100644 index 000000000..78bd47ec6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaCombinacion.java @@ -0,0 +1,169 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RUTA_COMBINACION_SEQ", sequenceName = "RUTA_COMBINACION_SEQ", allocationSize=1) +@Table(name = "RUTA_COMBINACION") +public class RutaCombinacion implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_COMBINACION_SEQ") + @Column(name = "RUTACOMBINACION_ID") + private Integer rutacombinacionId; + @Column(name = "INDVENTA") + private Boolean indventa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + public RutaCombinacion() { + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + + public RutaCombinacion(Integer rutacombinacionId) { + this.rutacombinacionId = rutacombinacionId; + } + + public Integer getRutacombinacionId() { + return rutacombinacionId; + } + + public void setRutacombinacionId(Integer rutacombinacionId) { + this.rutacombinacionId = rutacombinacionId; + } + + public Boolean getIndventa() { + return indventa; + } + + public void setIndventa(Boolean indventa) { + this.indventa = indventa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public void setVentaSi(boolean a) { + this.setIndventa(Boolean.TRUE); + } + + public void setVentaNo(boolean a) { + this.setIndventa(Boolean.FALSE); + } + + public boolean isVentaSi() { + if (this.getIndventa() == Boolean.FALSE) { + return false; + } + return true; + } + + public boolean isVentaNo() { + if (this.getIndventa() == Boolean.TRUE) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (rutacombinacionId != null ? rutacombinacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RutaCombinacion)) { + return false; + } + RutaCombinacion other = (RutaCombinacion) object; + if ((this.rutacombinacionId == null && other.rutacombinacionId != null) || (this.rutacombinacionId != null && !this.rutacombinacionId.equals(other.rutacombinacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RutaCombinacion[rutacombinacionId=" + rutacombinacionId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaEmpresa.java new file mode 100644 index 000000000..a5a988c1b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaEmpresa.java @@ -0,0 +1,105 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RUTA_EMPRESA_SEQ", sequenceName = "RUTA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "RUTA_EMPRESA") +public class RutaEmpresa implements Cloneable { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_EMPRESA_SEQ") + @Column(name = "RUTAEMPRESA_ID") + private Integer rutaEmpresaId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + public Integer getRutaEmpresaId() { + return rutaEmpresaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public void setRutaEmpresaId(Integer rutaEmpresaId) { + this.rutaEmpresaId = rutaEmpresaId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return empresa.getNombempresa(); + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaSecuencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaSecuencia.java new file mode 100644 index 000000000..934dde16f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/RutaSecuencia.java @@ -0,0 +1,190 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RUTA_SECUENCIA_SEQ", sequenceName = "RUTA_SECUENCIA_SEQ", allocationSize=1) +@Table(name = "RUTA_SECUENCIA") +public class RutaSecuencia implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_SECUENCIA_SEQ") + @Column(name = "RUTASECUENCIA_ID") + private Integer rutasecuenciaId; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + @OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL) + @JoinColumn(name = "RUTASECUENCIA_ID") + private List lsRutaCase; + + public RutaSecuencia() {} + + public static RutaSecuencia clone(RutaSecuencia other){ + List rutasCaseta = new ArrayList(); + RutaSecuencia rsnew = new RutaSecuencia(); + rsnew.setActivo(other.activo); + rsnew.setFecmodif(other.fecmodif); + rsnew.setNumsecuencia(other.numsecuencia); + rsnew.setRuta(other.ruta); + rsnew.setRutasecuenciaId(other.rutasecuenciaId); + rsnew.setTramo(other.tramo); + rsnew.setUsuarioId(other.usuarioId); + + + for (RutaCaseta rc : other.getLsRutaCase()){ + RutaCaseta rutaCaseta = new RutaCaseta(); + rutaCaseta.setRutaSecuencia(rsnew); + rutaCaseta.setCasetaPeaje(rc.getCasetaPeaje()); + rutaCaseta.setActivo(Boolean.TRUE); + rutaCaseta.setFecmodif(new Date()); + rutaCaseta.setUsuarioId(other.usuarioId); + rutasCaseta.add(rutaCaseta); + } + rsnew.setLsRutaCase(rutasCaseta); + return rsnew; + } + + public boolean tieneOrigen(Integer origenId){ + return tramo.getOrigem().getParadaId().equals(origenId); + } + + public boolean tieneDestino(Integer destinoId){ + return tramo.getDestino().getParadaId().equals(destinoId); + } + + public RutaSecuencia(Integer rutasecuenciaId) { + this.rutasecuenciaId = rutasecuenciaId; + } + + public Integer getRutasecuenciaId() { + return rutasecuenciaId; + } + + public void setRutasecuenciaId(Integer rutasecuenciaId) { + this.rutasecuenciaId = rutasecuenciaId; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public List getLsRutaCase() { + return lsRutaCase; + } + + public void setLsRutaCase(List lsRutaCase) { + this.lsRutaCase = lsRutaCase; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (rutasecuenciaId != null ? rutasecuenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RutaSecuencia)) { + return false; + } + RutaSecuencia other = (RutaSecuencia) object; + if ((this.rutasecuenciaId == null && other.rutasecuenciaId != null) || (this.rutasecuenciaId != null && !this.rutasecuenciaId.equals(other.rutasecuenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RutaSecuencia[rutasecuenciaId=" + rutasecuenciaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Secretaria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Secretaria.java new file mode 100644 index 000000000..3f155fa85 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Secretaria.java @@ -0,0 +1,225 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "SECRETARIA") +@SequenceGenerator(name = "SECRETARIA_SEQ", sequenceName = "SECRETARIA_SEQ", allocationSize = 1) +public class Secretaria implements Serializable { + + public static final Short PRECIO_TOTAL = 1; + public static final Short PRECIO_MENOS_DESCUENTO = 2; + public static final Short DESCUENTO_COBRAR = 3; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SECRETARIA_SEQ") + @Column(name = "SECRETARIA_ID") + private Integer secretariaId; + @Column(name = "DESCSECRETARIA") + private String descsecretaria; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "CVESECRETARIA") + private String cvesecretaria; + @Column(name = "VALIDAFOLIO") + private Boolean validafolio; + @Column(name = "IMPRIMEPRECIO") + private Short imprimeprecio; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "SECRETARIA_ID") + private List lsCuponSecretaria; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "secretaria") + @LazyCollection(LazyCollectionOption.FALSE) + private List empresas = new ArrayList(); + + public Secretaria() { + } + + public SecretariaEmpresa addEmpresa(Empresa e) { + SecretariaEmpresa se = new SecretariaEmpresa(); + se.setEmpresa(e); + se.setSecretaria(this); + se.setActivo(Boolean.TRUE); + se.setFecmodif(Calendar.getInstance().getTime()); + se.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.empresas.add(se); + return se; + } + + public void removeEmpresa(SecretariaEmpresa e) { + this.empresas.remove(e); + } + + public void removeEmpresa(Empresa e) { + for (SecretariaEmpresa se : empresas) { + if (se.getEmpresa().equals(e)) { + this.empresas.remove(e); + break; + } + } + } + + public Secretaria(Integer secretariaId) { + this.secretariaId = secretariaId; + } + + public Integer getSecretariaId() { + return secretariaId; + } + + public void setSecretariaId(Integer secretariaId) { + this.secretariaId = secretariaId; + } + + public String getDescsecretaria() { + return descsecretaria; + } + + public void setDescsecretaria(String descsecretaria) { + this.descsecretaria = descsecretaria; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getCvesecretaria() { + return cvesecretaria; + } + + public void setCvesecretaria(String cvesecretaria) { + this.cvesecretaria = cvesecretaria; + } + + public Boolean getValidafolio() { + return validafolio; + } + + public void setValidafolio(Boolean validafolio) { + this.validafolio = validafolio; + } + + public Short getImprimeprecio() { + return imprimeprecio; + } + + public void setImprimeprecio(Short imprimeprecio) { + this.imprimeprecio = imprimeprecio; + } + + public List getLsCuponSecretaria() { + + List tmp = new ArrayList(); + if (lsCuponSecretaria != null) { + for (CuponSecretaria cp : this.lsCuponSecretaria) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + + public List getEmpresas() { + List lista = new ArrayList(); + for (SecretariaEmpresa eb : empresas) { + if (eb.getActivo()) { + lista.add(eb); + } + } + return lista; + } + + public void setEmpresas(List empresas) { + this.empresas = empresas; + } + + public void setLsCuponSecretaria(List lsCuponSecretaria) { + this.lsCuponSecretaria = lsCuponSecretaria; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (secretariaId != null ? secretariaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Secretaria)) { + return false; + } + Secretaria other = (Secretaria) object; + if ((this.secretariaId == null && other.secretariaId != null) || (this.secretariaId != null && !this.secretariaId.equals(other.secretariaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Secretaria[secretariaId=" + secretariaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SecretariaEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SecretariaEmpresa.java new file mode 100644 index 000000000..2b5e82de5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SecretariaEmpresa.java @@ -0,0 +1,108 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "SECRETARIA_EMPRESA_SEQ", sequenceName = "SECRETARIA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "SECRETARIA_EMPRESA") +public class SecretariaEmpresa { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SECRETARIA_EMPRESA_SEQ") + @Column(name = "SECRETARIAEMPRESA_ID") + private Integer secretariaempresaId; + @ManyToOne + @JoinColumn(name = "SECRETARIA_ID") + private Secretaria secretaria; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public SecretariaEmpresa(){ + this.activo = true; + } + + public Integer getSecretariaempresaId() { + return secretariaempresaId; + } + public void setSecretariaempresaId(Integer secretariaempresaId) { + this.secretariaempresaId = secretariaempresaId; + } + public Secretaria getSecretaria() { + return secretaria; + } + public void setSecretaria(Secretaria secretaria) { + this.secretaria = secretaria; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (secretariaempresaId != null ? secretariaempresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof SecretariaEmpresa)) { + return false; + } + SecretariaEmpresa other = (SecretariaEmpresa) object; + if ((this.secretariaempresaId == null && other.secretariaempresaId != null) || (this.secretariaempresaId != null && !this.secretariaempresaId.equals(other.secretariaempresaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa[secretariaempresaId=" + secretariaempresaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SegVKM.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SegVKM.java new file mode 100644 index 000000000..0abdf4bf3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SegVKM.java @@ -0,0 +1,150 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "SEGVKM_SEQ", sequenceName = "SEGVKM_SEQ", allocationSize = 1) +@Table(name = "SEGVKM") +public class SegVKM implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGVKM_SEQ") + @Column(name = "SEGVKM_ID") + private Integer segVKMId; + @Column(name = "KM") + private BigDecimal km; + @Column(name = "VALOR") + private BigDecimal valor; + @Column(name = "SERIE") + private String serie; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoConcedente; + + public SegVKM() { + } + + public SegVKM(Integer segVKMId) { + this.segVKMId = segVKMId; + } + + public Integer getSegVKMId() { + return segVKMId; + } + + public void setSegVKMId(Integer segVKMId) { + this.segVKMId = segVKMId; + } + + public BigDecimal getKm() { + return km; + } + + public void setKm(BigDecimal km) { + this.km = km; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (segVKMId != null ? segVKMId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof SegVKM)) { + return false; + } + SegVKM other = (SegVKM) object; + if ((this.segVKMId == null && other.segVKMId != null) || (this.segVKMId != null && !this.segVKMId.equals(other.segVKMId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SegVKM[ segVKMId=" + segVKMId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguradoraEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguradoraEmpresa.java new file mode 100644 index 000000000..b0b23bc84 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguradoraEmpresa.java @@ -0,0 +1,80 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "SEGURADORA_EMPRESA_SEQ", sequenceName = "SEGURADORA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "SEGURADORA_EMPRESA") +public class SeguradoraEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURADORA_EMPRESA_SEQ") + @Column(name = "SEGURADORAEMPRESA_ID ") + private Integer seguradoraEmpresaId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @Column(name = "SERIESEGURADORA") + private String serie; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getSeguradoraEmpresaId() { + return seguradoraEmpresaId; + } + public void setSeguradoraEmpresaId(Integer seguradoraEmpresaId) { + this.seguradoraEmpresaId = seguradoraEmpresaId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguroKm.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguroKm.java new file mode 100644 index 000000000..bfb6ab565 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguroKm.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "SEGURO_KM_SEQ", sequenceName = "SEGURO_KM_SEQ", allocationSize = 1) +@Table(name = "SEGURO_KM") +public class SeguroKm implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURO_KM_SEQ") + @Column(name = "SEGUROKM_ID") + private Integer segurokmId; + @Column(name = "KMATE") + private Integer kmate; + @Column(name = "VALORTAXA") + private BigDecimal valortaxa; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedente; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public SeguroKm() { + } + + public SeguroKm(Integer segurokmId) { + this.segurokmId = segurokmId; + } + + public Integer getSegurokmId() { + return segurokmId; + } + + public void setSegurokmId(Integer segurokmId) { + this.segurokmId = segurokmId; + } + + public Integer getKmate() { + return kmate; + } + + public void setKmate(Integer kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (segurokmId != null ? segurokmId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof SeguroKm)) { + return false; + } + SeguroKm other = (SeguroKm) object; + if ((this.segurokmId == null && other.segurokmId != null) || (this.segurokmId != null && !this.segurokmId.equals(other.segurokmId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SeguroKm[ segurokmId=" + segurokmId + " ]"; + } + + public OrgaoConcedente getOrgaoconcedente() { + return orgaoconcedente; + } + + public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) { + this.orgaoconcedente = orgaoconcedente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguroTarifa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguroTarifa.java new file mode 100644 index 000000000..1387c5859 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/SeguroTarifa.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "SEGURO_TARIFA_SEQ", sequenceName = "SEGURO_TARIFA_SEQ", allocationSize = 1) +@Table(name = "SEGURO_TARIFA") +public class SeguroTarifa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURO_TARIFA_SEQ") + @Column(name = "SEGUROTARIFA_ID") + private Integer segurotarifaId; + @Column(name = "VALORTAXA") + private BigDecimal valortarifa; + @Column(name = "VALORTARIFAATE") + private BigDecimal valortarifaate; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedente; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public SeguroTarifa() { + } + + public SeguroTarifa(Integer segurotarifaId) { + this.segurotarifaId = segurotarifaId; + } + + public Integer getSegurotarifaId() { + return segurotarifaId; + } + + public void setSegurotarifaId(Integer segurotarifaId) { + this.segurotarifaId = segurotarifaId; + } + + public BigDecimal getValortarifa() { + return valortarifa; + } + + public void setValortarifa(BigDecimal valortarifa) { + this.valortarifa = valortarifa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (segurotarifaId != null ? segurotarifaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof SeguroTarifa)) { + return false; + } + SeguroTarifa other = (SeguroTarifa) object; + if ((this.segurotarifaId == null && other.segurotarifaId != null) || (this.segurotarifaId != null && !this.segurotarifaId.equals(other.segurotarifaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SeguroTarifa[ segurotarifaId=" + segurotarifaId + " ]"; + } + + public BigDecimal getValortarifaate() { + return valortarifaate; + } + + public void setValortarifaate(BigDecimal valortarifaate) { + this.valortarifaate = valortarifaate; + } + + public OrgaoConcedente getOrgaoconcedente() { + return orgaoconcedente; + } + + public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) { + this.orgaoconcedente = orgaoconcedente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Sistema.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Sistema.java new file mode 100644 index 000000000..0a98752ea --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Sistema.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "SISTEMA") +@SequenceGenerator(name = "SISTEMA_SEQ", sequenceName = "SISTEMA_SEQ", allocationSize = 1) +public class Sistema implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SISTEMA_SEQ") + @Column(name = "SISTEMA_ID") + private Integer sistemaId; + @Column(name = "NOMBSISTEMA") + private String nombsistema; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "sistema") + private List funcionSistemaList; + + public Sistema() { + } + + public Sistema(Integer sistemaId) { + this.sistemaId = sistemaId; + } + + public Integer getSistemaId() { + return sistemaId; + } + + public void setSistemaId(Integer sistemaId) { + this.sistemaId = sistemaId; + } + + public String getNombsistema() { + return nombsistema; + } + + public void setNombsistema(String nombsistema) { + this.nombsistema = nombsistema; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getFuncionSistemaList() { + return funcionSistemaList; + } + + public void setFuncionSistemaList(List funcionSistemaList) { + this.funcionSistemaList = funcionSistemaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (sistemaId != null ? sistemaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Sistema)) { + return false; + } + Sistema other = (Sistema) object; + if ((this.sistemaId == null && other.sistemaId != null) || (this.sistemaId != null && !this.sistemaId.equals(other.sistemaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombsistema(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java new file mode 100644 index 000000000..396ac5b56 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java @@ -0,0 +1,336 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "TARIFA_SEQ", sequenceName = "TARIFA_SEQ", allocationSize = 1) +@Table(name = "TARIFA") +public class Tarifa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_SEQ") + @Column(name = "TARIFA_ID") + private Integer tarifaId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "IMPORTETAXAEMBARQUE") + private BigDecimal importetaxaembarque; + @Column(name = "IMPORTEPEDAGIO") + private BigDecimal importepedagio; + @Column(name = "IMPORTEOUTROS") + private BigDecimal importeoutros; + @Column(name = "IMPORTESEGURO") + private BigDecimal importeseguro; + @Column(name = "PRECIOORIGINAL") + private BigDecimal preciooriginal; + @Column(name = "STATUSTARIFA") + private String statustarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "MONEDA_ID") + private Moneda moneda; + @OneToOne + @JoinColumn(name = "VIGENCIATARIFA_ID") + private VigenciaTarifa vigenciaTarifa; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + private List lsTarifaTipoptovta; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + private List lsTarifaCategoria; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + public Tarifa() { + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Tarifa(Integer tarifaId) { + this.tarifaId = tarifaId; + } + + public Integer getTarifaId() { + return tarifaId; + } + + public void setTarifaId(Integer tarifaId) { + this.tarifaId = tarifaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public List getLsTarifaCategoria() { + List tmp = new ArrayList(); + if (lsTarifaCategoria != null) { + for (TarifaCategoria ddab : this.lsTarifaCategoria) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.lsTarifaCategoria = tmp; + + return tmp; + } + + public void setLsTarifaCategoria(List lsTarifaCategoria) { + this.lsTarifaCategoria = lsTarifaCategoria; + } + + public List getLsTarifaTipoptovta() { + List tmp = new ArrayList(); + if (lsTarifaTipoptovta != null) { + for (TarifaTipoptovta ddab : this.lsTarifaTipoptovta) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.lsTarifaTipoptovta = tmp; + + return tmp; + } + + public void setLsTarifaTipoptovta(List lsTarifaTipoptovta) { + this.lsTarifaTipoptovta = lsTarifaTipoptovta; + } + + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaId != null ? tarifaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Tarifa)) { + return false; + } + Tarifa other = (Tarifa) object; + if ((this.tarifaId == null && other.tarifaId != null) || (this.tarifaId != null && !this.tarifaId.equals(other.tarifaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Tarifa[tarifaId=" + tarifaId + "]"; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaCategoria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaCategoria.java new file mode 100644 index 000000000..9164e26b5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaCategoria.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "TARIFA_CATEGORIA") +@SequenceGenerator(name = "TARIFA_CATEGORIA_SEQ", sequenceName = "TARIFA_CATEGORIA_SEQ", allocationSize = 1) +public class TarifaCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_CATEGORIA_SEQ") + @Column(name = "TARIFACATEGORIA_ID") + private Integer tarifacategoriaId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + @ManyToOne(fetch=FetchType.LAZY) + private Tarifa tarifa; + + public TarifaCategoria() { + } + + public TarifaCategoria(Integer tarifacategoriaId) { + this.tarifacategoriaId = tarifacategoriaId; + } + + public Integer getTarifacategoriaId() { + return tarifacategoriaId; + } + + public void setTarifacategoriaId(Integer tarifacategoriaId) { + this.tarifacategoriaId = tarifacategoriaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + + public Tarifa getTarifa() { + return tarifa; + } + + public void setTarifa(Tarifa tarifa) { + this.tarifa = tarifa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifacategoriaId != null ? tarifacategoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaCategoria)) { + return false; + } + TarifaCategoria other = (TarifaCategoria) object; + if ((this.tarifacategoriaId == null && other.tarifacategoriaId != null) || (this.tarifacategoriaId != null && !this.tarifacategoriaId.equals(other.tarifacategoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaCategoria[tarifacategoriaId=" + tarifacategoriaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaHist.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaHist.java new file mode 100644 index 000000000..237d5c101 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaHist.java @@ -0,0 +1,183 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "TARIFA_HIST_SEQ", sequenceName = "TARIFA_HIST_SEQ", allocationSize=1) +@Table(name = "TARIFA_HIST") +public class TarifaHist implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_HIST_SEQ") + @Column(name = "TARIFAHIST_ID") + private Long tarifahistId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOORIGINAL") + private BigDecimal preciooriginal; + @Column(name = "STATUSTARIFA") + private String statustarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "VIGENCIATARIFA_ID", referencedColumnName = "VIGENCIATARIFA_ID") + @ManyToOne + private VigenciaTarifa vigenciaTarifa; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public TarifaHist() { + } + + public TarifaHist(Long tarifahistId) { + this.tarifahistId = tarifahistId; + } + + public Long getTarifahistId() { + return tarifahistId; + } + + public void setTarifahistId(Long tarifahistId) { + this.tarifahistId = tarifahistId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifahistId != null ? tarifahistId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaHist)) { + return false; + } + TarifaHist other = (TarifaHist) object; + if ((this.tarifahistId == null && other.tarifahistId != null) || (this.tarifahistId != null && !this.tarifahistId.equals(other.tarifahistId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaHist[tarifahistId=" + tarifahistId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaKm.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaKm.java new file mode 100644 index 000000000..3ae5b3232 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaKm.java @@ -0,0 +1,157 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** +* +* @author daniel.zauli +*/ +@Entity +@SequenceGenerator(name = "TARIFA_KM_SEQ", sequenceName = "TARIFA_KM_SEQ", allocationSize = 1) +@Table(name = "TARIFA_KM") +public class TarifaKm implements Serializable, Comparable{ + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_KM_SEQ") + @Column(name = "TARIFAKM_ID") + private Integer tarifakmId; + + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedenteId; + + @Column(name = "KMATE") + private BigDecimal kmate; + + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "VALORTAXA") // tarifa + private BigDecimal valortaxa; + + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TarifaKm(){} + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifakmId != null ? tarifakmId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaKm)) { + return false; + } + TarifaKm other = (TarifaKm) object; + if ((this.tarifakmId == null && other.tarifakmId != null) || (this.tarifakmId != null && !this.tarifakmId.equals(other.tarifakmId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaKm[ tarifakmId=" + tarifakmId + " ]"; + } + + public Integer getTarifakmId() { + return tarifakmId; + } + + public void setTarifakmId(Integer tarifakmId) { + this.tarifakmId = tarifakmId; + } + + public OrgaoConcedente getOrgaoconcedenteId() { + return orgaoconcedenteId; + } + + public void setOrgaoconcedenteId(OrgaoConcedente orgaoconcedenteId) { + this.orgaoconcedenteId = orgaoconcedenteId; + } + + public BigDecimal getKmate() { + return kmate; + } + + public void setKmate(BigDecimal kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int compareTo(TarifaKm tkm) { + return this.getKmate().intValue() - tkm.getKmate().intValue(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaMinima.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaMinima.java new file mode 100644 index 000000000..b63fb525e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaMinima.java @@ -0,0 +1,213 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Where; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "TARIFA_MINIMA_SEQ", sequenceName = "TARIFA_MINIMA_SEQ", allocationSize = 1) +@Table(name = "TARIFA_MINIMA") +public class TarifaMinima implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_MINIMA_SEQ") + @Column(name = "TARIFAMINIMA_ID") + private Integer tarifaminimaId; + @Column(name = "IMPORTETARIFA") + private BigDecimal importetarifa; + @OneToOne + @JoinColumn(name = "PLAZA_ID") + private Plaza plaza; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @OneToOne + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + private Moneda moneda; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @OneToMany(mappedBy = "tarifaMinima") + @Where(clause = "ACTIVO = 1") + private List tarifaMinimaCategorias; + + public TarifaMinima() { + } + + public TarifaMinima(Integer tarifaminimaId) { + this.tarifaminimaId = tarifaminimaId; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Integer getTarifaminimaId() { + return tarifaminimaId; + } + + public void setTarifaminimaId(Integer tarifaminimaId) { + this.tarifaminimaId = tarifaminimaId; + } + + public BigDecimal getImportetarifa() { + return importetarifa; + } + + public void setImportetarifa(BigDecimal importetarifa) { + this.importetarifa = importetarifa; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Plaza getPlaza() { + return plaza; + } + + public void setPlaza(Plaza plaza) { + this.plaza = plaza; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaminimaId != null ? tarifaminimaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaMinima)) { + return false; + } + TarifaMinima other = (TarifaMinima) object; + if ((this.tarifaminimaId == null && other.tarifaminimaId != null) || (this.tarifaminimaId != null && !this.tarifaminimaId.equals(other.tarifaminimaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaMinima[tarifaminimaId=" + tarifaminimaId + "]"; + } + + public java.util.List getTarifaMinimaCategorias() { + return tarifaMinimaCategorias; + } + + public void setTarifaMinimaCategorias(java.util.List tarifaMinimaCategorias) { + this.tarifaMinimaCategorias = tarifaMinimaCategorias; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaMinimaCategoria.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaMinimaCategoria.java new file mode 100644 index 000000000..12f597e99 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaMinimaCategoria.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TARIFA_MINIMA_CATEGORIA_SEQ", sequenceName = "TARIFA_MINIMA_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "TARIFA_MINIMA_CATEGORIA") +public class TarifaMinimaCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TARIFAMINIMACATEGORIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_MINIMA_CATEGORIA_SEQ") + private Long tarifaminimacategoriaId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TARIFAMINIMA_ID") + private TarifaMinima tarifaMinima; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getTarifaminimacategoriaId() { + return tarifaminimacategoriaId; + } + + public void setTarifaminimacategoriaId(Long tarifaminimacategoriaId) { + this.tarifaminimacategoriaId = tarifaminimacategoriaId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public TarifaMinima getTarifaMinima() { + return tarifaMinima; + } + + public void setTarifaMinima(TarifaMinima tarifaMinima) { + this.tarifaMinima = tarifaMinima; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tarifaminimacategoriaId == null) ? 0 : tarifaminimacategoriaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + TarifaMinimaCategoria other = (TarifaMinimaCategoria) obj; + if (tarifaminimacategoriaId == null) { + if (other.tarifaminimacategoriaId != null) + return false; + } else if (!tarifaminimacategoriaId.equals(other.tarifaminimacategoriaId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java new file mode 100644 index 000000000..8ea9b41fa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java @@ -0,0 +1,276 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TARIFA_OFICIAL_SEQ", sequenceName = "TARIFA_OFICIAL_SEQ", allocationSize = 1) +@Table(name = "TARIFA_OFICIAL") +public class TarifaOficial implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_OFICIAL_SEQ") + @Column(name = "TARIFAOFICIAL_ID") + private Integer tarifaOficialId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOORIGINAL") + private BigDecimal preciooriginal; + @Column(name = "IMPORTETAXAEMBARQUE") + private BigDecimal importetaxaembarque; + @Column(name = "IMPORTEPEDAGIO") + private BigDecimal importepedagio; + @Column(name = "IMPORTEOUTROS") + private BigDecimal importeoutros; + @Column(name = "IMPORTESEGURO") + private BigDecimal importeseguro; + @Column(name = "STATUSTARIFA") + private String statustarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "MONEDA_ID") + private Moneda moneda; + @OneToOne + @JoinColumn(name = "VIGENCIATARIFA_ID") + private VigenciaTarifa vigenciaTarifa; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + public TarifaOficial() { + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Integer getTarifaOficialId() { + return tarifaOficialId; + } + + public void setTarifaOficialId(Integer tarifaOficialId) { + this.tarifaOficialId = tarifaOficialId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaOficialId != null ? tarifaOficialId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TarifaOficial)) { + return false; + } + TarifaOficial other = (TarifaOficial) object; + if ((this.tarifaOficialId == null && other.tarifaOficialId != null) || (this.tarifaOficialId != null && !this.tarifaOficialId.equals(other.tarifaOficialId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaOficial[tarifaOficialId=" + tarifaOficialId + "]"; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaTipoptovta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaTipoptovta.java new file mode 100644 index 000000000..b3fda13aa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaTipoptovta.java @@ -0,0 +1,156 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "TARIFA_TIPOPTOVTA") +@SequenceGenerator(name = "TARIFA_TIPOPTOVTA_SEQ", sequenceName = "TARIFA_TIPOPTOVTA_SEQ", allocationSize = 1) +public class TarifaTipoptovta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_TIPOPTOVTA_SEQ") + @Column(name = "TARIFATIPOPTOVTA_ID") + private Integer tarifatipoptovtaId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "TIPOPTOVTA_ID") + private TipoPuntoVenta tipoPuntoVenta; + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + @ManyToOne(fetch=FetchType.LAZY) + private Tarifa tarifa; + + public TarifaTipoptovta() { + } + + public TarifaTipoptovta(Integer tarifatipoptovtaId) { + this.tarifatipoptovtaId = tarifatipoptovtaId; + } + + public Integer getTarifatipoptovtaId() { + return tarifatipoptovtaId; + } + + public void setTarifatipoptovtaId(Integer tarifatipoptovtaId) { + this.tarifatipoptovtaId = tarifatipoptovtaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + + + public Tarifa getTarifa() { + return tarifa; + } + + public void setTarifa(Tarifa tarifa) { + this.tarifa = tarifa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifatipoptovtaId != null ? tarifatipoptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaTipoptovta)) { + return false; + } + TarifaTipoptovta other = (TarifaTipoptovta) object; + if ((this.tarifatipoptovtaId == null && other.tarifatipoptovtaId != null) || (this.tarifatipoptovtaId != null && !this.tarifatipoptovtaId.equals(other.tarifatipoptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta[tarifatipoptovtaId=" + tarifatipoptovtaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaVendaPacote.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaVendaPacote.java new file mode 100644 index 000000000..eeccc1903 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarifaVendaPacote.java @@ -0,0 +1,145 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "TARIFA_VENDA_PACOTE_SEQ", sequenceName = "TARIFA_VENDA_PACOTE_SEQ", allocationSize = 1) +@Table(name = "TARIFA_VENDA_PACOTE") +public class TarifaVendaPacote implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TARIFAVENDAPACOTE_ID") + private Long tarifavendapacoteId; + + @Column(name = "VALOR") + private BigDecimal valor; + + @ManyToOne + @JoinColumn(name = "VENDAPACOTE_ID") + private VendaPacote vendaPacote; + + @ManyToOne + @JoinColumn(name = "PACOTETARIFA_ID") + private PacoteTarifa pacoteTarifa; + + @Column(name = "NOMEPASSAGEIRO") + private String nomepassageiro; + + @Column(name = "DOCUMENTO") + private String documento; + + @Column(name = "TIPODOC") + private String tipodoc; + + @Column(name = "IDIOMA") + private String idioma; + + @Column(name = "DESCEMAIL") + private String descemail; + + @Column(name = "DESCTELEFONE") + private String desctelefone; + + @Column(name = "NOMCONVENIO") + private String nomconvenio; + + public Long getTarifavendapacoteId() { + return tarifavendapacoteId; + } + + public void setTarifavendapacoteId(Long tarifavendapacoteId) { + this.tarifavendapacoteId = tarifavendapacoteId; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public VendaPacote getVendaPacote() { + return vendaPacote; + } + + public void setVendaPacote(VendaPacote vendaPacote) { + this.vendaPacote = vendaPacote; + } + + public PacoteTarifa getPacoteTarifa() { + return pacoteTarifa; + } + + public void setPacoteTarifa(PacoteTarifa pacoteTarifa) { + this.pacoteTarifa = pacoteTarifa; + } + + public String getNomepassageiro() { + return nomepassageiro; + } + + public void setNomepassageiro(String nomepassageiro) { + this.nomepassageiro = nomepassageiro; + } + + public String getDocumento() { + return documento; + } + + public void setDocumento(String documento) { + this.documento = documento; + } + + public String getTipodoc() { + return tipodoc; + } + + public void setTipodoc(String tipodoc) { + this.tipodoc = tipodoc; + } + + public String getIdioma() { + return idioma; + } + + public void setIdioma(String idioma) { + this.idioma = idioma; + } + + public String getDescemail() { + return descemail; + } + + public void setDescemail(String descemail) { + this.descemail = descemail; + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + public String getNomconvenio() { + return nomconvenio; + } + + public void setNomconvenio(String nomconvenio) { + this.nomconvenio = nomconvenio; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaCredito.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaCredito.java new file mode 100644 index 000000000..a646a4121 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaCredito.java @@ -0,0 +1,133 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TARJETA_CREDITO_SEQ", sequenceName = "TARJETA_CREDITO_SEQ", allocationSize = 1) +@Table(name = "TARJETA_CREDITO") +public class TarjetaCredito implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARJETA_CREDITO_SEQ") + @Column(name = "TARJETACREDITO_ID") + private Integer tarjetaCreditoId; + @Column(name = "DESCTARJETACREDITO") + private String descTarjetaCredito; + @Column(name = "CANTMAXSINTASA") + private Integer cantMaxSinTasa; + @Column(name = "CANMAXCONTASA") + private Integer canMaxConTasa; + @Column(name = "TASA") + private BigDecimal tasa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getTarjetaCreditoId() { + return tarjetaCreditoId; + } + + public void setTarjetaCreditoId(Integer tarjetaCreditoId) { + this.tarjetaCreditoId = tarjetaCreditoId; + } + + public String getDescTarjetaCredito() { + return descTarjetaCredito; + } + + public void setDescTarjetaCredito(String descTarjetaCredito) { + this.descTarjetaCredito = descTarjetaCredito; + } + + public Integer getCantMaxSinTasa() { + return cantMaxSinTasa; + } + + public void setCantMaxSinTasa(Integer cantMaxSinTasa) { + this.cantMaxSinTasa = cantMaxSinTasa; + } + + public Integer getCanMaxConTasa() { + return canMaxConTasa; + } + + public void setCanMaxConTasa(Integer canMaxConTasa) { + this.canMaxConTasa = canMaxConTasa; + } + + public BigDecimal getTasa() { + return tasa; + } + + public void setTasa(BigDecimal tasa) { + this.tasa = tasa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tarjetaCreditoId == null) ? 0 : tarjetaCreditoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TarjetaCredito other = (TarjetaCredito) obj; + if (tarjetaCreditoId == null) { + if (other.tarjetaCreditoId != null) + return false; + } else if (!tarjetaCreditoId.equals(other.tarjetaCreditoId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidad.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidad.java new file mode 100644 index 000000000..fcb09c1c7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidad.java @@ -0,0 +1,119 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "TARJETA_FIDELIDAD_SEQ", sequenceName = "TARJETA_FIDELIDAD_SEQ", allocationSize = 1) +@Table(name = "TARJETA_FIDELIDAD") +public class TarjetaFidelidad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARJETA_FIDELIDAD_SEQ") + @Column(name = "TARJETAFIDELIDAD_ID") + private Integer tarjetaFidelidadId; + @Column(name = "NUMTARJETA") + private Long numTarjeta; + @Column(name = "DESCGENERACION") + private String descGeneracion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getDescGeneracion() { + return descGeneracion; + } + + public void setDescGeneracion(String descGeneracion) { + this.descGeneracion = descGeneracion; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Long getNumTarjeta() { + return numTarjeta; + } + + public void setNumTarjeta(Long numTarjeta) { + this.numTarjeta = numTarjeta; + } + + public Integer getTarjetaFidelidadId() { + return tarjetaFidelidadId; + } + + public void setTarjetaFidelidadId(Integer tarjetaFidelidadId) { + this.tarjetaFidelidadId = tarjetaFidelidadId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetaFidelidadId != null ? tarjetaFidelidadId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TarjetaFidelidad)) { + return false; + } + TarjetaFidelidad other = (TarjetaFidelidad) object; + if ((this.tarjetaFidelidadId == null && other.tarjetaFidelidadId != null) || (this.tarjetaFidelidadId != null && !this.tarjetaFidelidadId.equals(other.tarjetaFidelidadId))) { + return false; + } + return true; + } + + @Override + public String toString() { + // return "com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad[tarjetaFidelidadId=" + tarjetaFidelidadId + "]"; + return this.getDescGeneracion(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidadCuenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidadCuenta.java new file mode 100644 index 000000000..bcf410bc2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidadCuenta.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +/** + * + * @author Shiro + */ +public class TarjetaFidelidadCuenta { + + private String descGeneracion; + private Integer cantidad; + + public TarjetaFidelidadCuenta(){ + } + public Integer getCantidad() { + return cantidad; + } + + public void setCantidad(Integer cantidad) { + this.cantidad = cantidad; + } + + public String getDescGeneracion() { + return descGeneracion; + } + + public void setDescGeneracion(String descGeneracion) { + this.descGeneracion = descGeneracion; + } + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad[tarjetaFidelidadId=" + tarjetaFidelidadId + "]"; + return this.getDescGeneracion(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacion.java new file mode 100644 index 000000000..0b7033c07 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacion.java @@ -0,0 +1,222 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "TARJETAS_RECAUDACION") +public class TarjetaRecaudacion implements Serializable { + + private static final long serialVersionUID = 1L; + @EmbeddedId + protected TarjetaRecaudacionPK tarjetasRecaudacionPK; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "INGRESO_CORRIDA") + private Double ingresoCorrida; + @Column(name = "PAGADO") + private Boolean pagado; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "AUTOBUS_ID") + private Autobus autobus; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @Column(name = "ACTUALIZAR") + private Boolean actualizar; + @Column(name = "OBSERVACIONES") + private String observaciones; + @Column(name = "CONDUCTOR_ID") + private Integer conductorId; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @Column(name = "ACTIVO") + private Boolean activo; + @OneToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA", referencedColumnName = "FECCORRIDA") + }) + private Corrida corrida; + + public TarjetaRecaudacion() { + } + + public TarjetaRecaudacion(TarjetaRecaudacionPK tarjetasRecaudacionPK) { + this.tarjetasRecaudacionPK = tarjetasRecaudacionPK; + } + + public TarjetaRecaudacion(Integer tarjetarecaudacionId, Boolean manual) { + this.tarjetasRecaudacionPK = new TarjetaRecaudacionPK(tarjetarecaudacionId, manual); + } + + public TarjetaRecaudacionPK getTarjetasRecaudacionPK() { + return tarjetasRecaudacionPK; + } + + public void setTarjetasRecaudacionPK(TarjetaRecaudacionPK tarjetasRecaudacionPK) { + this.tarjetasRecaudacionPK = tarjetasRecaudacionPK; + } + + public Double getIngresoCorrida() { + return ingresoCorrida; + } + + public void setIngresoCorrida(Double ingresoCorrida) { + this.ingresoCorrida = ingresoCorrida; + } + + public Boolean getPagado() { + return pagado; + } + + public void setPagado(Boolean pagado) { + this.pagado = pagado; + } + + public Boolean getActualizar() { + return actualizar; + } + + public void setActualizar(Boolean actualizar) { + this.actualizar = actualizar; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public Integer getConductorId() { + return conductorId; + } + + public void setConductorId(Integer conductorId) { + this.conductorId = conductorId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetasRecaudacionPK != null ? tarjetasRecaudacionPK.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarjetaRecaudacion)) { + return false; + } + TarjetaRecaudacion other = (TarjetaRecaudacion) object; + if ((this.tarjetasRecaudacionPK == null && other.tarjetasRecaudacionPK != null) || (this.tarjetasRecaudacionPK != null && !this.tarjetasRecaudacionPK.equals(other.tarjetasRecaudacionPK))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarjetasRecaudacion[ tarjetasRecaudacionPK=" + tarjetasRecaudacionPK + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacionPK.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacionPK.java new file mode 100644 index 000000000..a64771941 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacionPK.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Embeddable; + +/** + * + * @author Administrador + */ +@Embeddable +public class TarjetaRecaudacionPK implements Serializable { + + private static final long serialVersionUID = 1L; + @Basic(optional = false) + @Column(name = "TARJETARECAUDACION_ID") + private Integer tarjetarecaudacionId; + @Basic(optional = false) + @Column(name = "MANUAL") + private Boolean manual; + + public TarjetaRecaudacionPK() { + } + + public TarjetaRecaudacionPK(Integer tarjetarecaudacionId, Boolean manual) { + this.tarjetarecaudacionId = tarjetarecaudacionId; + this.manual = manual; + } + + public Integer getTarjetarecaudacionId() { + return tarjetarecaudacionId; + } + + public void setTarjetarecaudacionId(Integer tarjetarecaudacionId) { + this.tarjetarecaudacionId = tarjetarecaudacionId; + } + + public Boolean getManual() { + return manual; + } + + public void setManual(Boolean manual) { + this.manual = manual; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetarecaudacionId != null ? tarjetarecaudacionId.hashCode() : 0); + hash += (manual != null ? manual.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof TarjetaRecaudacionPK)) { + return false; + } + TarjetaRecaudacionPK other = (TarjetaRecaudacionPK) object; + if ((this.tarjetarecaudacionId == null && other.tarjetarecaudacionId != null) || (this.tarjetarecaudacionId != null && !this.tarjetarecaudacionId.equals(other.tarjetarecaudacionId))) { + return false; + } + if ((this.manual == null && other.manual != null) || (this.manual != null && !this.manual.equals(other.manual))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarjetasRecaudacionPK[ tarjetarecaudacionId=" + tarjetarecaudacionId + ", manual=" + manual + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaViaje.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaViaje.java new file mode 100644 index 000000000..7c7c99c98 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TarjetaViaje.java @@ -0,0 +1,324 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author cassio + */ +@Entity +@Table(name = "TARJETA_VIAJE") +@NamedQueries({ + @NamedQuery(name = "TarjetaViaje.findAll", query = "SELECT t FROM TarjetaViaje t")}) +public class TarjetaViaje implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "TARJETAVIAJE_ID", nullable = false) + private Integer tarjetaviajeId; + @Column(name = "NUMSECUENCIA") + private Integer numsecuencia; + @Column(name = "INDREBOTE") + private Integer indRebote; + @Column(name = "INDSTATUSTARJETA", length = 20) + private String indstatustarjeta; + @Column(name = "FOLIOTARJETAVIAJE", length = 10) + private String foliotarjetaviaje; + @Column(name = "FECENVIONOMINA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecenvionomina; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CONDUCTOR1_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor; + @JoinColumn(name = "CONDUCTOR2_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor1; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + @ManyToOne + private Autobus autobus; + private transient boolean eCorridaDuplicada; + @Column(name = "CANTKMREAL") + private BigDecimal kmReal; + @Column(name = "CANTKMPAGOCONDUCTOR") + private BigDecimal kmPagoConductor; + @Column(name = "TARJETAVIAJEREF_ID") + private BigDecimal tarjetaViajeRef; + @Column(name = "DESCPARADAORIGEN") + private String origen; + @Column(name = "DESCPARADADESTINO") + private String destino; + @Column(name = "FECCORRIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecInicial; + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecHorSalida; + @Column(name = "NUMCORRIDA") + private Integer numCorrida; + + public Integer getNumAutobusAux() { + return Integer.parseInt(this.autobus.getNumautobus()); + } + + public Integer getNumCorrida() { + return numCorrida; + } + + public void setNumCorrida(Integer numCorrida) { + this.numCorrida = numCorrida; + } + + public Integer getIndRebote() { + return indRebote; + } + + public void setIndRebote(Integer indRebote) { + this.indRebote = indRebote; + } + + public String getOrigen() { + return origen; + } + + public void setOrigen(String origen) { + this.origen = origen; + } + + public String getDestino() { + return destino; + } + + public void setDestino(String destino) { + this.destino = destino; + } + + public Date getFecInicial() { + return fecInicial; + } + + public void setFecInicial(Date fecInicial) { + this.fecInicial = fecInicial; + } + + public BigDecimal getTarjetaViajeRef() { + return tarjetaViajeRef; + } + + public void setTarjetaViajeRef(BigDecimal tarjetaViajeRef) { + this.tarjetaViajeRef = tarjetaViajeRef; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public BigDecimal getKmPagoConductor() { + return kmPagoConductor; + } + + public void setKmPagoConductor(BigDecimal kmPagoConductor) { + this.kmPagoConductor = kmPagoConductor; + } + + public boolean geteCorridaDuplicada() { + return eCorridaDuplicada; + } + + public void seteCorridaDuplicada(boolean eCorridaDuplicada) { + this.eCorridaDuplicada = eCorridaDuplicada; + } + + public TarjetaViaje() { + } + + public TarjetaViaje(Integer tarjetaviajeId) { + this.tarjetaviajeId = tarjetaviajeId; + } + + public Integer getTarjetaviajeId() { + return tarjetaviajeId; + } + + public void setTarjetaviajeId(Integer tarjetaviajeId) { + this.tarjetaviajeId = tarjetaviajeId; + } + + public Integer getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Integer numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public String getIndstatustarjeta() { + return indstatustarjeta; + } + + public void setIndstatustarjeta(String indstatustarjeta) { + this.indstatustarjeta = indstatustarjeta; + } + + public String getFoliotarjetaviaje() { + return foliotarjetaviaje; + } + + public void setFoliotarjetaviaje(String foliotarjetaviaje) { + this.foliotarjetaviaje = foliotarjetaviaje; + } + + public Date getFecenvionomina() { + return fecenvionomina; + } + + public void setFecenvionomina(Date fecenvionomina) { + this.fecenvionomina = fecenvionomina; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Conductor getConductor() { + return conductor; + } + + public void setConductor(Conductor conductor) { + this.conductor = conductor; + } + + public Conductor getConductor1() { + return conductor1; + } + + public void setConductor1(Conductor conductor1) { + this.conductor1 = conductor1; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public Date getFecHorSalida() { + return fecHorSalida; + } + + public void setFecHorSalida(Date fecHorSalida) { + this.fecHorSalida = fecHorSalida; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetaviajeId != null ? tarjetaviajeId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarjetaViaje)) { + return false; + } + TarjetaViaje other = (TarjetaViaje) object; + if ((this.tarjetaviajeId == null && other.tarjetaviajeId != null) || (this.tarjetaviajeId != null && !this.tarjetaviajeId.equals(other.tarjetaviajeId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidadeteste.TarjetaViaje[tarjetaviajeId=" + tarjetaviajeId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevante.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevante.java new file mode 100644 index 000000000..aeff09b50 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevante.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TAXA_EMB_LEVANTE_SEQ", sequenceName = "TAXA_EMB_LEVANTE_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMB_LEVANTE") +public class TaxaEmbLevante implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMB_LEVANTE_SEQ") + @Column(name = "TAXAEMBLEVANTE_ID") + private Integer taxaEmbLevanteId; + @JoinColumn(name = "TAXAEMBLEVANTECTRL_ID", referencedColumnName = "TAXAEMBLEVANTECTRL_ID") + @ManyToOne + private TaxaEmbLevanteCtrl taxaEmbLevanteCtrl; + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TaxaEmbLevante() { + } + + public TaxaEmbLevante(Integer taxaEmbLevanteId) { + this.taxaEmbLevanteId = taxaEmbLevanteId; + } + + public TaxaEmbLevante(Integer taxaEmbLevanteId, BigDecimal importe, Boolean activo, Date fecmodif, Integer usuarioId) { + this.taxaEmbLevanteId = taxaEmbLevanteId; + this.importe = importe; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getTaxaEmbLevanteId() { + return taxaEmbLevanteId; + } + + public void setTaxaEmbLevanteId(Integer taxaEmbLevanteId) { + this.taxaEmbLevanteId = taxaEmbLevanteId; + } + + public TaxaEmbLevanteCtrl getTaxaEmbLevanteCtrl() { + return taxaEmbLevanteCtrl; + } + + public void setTaxaEmbLevanteCtrl(TaxaEmbLevanteCtrl taxaEmbLevanteCtrl) { + this.taxaEmbLevanteCtrl = taxaEmbLevanteCtrl; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaEmbLevanteId != null ? taxaEmbLevanteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TaxaEmbLevante)) { + return false; + } + TaxaEmbLevante other = (TaxaEmbLevante) object; + if ((this.taxaEmbLevanteId == null && other.taxaEmbLevanteId != null) || (this.taxaEmbLevanteId != null && !this.taxaEmbLevanteId.equals(other.taxaEmbLevanteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbLevante[taxaEmbLevanteId=" + taxaEmbLevanteId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevanteCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevanteCtrl.java new file mode 100644 index 000000000..e7d095f6a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevanteCtrl.java @@ -0,0 +1,157 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TAXA_EMB_LEVANTE_CTRL_SEQ", sequenceName = "TAXA_EMB_LEVANTE_CTRL_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMB_LEVANTE_CTRL") +public class TaxaEmbLevanteCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMB_LEVANTE_CTRL_SEQ") + @Column(name = "TAXAEMBLEVANTECTRL_ID") + private Integer taxaEmbLevanteCtrlId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "taxaEmbLevanteCtrl", cascade = CascadeType.ALL) + private List taxaEmbLevanteList; + + public TaxaEmbLevanteCtrl() { + } + + public TaxaEmbLevanteCtrl(Integer taxaEmbLevanteCtrlId) { + this.taxaEmbLevanteCtrlId = taxaEmbLevanteCtrlId; + } + + public Integer getTaxaEmbLevanteCtrlId() { + return taxaEmbLevanteCtrlId; + } + + public void setTaxaEmbLevanteCtrlId(Integer taxaEmbLevanteCtrlId) { + this.taxaEmbLevanteCtrlId = taxaEmbLevanteCtrlId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTaxaEmbLevanteList() { + if (this.taxaEmbLevanteList == null) + this.taxaEmbLevanteList = new ArrayList(); + + List list = new ArrayList(); + for (TaxaEmbLevante taxaEmbLevante : this.taxaEmbLevanteList) { + if (taxaEmbLevante.getActivo().equals(true)) { + list.add(taxaEmbLevante); + } + } + return list; + } + + public void setTaxaEmbLevanteList(List taxaEmbLevanteList) { + this.taxaEmbLevanteList = taxaEmbLevanteList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaEmbLevanteCtrlId != null ? taxaEmbLevanteCtrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TaxaEmbLevanteCtrl)) { + return false; + } + TaxaEmbLevanteCtrl other = (TaxaEmbLevanteCtrl) object; + if ((this.taxaEmbLevanteCtrlId == null && other.taxaEmbLevanteCtrlId != null) || (this.taxaEmbLevanteCtrlId != null && !this.taxaEmbLevanteCtrlId.equals(other.taxaEmbLevanteCtrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl[taxaEmbLevanteCtrlId=" + taxaEmbLevanteCtrlId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueKm.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueKm.java new file mode 100644 index 000000000..41f2681a5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueKm.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "TAXA_EMBARQUE_KM_SEQ", sequenceName = "TAXA_EMBARQUE_KM_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMBARQUE_KM") +public class TaxaEmbarqueKm implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMBARQUE_KM_SEQ") + @Column(name = "TAXAEMBARQUEKM_ID") + private Integer taxaembarquekmId; + @Column(name = "KMATE") + private Integer kmate; + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "VALORTAXA") + private BigDecimal valortaxa; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedenteId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TaxaEmbarqueKm() { + } + + public TaxaEmbarqueKm(Integer taxaembarquekmId) { + this.taxaembarquekmId = taxaembarquekmId; + } + + public Integer getTaxaembarquekmId() { + return taxaembarquekmId; + } + + public void setTaxaembarquekmId(Integer taxaembarquekmId) { + this.taxaembarquekmId = taxaembarquekmId; + } + + public Integer getKmate() { + return kmate; + } + + public void setKmate(Integer kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + public OrgaoConcedente getOrgaoconcedenteId() { + return orgaoconcedenteId; + } + + public void setOrgaoconcedenteId(OrgaoConcedente orgaoconcedenteId) { + this.orgaoconcedenteId = orgaoconcedenteId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaembarquekmId != null ? taxaembarquekmId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TaxaEmbarqueKm)) { + return false; + } + TaxaEmbarqueKm other = (TaxaEmbarqueKm) object; + if ((this.taxaembarquekmId == null && other.taxaembarquekmId != null) || (this.taxaembarquekmId != null && !this.taxaembarquekmId.equals(other.taxaembarquekmId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm[ taxaembarquekmId=" + taxaembarquekmId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueParada.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueParada.java new file mode 100644 index 000000000..ccdca5e1b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueParada.java @@ -0,0 +1,168 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "TAXA_EMBARQUE_PARADA_SEQ", sequenceName = "TAXA_EMBARQUE_PARADA_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMBARQUE_PARADA") +public class TaxaEmbarqueParada implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMBARQUE_PARADA_SEQ") + @Column(name = "TAXAEMBARQUEPARADA_ID") + private Integer taxaembarqueparadaId; + @Basic(optional = false) + @Column(name = "INDTIPO") + private char indtipo; + @Column(name = "KMATE") + private Integer kmate; + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "VALORTAXA") + private BigDecimal valortaxa; + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaId; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedenteId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TaxaEmbarqueParada() { + } + + public TaxaEmbarqueParada(Integer taxaembarqueparadaId) { + this.taxaembarqueparadaId = taxaembarqueparadaId; + } + + public TaxaEmbarqueParada(Integer taxaembarqueparadaId, char indtipo) { + this.taxaembarqueparadaId = taxaembarqueparadaId; + this.indtipo = indtipo; + } + + public Integer getTaxaembarqueparadaId() { + return taxaembarqueparadaId; + } + + public void setTaxaembarqueparadaId(Integer taxaembarqueparadaId) { + this.taxaembarqueparadaId = taxaembarqueparadaId; + } + + public char getIndtipo() { + return indtipo; + } + + public void setIndtipo(char indtipo) { + this.indtipo = indtipo; + } + + public Integer getKmate() { + return kmate; + } + + public void setKmate(Integer kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + public Parada getParadaId() { + return paradaId; + } + + public void setParadaId(Parada paradaId) { + this.paradaId = paradaId; + } + + public OrgaoConcedente getOrgaoconcedenteId() { + return orgaoconcedenteId; + } + + public void setOrgaoconcedenteId(OrgaoConcedente orgaoconcedenteId) { + this.orgaoconcedenteId = orgaoconcedenteId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaembarqueparadaId != null ? taxaembarqueparadaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TaxaEmbarqueParada)) { + return false; + } + TaxaEmbarqueParada other = (TaxaEmbarqueParada) object; + if ((this.taxaembarqueparadaId == null && other.taxaembarqueparadaId != null) || (this.taxaembarqueparadaId != null && !this.taxaembarqueparadaId.equals(other.taxaembarqueparadaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada[ taxaembarqueparadaId=" + taxaembarqueparadaId + " ]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCiudad.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCiudad.java new file mode 100644 index 000000000..382e47655 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCiudad.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "TIPO_CAMBIO_CIUDAD") +@SequenceGenerator(name = "TIPO_CAMBIO_CIUDAD_SEQ", sequenceName = "TIPO_CAMBIO_CIUDAD_SEQ", allocationSize = 1) +public class TipoCambioCiudad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CAMBIO_CIUDAD_SEQ") + @Column(name = "TIPOCAMBIOCIUDAD_ID") + private Integer tipocambiociudadId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CIUDAD_ID", referencedColumnName = "CIUDAD_ID") + @ManyToOne + private Ciudad ciudad; + @JoinColumn(name = "TIPOCAMBIOCTRL_ID", referencedColumnName = "TIPOCAMBIOCTRL_ID") + @ManyToOne + private TipoCambioCtrl tipoCambioCtrl; + + public TipoCambioCiudad() { + } + + public TipoCambioCiudad(Integer tipocambiociudadId) { + this.tipocambiociudadId = tipocambiociudadId; + } + + public Integer getTipocambiociudadId() { + return tipocambiociudadId; + } + + public void setTipocambiociudadId(Integer tipocambiociudadId) { + this.tipocambiociudadId = tipocambiociudadId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public TipoCambioCtrl getTipoCambioCtrl() { + return tipoCambioCtrl; + } + + public void setTipoCambioCtrl(TipoCambioCtrl tipoCambioCtrl) { + this.tipoCambioCtrl = tipoCambioCtrl; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocambiociudadId != null ? tipocambiociudadId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCambioCiudad)) { + return false; + } + TipoCambioCiudad other = (TipoCambioCiudad) object; + if ((this.tipocambiociudadId == null && other.tipocambiociudadId != null) || (this.tipocambiociudadId != null && !this.tipocambiociudadId.equals(other.tipocambiociudadId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.TipoCambioCiudad[tipocambiociudadId=" + tipocambiociudadId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCtrl.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCtrl.java new file mode 100644 index 000000000..0b5e1daf0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCtrl.java @@ -0,0 +1,173 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "TIPO_CAMBIO_CTRL") +@SequenceGenerator(name = "TIPO_CAMBIO_CTRL_SEQ", sequenceName = "TIPO_CAMBIO_CTRL_SEQ", allocationSize = 1) +public class TipoCambioCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CAMBIO_CTRL_SEQ") + @Column(name = "TIPOCAMBIOCTRL_ID") + private Integer tipocambioctrlId; + @Column(name = "IMPORTECAMBIO") + private BigDecimal importecambio; + @Column(name = "FECAPLICACION") + @Temporal(TemporalType.TIMESTAMP) + private Date fecaplicacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TIPOCAMBIOCTRL_ID", referencedColumnName = "TIPOCAMBIOCTRL_ID") + private List tipoCambioCiudadList; + @JoinColumn(name = "MONEDADESTINO_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda monedaDestino; + @JoinColumn(name = "MONEDAORIGEN_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda monedaOrigen; + + public TipoCambioCtrl() { + } + + public TipoCambioCtrl(Integer tipocambioctrlId) { + this.tipocambioctrlId = tipocambioctrlId; + } + + public Integer getTipocambioctrlId() { + return tipocambioctrlId; + } + + public void setTipocambioctrlId(Integer tipocambioctrlId) { + this.tipocambioctrlId = tipocambioctrlId; + } + + public BigDecimal getImportecambio() { + return importecambio; + } + + public void setImportecambio(BigDecimal importecambio) { + this.importecambio = importecambio; + } + + public Date getFecaplicacion() { + return fecaplicacion; + } + + public void setFecaplicacion(Date fecaplicacion) { + this.fecaplicacion = fecaplicacion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTipoCambioCiudadList() { + List pcList = new ArrayList(); + for (TipoCambioCiudad pc : this.tipoCambioCiudadList) { + if (pc.getActivo() == Boolean.TRUE) { + pcList.add(pc); + } + } + return pcList; + } + + public void setTipoCambioCiudadList(List tipoCambioCiudadList) { + this.tipoCambioCiudadList = tipoCambioCiudadList; + } + + public Moneda getMonedaDestino() { + return monedaDestino; + } + + public void setMonedaDestino(Moneda monedaDestino) { + this.monedaDestino = monedaDestino; + } + + public Moneda getMonedaOrigen() { + return monedaOrigen; + } + + public void setMonedaOrigen(Moneda monedaOrigen) { + this.monedaOrigen = monedaOrigen; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocambioctrlId != null ? tipocambioctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCambioCtrl)) { + return false; + } + TipoCambioCtrl other = (TipoCambioCtrl) object; + if ((this.tipocambioctrlId == null && other.tipocambioctrlId != null) || (this.tipocambioctrlId != null && !this.tipocambioctrlId.equals(other.tipocambioctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.TipoCambioCtrl[tipocambioctrlId=" + tipocambioctrlId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoConvenio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoConvenio.java new file mode 100644 index 000000000..17bb84c78 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoConvenio.java @@ -0,0 +1,122 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "TIPO_CONVENIO_SEQ", sequenceName = "TIPO_CONVENIO_SEQ", allocationSize = 1) +@Table(name = "TIPO_CONVENIO") +public class TipoConvenio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CONVENIO_SEQ") + @Column(name = "TIPOCONVENIO_ID") + private Integer tipoConvenioID; + @Column(name = "DESCTIPO") + private String descTipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "tipoConvenio") + private List cuponConvenioList; + + public List getCuponConvenioList() { + return cuponConvenioList; + } + + public void setCuponConvenioList(List cuponConvenioList) { + this.cuponConvenioList = cuponConvenioList; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getDescTipo() { + return descTipo; + } + + public void setDescTipo(String descTipo) { + this.descTipo = descTipo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getTipoConvenioID() { + return tipoConvenioID; + } + + public void setTipoConvenioID(Integer tipoConvenioID) { + this.tipoConvenioID = tipoConvenioID; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoConvenioID != null ? tipoConvenioID.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoConvenio)) { + return false; + } + TipoConvenio other = (TipoConvenio) object; + if ((this.tipoConvenioID == null && other.tipoConvenioID != null) || (this.tipoConvenioID != null && !this.tipoConvenioID.equals(other.tipoConvenioID))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.Cortesia[cortesiaId=" + productoServicioID + "]"; + return this.getDescTipo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCorte.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCorte.java new file mode 100644 index 000000000..6ab2e5ad2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCorte.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_CORTE_SEQ", sequenceName = "TIPO_CORTE_SEQ", allocationSize = 1) +@Table(name = "TIPO_CORTE") +public class TipoCorte implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CORTE_SEQ") + @Column(name = "TIPOCORTE_ID") + private Short tipocorteId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public TipoCorte() { + } + + public TipoCorte(Short tipocorteId) { + this.tipocorteId = tipocorteId; + } + + public Short getTipocorteId() { + return tipocorteId; + } + + public void setTipocorteId(Short tipocorteId) { + this.tipocorteId = tipocorteId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocorteId != null ? tipocorteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCorte)) { + return false; + } + TipoCorte other = (TipoCorte) object; + if ((this.tipocorteId == null && other.tipocorteId != null) || (this.tipocorteId != null && !this.tipocorteId.equals(other.tipocorteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TipoCorte[tipocorteId=" + tipocorteId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCortesia.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCortesia.java new file mode 100644 index 000000000..a33cb8d57 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCortesia.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPO_CORTESIA_SEQ", sequenceName = "TIPO_CORTESIA_SEQ", allocationSize = 1) +@Table(name = "TIPO_CORTESIA") +public class TipoCortesia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CORTESIA_SEQ") + @Column(name = "TIPOCORTESIA_ID") + private Short tipocortesiaId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "tipoCortesia") + private List tipoCortesiaDescuentoList; + @JoinColumn(name = "GRUPOCORTESIA_ID", referencedColumnName = "GRUPOCORTESIA_ID") + @ManyToOne + private GrupoCortesia grupoCortesia; + + public TipoCortesia() { + } + + public TipoCortesia(Short tipocortesiaId) { + this.tipocortesiaId = tipocortesiaId; + } + + public Short getTipocortesiaId() { + return tipocortesiaId; + } + + public void setTipocortesiaId(Short tipocortesiaId) { + this.tipocortesiaId = tipocortesiaId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTipoCortesiaDescuentoList() { + return tipoCortesiaDescuentoList; + } + + public void setTipoCortesiaDescuentoList(List tipoCortesiaDescuentoList) { + this.tipoCortesiaDescuentoList = tipoCortesiaDescuentoList; + } + + public GrupoCortesia getGrupoCortesia() { + return grupoCortesia; + } + + public void setGrupoCortesia(GrupoCortesia grupoCortesia) { + this.grupoCortesia = grupoCortesia; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocortesiaId != null ? tipocortesiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCortesia)) { + return false; + } + TipoCortesia other = (TipoCortesia) object; + if ((this.tipocortesiaId == null && other.tipocortesiaId != null) || (this.tipocortesiaId != null && !this.tipocortesiaId.equals(other.tipocortesiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDesctipo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCortesiaDescuento.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCortesiaDescuento.java new file mode 100644 index 000000000..62cc61f84 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoCortesiaDescuento.java @@ -0,0 +1,134 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPOCORTESIA_DESCUENTO_SEQ", sequenceName = "TIPOCORTESIA_DESCUENTO_SEQ", allocationSize = 1) +@Table(name = "TIPOCORTESIA_DESCUENTO") +public class TipoCortesiaDescuento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPOCORTESIA_DESCUENTO_SEQ") + @Column(name = "TIPOCORTESIADESCUENTO_ID") + private Integer tipocortesiadescuentoId; + @Column(name = "PORCDESCUENTO") + private BigDecimal porcdescuento; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOCORTESIA_ID", referencedColumnName = "TIPOCORTESIA_ID") + @ManyToOne + @NotFound(action=NotFoundAction.IGNORE) + private TipoCortesia tipoCortesia; + + public TipoCortesiaDescuento() { + } + + public TipoCortesiaDescuento(Integer tipocortesiadescuentoId) { + this.tipocortesiadescuentoId = tipocortesiadescuentoId; + } + + public Integer getTipocortesiadescuentoId() { + return tipocortesiadescuentoId; + } + + public void setTipocortesiadescuentoId(Integer tipocortesiadescuentoId) { + this.tipocortesiadescuentoId = tipocortesiadescuentoId; + } + + public BigDecimal getPorcdescuento() { + return porcdescuento; + } + + public void setPorcdescuento(BigDecimal porcdescuento) { + this.porcdescuento = porcdescuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoCortesia getTipoCortesia() { + return tipoCortesia; + } + + public void setTipoCortesia(TipoCortesia tipoCortesia) { + this.tipoCortesia = tipoCortesia; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocortesiadescuentoId != null ? tipocortesiadescuentoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCortesiaDescuento)) { + return false; + } + TipoCortesiaDescuento other = (TipoCortesiaDescuento) object; + if ((this.tipocortesiadescuentoId == null && other.tipocortesiadescuentoId != null) || (this.tipocortesiadescuentoId != null && !this.tipocortesiadescuentoId.equals(other.tipocortesiadescuentoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getPorcdescuento().toString(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java new file mode 100644 index 000000000..abaac449a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TIPO_DOC_AUTOBUS_SEQ", sequenceName = "TIPO_DOC_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "TIPO_DOC_AUTOBUS") +public class TipoDocAutobus { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "TIPODOCAUTOBUS_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_DOC_AUTOBUS_SEQ") + private Integer tipoDocAutobusId; + @Column(name = "DESCDOC") + private String descDoc; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getTipoDocAutobusId() { + return tipoDocAutobusId; + } + public void setTipoDocAutobusId(Integer tipoDocAutobusId) { + this.tipoDocAutobusId = tipoDocAutobusId; + } + public String getDescDoc() { + return descDoc; + } + public void setDescDoc(String descDoc) { + this.descDoc = descDoc; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString(){ + return this.descDoc; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoDomicilio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoDomicilio.java new file mode 100644 index 000000000..ca16cf743 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoDomicilio.java @@ -0,0 +1,136 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_DOMICILIO_SEQ", sequenceName = "TIPO_DOMICILIO_SEQ", allocationSize = 1) +@Table(name = "TIPO_DOMICILIO") +public class TipoDomicilio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_DOMICILIO_SEQ") + @Column(name = "TIPODOMICILIO_ID") + private Short tipodomicilioId; + @Column(name = "CVETIPODOMICILIO") + private String cvetipodomicilio; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoDomicilio() { + } + + public TipoDomicilio(Short tipodomicilioId) { + this.tipodomicilioId = tipodomicilioId; + } + + public Short getTipodomicilioId() { + return tipodomicilioId; + } + + public void setTipodomicilioId(Short tipodomicilioId) { + this.tipodomicilioId = tipodomicilioId; + } + + public String getCvetipodomicilio() { + return cvetipodomicilio; + } + + public void setCvetipodomicilio(String cvetipodomicilio) { + this.cvetipodomicilio = cvetipodomicilio; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipodomicilioId != null ? tipodomicilioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoDomicilio)) { + return false; + } + TipoDomicilio other = (TipoDomicilio) object; + if ((this.tipodomicilioId == null && other.tipodomicilioId != null) || (this.tipodomicilioId != null && !this.tipodomicilioId.equals(other.tipodomicilioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.desctipo; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEmpleado.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEmpleado.java new file mode 100644 index 000000000..f0284fafd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEmpleado.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "TIPO_EMPLEADO_SEQ", sequenceName = "TIPO_EMPLEADO_SEQ", allocationSize = 1) +@Table(name = "TIPO_EMPLEADO") +public class TipoEmpleado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EMPLEADO_SEQ") + @Column(name = "TIPOEMPLEADO_ID") + private Integer tipoEmpleadoId; + @Column(name = "DESCTIPO") + private String descTipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "tipoEmpleado") + private List empleadoList; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getDescTipo() { + return descTipo; + } + + public void setDescTipo(String descTipo) { + this.descTipo = descTipo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getTipoEmpleadoId() { + return tipoEmpleadoId; + } + + public void setTipoEmpleadoId(Integer tipoEmpleadoId) { + this.tipoEmpleadoId = tipoEmpleadoId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoEmpleadoId != null ? tipoEmpleadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoEmpleado)) { + return false; + } + TipoEmpleado other = (TipoEmpleado) object; + if ((this.tipoEmpleadoId == null && other.tipoEmpleadoId != null) || (this.tipoEmpleadoId != null && !this.tipoEmpleadoId.equals(other.tipoEmpleadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.GrupoCortesias[grupocortesiaId=" + grupocortesiaId + "]"; + return this.getDescTipo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java new file mode 100644 index 000000000..53af1c140 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java @@ -0,0 +1,375 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "TIPO_EVENTO_EXTRA") +@SequenceGenerator(name = "TIPO_EVENTO_EXTRA_SEQ", sequenceName = "TIPO_EVENTO_EXTRA_SEQ", allocationSize = 1) +public class TipoEventoExtra implements Serializable { + + public static short OPERACION_NORMAL = 1; + public static short OPERACION_AJUSTE = 2; + public static short OPERACION_CAMBIO_CHEQUE = 3; + + public static String TIPO_CREDITO = "1"; + public static String TIPO_DEBITO = "0"; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EVENTO_EXTRA_SEQ") + @Column(name = "TIPOEVENTOEXTRA_ID") + private Integer tipoeventoextraId; + // @Column(name = "DESCINGRESO") + // private String descingreso; + @Column(name = "INDTIPO") + private String indtipo; + @Column(name = "IMPMAX") + private BigDecimal impmax; + @Column(name = "INDVALIDACORTE") + private Boolean indvalidacorte; + @Column(name = "INDVALIDADOCUMENTO") + private Boolean indvalidadocumento; + @Column(name = "INDCONTRAPARTIDA") + private Boolean indcontrapartida; + @Column(name = "INDBOLETO") + private Boolean indboleto; + // @Column(name = "INDAJUSTE") + // private Boolean indajuste; + @Column(name = "INDORDENSERVICIO") + private Boolean indordenservicio; + @Column(name = "INDOPERACION") + private Short indoperacion; + @Column(name = "PORCIVA") + private BigDecimal porciva; + + @Column(name = "PROVEEDOR") + private String proveedor; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + // @Column(name = "DESCINGRESO2") + // private String descingreso2; + @Column(name = "INDTIPO2") + private String indtipo2; + @Column(name = "DESCTIPOEVENTO") + private String descTipoEvento; + @Column(name = "NATUREZA") + private String natureza; + @Column(name = "CONTACONTABIL") + private String contaContabil; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoeventoextra") + @LazyCollection(LazyCollectionOption.FALSE) + private List empresas = new ArrayList(); + @Column(name = "INDCONFERENCIAFISICACOMISSAO") + private Boolean indconferenciafisicacomissao; + + public TipoEventoExtraEmpresa addEmpresa(Empresa e) { + TipoEventoExtraEmpresa t = new TipoEventoExtraEmpresa(); + t.setEmpresa(e); + t.setTipoeventoextra(this); + t.setActivo(Boolean.TRUE); + t.setFecmodif(Calendar.getInstance().getTime()); + t.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.empresas.add(t); + return t; + } + + public void removeEmpresa(TipoEventoExtraEmpresa t) { + this.empresas.remove(t); + } + + public String getDescTipoEvento() { + return descTipoEvento; + } + + public void setDescTipoEvento(String descTipoEvento) { + this.descTipoEvento = descTipoEvento; + } + + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + @JoinColumn(name = "FORMAPAGO2_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago2; + + @JoinColumn(name = "PARAMARTICULO_ID", referencedColumnName = "PARAMARTICULO_ID") + @ManyToOne + private ParamArticulo paramArticulo; + + @JoinColumn(name = "PARAMARTICULO2_ID", referencedColumnName = "PARAMARTICULO_ID") + @ManyToOne + private ParamArticulo paramArticulo2; + + public TipoEventoExtra() { + } + + public TipoEventoExtra(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + // public String getDescingreso() { + // return descingreso; + // } + // + // public void setDescingreso(String descingreso) { + // this.descingreso = descingreso; + // } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public BigDecimal getImpmax() { + return impmax; + } + + public void setImpmax(BigDecimal impmax) { + this.impmax = impmax; + } + + public Boolean getIndvalidacorte() { + return indvalidacorte; + } + + public void setIndvalidacorte(Boolean indvalidacorte) { + this.indvalidacorte = indvalidacorte; + } + + public Boolean getIndvalidadocumento() { + return indvalidadocumento; + } + + public void setIndvalidadocumento(Boolean indvalidadocumento) { + this.indvalidadocumento = indvalidadocumento; + } + + public Boolean getIndcontrapartida() { + return indcontrapartida; + } + + public void setIndcontrapartida(Boolean indcontrapartida) { + this.indcontrapartida = indcontrapartida; + } + + public Boolean getIndboleto() { + return indboleto; + } + + public void setIndboleto(Boolean indboleto) { + this.indboleto = indboleto; + } + + public Boolean getIndordenservicio() { + return indordenservicio; + } + + public void setIndordenservicio(Boolean indordenservicio) { + this.indordenservicio = indordenservicio; + } + + public BigDecimal getPorciva() { + return porciva; + } + + public void setPorciva(BigDecimal porciva) { + this.porciva = porciva; + } + + public String getProveedor() { + return proveedor; + } + + public void setProveedor(String proveedor) { + this.proveedor = proveedor; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getIndtipo2() { + return indtipo2; + } + + public void setIndtipo2(String indtipo2) { + this.indtipo2 = indtipo2; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public FormaPago getFormaPago2() { + return formaPago2; + } + + public void setFormaPago2(FormaPago formaPago2) { + this.formaPago2 = formaPago2; + } + + public ParamArticulo getParamArticulo() { + return paramArticulo; + } + + public void setParamArticulo(ParamArticulo paramArticulo) { + this.paramArticulo = paramArticulo; + } + + public ParamArticulo getParamArticulo2() { + return paramArticulo2; + } + + public void setParamArticulo2(ParamArticulo paramArticulo2) { + this.paramArticulo2 = paramArticulo2; + } + + public Short getIndoperacion() { + return indoperacion; + } + + public void setIndoperacion(Short indoperacion) { + this.indoperacion = indoperacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoeventoextraId != null ? tipoeventoextraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof TipoEventoExtra)) { + return false; + } + TipoEventoExtra other = (TipoEventoExtra) object; + if ((this.tipoeventoextraId == null && other.tipoeventoextraId != null) + || (this.tipoeventoextraId != null && !this.tipoeventoextraId + .equals(other.tipoeventoextraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return descTipoEvento; + } + + public String getNatureza() { + return natureza; + } + + public void setNatureza(String natureza) { + this.natureza = natureza; + } + + public String getContaContabil() { + return contaContabil; + } + + public void setContaContabil(String contaContabil) { + this.contaContabil = contaContabil; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public List getEmpresas() { + List lista = new ArrayList(); + for (TipoEventoExtraEmpresa t : empresas) { + if (t.getActivo()) { + lista.add(t); + } + } + return lista; + } + + public void setEmpresas(List empresas) { + this.empresas = empresas; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraEmpresa.java new file mode 100644 index 000000000..caef649f0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraEmpresa.java @@ -0,0 +1,104 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "TIPO_EVENTO_EXTRA_EMPRESA") +@SequenceGenerator(name = "TIPO_EVENTO_EXTRA_EMPRESA_SEQ", sequenceName = "TIPO_EVENTO_EXTRA_EMPRESA_SEQ", allocationSize = 1) +public class TipoEventoExtraEmpresa { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EVENTO_EXTRA_EMPRESA_SEQ") + @Column(name = "TIPOEVENTOEXTRAEMPRESA_ID") + private Integer tipoeventoextraempresaId; + @ManyToOne + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoeventoextra; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public Integer getTipoeventoextraempresaId() { + return tipoeventoextraempresaId; + } + public void setTipoeventoextraempresaId(Integer tipoeventoextraempresaId) { + this.tipoeventoextraempresaId = tipoeventoextraempresaId; + } + public TipoEventoExtra getTipoeventoextra() { + return tipoeventoextra; + } + public void setTipoeventoextra(TipoEventoExtra tipoeventoextra) { + this.tipoeventoextra = tipoeventoextra; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public String toString() { + return empresa.getNombempresa(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoeventoextraempresaId != null ? tipoeventoextraempresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoEventoExtraEmpresa)) { + return false; + } + TipoEventoExtraEmpresa other = (TipoEventoExtraEmpresa) object; + if ((this.tipoeventoextraempresaId == null && other.tipoeventoextraempresaId != null) || (this.tipoeventoextraempresaId != null && !this.tipoeventoextraempresaId.equals(other.tipoeventoextraempresaId))) { + return false; + } + return true; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoIdentificacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoIdentificacion.java new file mode 100644 index 000000000..8dcaec3fb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoIdentificacion.java @@ -0,0 +1,103 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "TIPO_IDENTIFICACION") +public class TipoIdentificacion implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TIPOIDENTIFICACION_ID") + private Integer tipoIdentificacionId; + + @Column(name = "DESCTIPO") + private String desctipo; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getTipoIdentificacionId() { + return tipoIdentificacionId; + } + + public void setTipoIdentificacionId(Integer tipoIdentificacionId) { + this.tipoIdentificacionId = tipoIdentificacionId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getDesctipo(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tipoIdentificacionId == null) ? 0 : tipoIdentificacionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TipoIdentificacion other = (TipoIdentificacion) obj; + if (tipoIdentificacionId == null) { + if (other.tipoIdentificacionId != null) + return false; + } else if (!tipoIdentificacionId.equals(other.tipoIdentificacionId)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java new file mode 100644 index 000000000..5017cbdec --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * TipoMovimentacion generated by hbm2java + */ +@Entity +@Table(name = "TIPO_MOVIMENTACION") +public class TipoMovimentacion implements java.io.Serializable { + + public static final int TIPO_ADQUISICION = 1; + public static final int TIPO_ENVIO = 2; + public static final int TIPO_VOLVER = 3; + public static final int TIPO_TRANSFERENCIA = 4; + public static final int TIPO_PERDIDO = 5; + public static final int TIPO_AJUSTE = 6; + public static final int TIPO_MIGRACAO = 99; + + private Integer tipomovimentacionId; + private String desctipomovimentacion; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public TipoMovimentacion() { + } + + public TipoMovimentacion(Integer tipomovimentacionId) { + this.tipomovimentacionId = tipomovimentacionId; + } + + public TipoMovimentacion(Integer tipomovimentacionId, String desctipomovimentacion, Boolean activo, Date fecmodif, Integer usuarioId) { + this.tipomovimentacionId = tipomovimentacionId; + this.desctipomovimentacion = desctipomovimentacion; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return desctipomovimentacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipomovimentacionId != null ? tipomovimentacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoMovimentacion)) + return false; + + TipoMovimentacion other = (TipoMovimentacion) object; + if ((this.tipomovimentacionId == null && other.tipomovimentacionId != null) || (this.tipomovimentacionId != null && !this.tipomovimentacionId.equals(other.tipomovimentacionId))) { + return false; + } + return true; + } + + + @Id + @Column(name = "TIPOMOVIMENTACION_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getTipomovimentacionId() { + return this.tipomovimentacionId; + } + + public void setTipomovimentacionId(Integer tipomovimentacionId) { + this.tipomovimentacionId = tipomovimentacionId; + } + + @Column(name = "DESCTIPOMOVIMENTACION", length = 20) + public String getDesctipomovimentacion() { + return this.desctipomovimentacion; + } + + public void setDesctipomovimentacion(String desctipomovimentacion) { + this.desctipomovimentacion = desctipomovimentacion; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoMovimiento.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoMovimiento.java new file mode 100644 index 000000000..7323cb8bd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoMovimiento.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_MOVIMIENTO_SEQ", sequenceName = "TIPO_MOVIMIENTO_SEQ", allocationSize = 1) +@Table(name = "TIPO_MOVIMIENTO") +public class TipoMovimiento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_MOVIMIENTO_SEQ") + @Column(name = "TIPOMOVIMIENTO_ID") + private Short tipomovimientoId; + @Column(name = "DESCMOVIMIENTO") + private String descmovimiento; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoMovimiento() { + } + + public TipoMovimiento(Short tipomovimientoId) { + this.tipomovimientoId = tipomovimientoId; + } + + public Short getTipomovimientoId() { + return tipomovimientoId; + } + + public void setTipomovimientoId(Short tipomovimientoId) { + this.tipomovimientoId = tipomovimientoId; + } + + public String getDescmovimiento() { + return descmovimiento; + } + + public void setDescmovimiento(String descmovimiento) { + this.descmovimiento = descmovimiento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipomovimientoId != null ? tipomovimientoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoMovimiento)) { + return false; + } + TipoMovimiento other = (TipoMovimiento) object; + if ((this.tipomovimientoId == null && other.tipomovimientoId != null) || (this.tipomovimientoId != null && !this.tipomovimientoId.equals(other.tipomovimientoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TipoMovimiento[tipomovimientoId=" + tipomovimientoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoOcupacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoOcupacion.java new file mode 100644 index 000000000..f523c0a82 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoOcupacion.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_OCUPACION_SEQ", sequenceName = "TIPO_OCUPACION_SEQ", allocationSize = 1) +@Table(name = "TIPO_OCUPACION") +public class TipoOcupacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_OCUPACION_SEQ") + @Column(name = "TIPOOCUPACION_ID") + private Short tipoocupacionId; + @Column(name = "CVETIPOOCUPACION") + private String cvetipoocupacion; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoOcupacion() { + } + + public TipoOcupacion(Short tipoocupacionId) { + this.tipoocupacionId = tipoocupacionId; + } + + public Short getTipoocupacionId() { + return tipoocupacionId; + } + + public void setTipoocupacionId(Short tipoocupacionId) { + this.tipoocupacionId = tipoocupacionId; + } + + public String getCvetipoocupacion() { + return cvetipoocupacion; + } + + public void setCvetipoocupacion(String cvetipoocupacion) { + this.cvetipoocupacion = cvetipoocupacion; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoocupacionId != null ? tipoocupacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoOcupacion)) { + return false; + } + TipoOcupacion other = (TipoOcupacion) object; + if ((this.tipoocupacionId == null && other.tipoocupacionId != null) || (this.tipoocupacionId != null && !this.tipoocupacionId.equals(other.tipoocupacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + // return "com.rjconsultores.ventaboletos.entidad.TipoOcupacion[tipoocupacionId=" + tipoocupacionId + "]"; + return this.desctipo; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoOperacionCC.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoOperacionCC.java new file mode 100644 index 000000000..9925970d6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoOperacionCC.java @@ -0,0 +1,131 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "TIPO_OPERACION_CC") +public class TipoOperacionCC implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TIPOOPERACIONCC_ID") + private Integer tipoOperacionCCId; + + @Column(name = "DESCTIPO") + private String descTipo; + + @Column(name = "CVETIPO") + private String cveTipo; + + @Column(name = "INDCREDITO") + private Boolean indCredito; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoOperacionCC() { + super(); + } + + public TipoOperacionCC(Integer tipoOperacionCCId) { + this(); + this.tipoOperacionCCId = tipoOperacionCCId; + } + + public Integer getTipoOperacionCCId() { + return tipoOperacionCCId; + } + + public void setTipoOperacionCCId(Integer tipoOperacionCCId) { + this.tipoOperacionCCId = tipoOperacionCCId; + } + + public String getDescTipo() { + return descTipo; + } + + public void setDescTipo(String descTipo) { + this.descTipo = descTipo; + } + + public String getCveTipo() { + return cveTipo; + } + + public void setCveTipo(String cveTipo) { + this.cveTipo = cveTipo; + } + + public Boolean getIndCredito() { + return indCredito; + } + + public void setIndCredito(Boolean indCredito) { + this.indCredito = indCredito; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tipoOperacionCCId == null) ? 0 : tipoOperacionCCId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TipoOperacionCC other = (TipoOperacionCC) obj; + if (tipoOperacionCCId == null) { + if (other.tipoOperacionCCId != null) + return false; + } else if (!tipoOperacionCCId.equals(other.tipoOperacionCCId)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoParada.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoParada.java new file mode 100644 index 000000000..74167bbb0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoParada.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_PARADA_SEQ", sequenceName = "TIPO_PARADA_SEQ", allocationSize = 1) +@Table(name = "TIPO_PARADA") +public class TipoParada implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_PARADA_SEQ") + @Column(name = "TIPOPARADA_ID") + private Short tipoparadaId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoParada() { + } + + public TipoParada(Short tipoparadaId) { + this.tipoparadaId = tipoparadaId; + } + + public Short getTipoparadaId() { + return tipoparadaId; + } + + public void setTipoparadaId(Short tipoparadaId) { + this.tipoparadaId = tipoparadaId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoparadaId != null ? tipoparadaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoParada)) { + return false; + } + TipoParada other = (TipoParada) object; + if ((this.tipoparadaId == null && other.tipoparadaId != null) || (this.tipoparadaId != null && !this.tipoparadaId.equals(other.tipoparadaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDesctipo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java new file mode 100644 index 000000000..a02e72082 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_PTOVTA_SEQ", sequenceName = "TIPO_PTOVTA_SEQ", allocationSize = 1) +@Table(name = "TIPO_PTOVTA") +public class TipoPuntoVenta implements Serializable { + + public static final Short TODOS = -1; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_PTOVTA_SEQ") + @Column(name = "TIPOPTOVTA_ID") + private Short tipoptovtaId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TIPOPTOVTA_ID") + private List lsCategoriaTipoPtoVta; + + public TipoPuntoVenta() { + } + + public TipoPuntoVenta(Short tipoptovtaId) { + this.tipoptovtaId = tipoptovtaId; + } + + public Short getTipoptovtaId() { + return tipoptovtaId; + } + + public void setTipoptovtaId(Short tipoptovtaId) { + this.tipoptovtaId = tipoptovtaId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public List getLsCategoriaTipoPtoVta() { + List tmp = new ArrayList(); + if (lsCategoriaTipoPtoVta != null) { + for (CategoriaTipoPtoVta cp : this.lsCategoriaTipoPtoVta) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setLsCategoriaTipoPtoVta(List lsCategoriaTipoPtoVta) { + this.lsCategoriaTipoPtoVta = lsCategoriaTipoPtoVta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoptovtaId != null ? tipoptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof TipoPuntoVenta)) { + return false; + } + TipoPuntoVenta other = (TipoPuntoVenta) object; + if ((this.tipoptovtaId == null && other.tipoptovtaId != null) || (this.tipoptovtaId != null && !this.tipoptovtaId.equals(other.tipoptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDesctipo(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoServicio.java new file mode 100644 index 000000000..9485bcc59 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoServicio.java @@ -0,0 +1,112 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPO_SERVICIO_SEQ", sequenceName = "TIPO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "TIPO_SERVICIO") +public class TipoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_SERVICIO_SEQ") + @Column(name = "TIPOSERVICIO_ID") + private Integer tiposervicioId; + @Column(name = "DESCSERVICIO") + private String descservicio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoServicio() { + } + + public Integer getTiposervicioId() { + return tiposervicioId; + } + + public void setTiposervicioId(Integer tiposervicioId) { + this.tiposervicioId = tiposervicioId; + } + + public String getDescservicio() { + return descservicio; + } + + public void setDescservicio(String descservicio) { + this.descservicio = descservicio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tiposervicioId != null ? tiposervicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoServicio)) { + return false; + } + TipoServicio other = (TipoServicio) object; + if ((this.tiposervicioId == null && other.tiposervicioId != null) || (this.tiposervicioId != null && !this.tiposervicioId.equals(other.tiposervicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.descservicio; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoTarifaPacote.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoTarifaPacote.java new file mode 100644 index 000000000..e225a7f8f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoTarifaPacote.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "TIPO_TARIFA_PACOTE") +@SequenceGenerator(name = "TIPO_TARIFA_PACOTE_SEQ", sequenceName = "TIPO_TARIFA_PACOTE_SEQ", allocationSize = 1) +public class TipoTarifaPacote implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_TARIFA_PACOTE_SEQ") + @Column(name = "TIPOTARIFAPACOTE_ID") + private Integer tipotarifapacoteId; + @Column(name = "DESCTIPOTARIFA") + private String desctipotarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToMany + @JoinTable(name = "PACOTE_TARIFA", joinColumns = { @JoinColumn(name = "TIPOTARIFAPACOTE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "PACOTE_ID") }) + private List pacoteList; + + public TipoTarifaPacote() { + super(); + } + + public TipoTarifaPacote(Integer tipotarifapacoteId, String desctipotarifa) { + this(); + this.tipotarifapacoteId = tipotarifapacoteId; + this.desctipotarifa = desctipotarifa; + } + + public TipoTarifaPacote(Integer tipotarifapacoteId, String desctipotarifa, Boolean activo, Date fecmodif, Integer usuarioId) { + this(); + this.tipotarifapacoteId = tipotarifapacoteId; + this.desctipotarifa = desctipotarifa; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getTipotarifapacoteId() { + return tipotarifapacoteId; + } + + public void setTipotarifapacoteId(Integer tipotarifapacoteId) { + this.tipotarifapacoteId = tipotarifapacoteId; + } + + public String getDesctipotarifa() { + return desctipotarifa; + } + + public void setDesctipotarifa(String desctipotarifa) { + this.desctipotarifa = desctipotarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPacoteList() { + return pacoteList; + } + + public void setPacoteList(List pacoteList) { + this.pacoteList = pacoteList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tipotarifapacoteId == null) ? 0 : tipotarifapacoteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TipoTarifaPacote other = (TipoTarifaPacote) obj; + if (tipotarifapacoteId == null) { + if (other.tipotarifapacoteId != null) + return false; + } else if (!tipotarifapacoteId.equals(other.tipotarifapacoteId)) + return false; + return true; + } + + @Override + public String toString() { + return getDesctipotarifa(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoVenta.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoVenta.java new file mode 100644 index 000000000..29dc52551 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TipoVenta.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPO_VENTA_SEQ", sequenceName = "TIPO_VENTA_SEQ", allocationSize=1) +@Table(name = "TIPO_VENTA") +public class TipoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_VENTA_SEQ") + @Column(name = "TIPOVENTA_ID") + private Short tipoventaId; + @Column(name = "DESCTIPOVENTA") + private String desctipoventa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoVenta() { + } + + public TipoVenta(Short tipoventaId) { + this.tipoventaId = tipoventaId; + } + + public Short getTipoventaId() { + return tipoventaId; + } + + public void setTipoventaId(Short tipoventaId) { + this.tipoventaId = tipoventaId; + } + + public String getDesctipoventa() { + return desctipoventa; + } + + public void setDesctipoventa(String desctipoventa) { + this.desctipoventa = desctipoventa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoventaId != null ? tipoventaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TipoVenta)) { + return false; + } + TipoVenta other = (TipoVenta) object; + if ((this.tipoventaId == null && other.tipoventaId != null) || (this.tipoventaId != null && !this.tipoventaId.equals(other.tipoventaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TipoVenta[tipoventaId=" + tipoventaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Tramo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Tramo.java new file mode 100644 index 000000000..745f6d2a8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Tramo.java @@ -0,0 +1,285 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TRAMO_SEQ", sequenceName = "TRAMO_SEQ", allocationSize = 1) +@Table(name = "TRAMO") +public class Tramo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_SEQ") + @Column(name = "TRAMO_ID") + private Integer tramoId; + @Column(name = "DESCTRAMO") + private String desctramo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "VIA_ID", referencedColumnName = "VIA_ID") + @ManyToOne + private Via via; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @OneToMany(mappedBy = "tramo") + private List rutaSecuenciaList; + @OneToMany(mappedBy = "tramo") + private List rutaCombinacionList; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List lsTramoTiempo; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List tramoServicioList; + @Column(name = "CANTKMPAGOCONDUCTOR") + private BigDecimal kmPagoConductor; + @Column(name = "CANTKMREAL") + private BigDecimal kmReal; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List tramoKms; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List lsOrgaoTramo; + + public Tramo() { + } + + public Tramo(Integer tramoId) { + this.tramoId = tramoId; + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public String getDesctramo() { + return desctramo; + } + + public void setDesctramo(String desctramo) { + this.desctramo = desctramo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public List getRutaSecuenciaList() { + List lsRutaSecuencia = new ArrayList(); + for (RutaSecuencia rSecuencia : this.rutaSecuenciaList) { + if (rSecuencia.getActivo()) { + lsRutaSecuencia.add(rSecuencia); + } + } + + this.rutaSecuenciaList = lsRutaSecuencia; + + return lsRutaSecuencia; + } + + public void setRutaSecuenciaList(List rutaSecuenciaList) { + this.rutaSecuenciaList = rutaSecuenciaList; + } + + public List getRutaCombinacionList() { + List lsRutaCombinacion = new ArrayList(); + for (RutaCombinacion rCombinacion : this.rutaCombinacionList) { + if (rCombinacion.getActivo()) { + lsRutaCombinacion.add(rCombinacion); + } + } + + this.rutaCombinacionList = lsRutaCombinacion; + + return lsRutaCombinacion; + } + + public void setRutaCombinacionList(List rutaCombinacionList) { + this.rutaCombinacionList = rutaCombinacionList; + } + + public List getTramoServicioList() { + List lsTramoServicio = new ArrayList(); + for (TramoServicio tramoServicio : this.tramoServicioList) { + if (tramoServicio.getActivo()) { + lsTramoServicio.add(tramoServicio); + } + } + + this.tramoServicioList = lsTramoServicio; + + return lsTramoServicio; + } + + public void setTramoServicioList(List tramoServicioList) { + this.tramoServicioList = tramoServicioList; + } + + public List getLsTramoTiempo() { + List lsTmp = new ArrayList(); + for (TramoTiempo tramoAtributo : this.lsTramoTiempo) { + if (tramoAtributo.getActivo()) { + lsTmp.add(tramoAtributo); + } + } + + this.lsTramoTiempo = lsTmp; + + return lsTmp; + } + + public void setLsTramoTiempo(List lsTramoTiempo) { + this.lsTramoTiempo = lsTramoTiempo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tramoId != null ? tramoId.hashCode() : 0); + return hash; + } + + public BigDecimal getKmPagoConductor() { + return kmPagoConductor; + } + + public void setKmPagoConductor(BigDecimal kmPagoConductor) { + this.kmPagoConductor = kmPagoConductor; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public List getLsOrgaoTramo() { + List tmp = new ArrayList(); + for (OrgaoTramo orgaoTramo : this.lsOrgaoTramo) { + if (orgaoTramo.getActivo()) { + tmp.add(orgaoTramo); + } + } + + this.lsOrgaoTramo = tmp; + + return tmp; + } + + public void setLsOrgaoTramo(List lsOrgaoTramo) { + this.lsOrgaoTramo = lsOrgaoTramo; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Tramo)) { + return false; + } + Tramo other = (Tramo) object; + if ((this.tramoId == null && other.tramoId != null) || (this.tramoId != null && !this.tramoId.equals(other.tramoId))) { + return false; + } + return true; + } + + public List getTramoKms() { + return tramoKms; + } + + public void setTramoKms(List tramoKms) { + this.tramoKms = tramoKms; + } + + @Override + public String toString() { + return getDesctramo().concat(" - ").concat(this.getVia().getNombvia()); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoKm.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoKm.java new file mode 100644 index 000000000..61efc4de0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoKm.java @@ -0,0 +1,112 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 10/01/2012 11:38:41 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * TramoKm generated by hbm2java + */ +@Entity +@SequenceGenerator(name = "TRAMO_KM_SEQ", sequenceName = "TRAMO_KM_SEQ", allocationSize = 1) +@Table(name = "TRAMO_KM") +public class TramoKm implements java.io.Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Column(name = "TRAMOKM_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_KM_SEQ") + @Basic(optional = false) + private int tramokmId; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @Column(name = "CANTKMPAGOCONDUCTOR") + private Integer cantkmpagoconductor; + @Column(name = "ACTIVO") + private Boolean activo; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TramoKm() { + } + + public TramoKm(int tramokmId) { + this.tramokmId = tramokmId; + } + + public int getTramokmId() { + return this.tramokmId; + } + + public void setTramokmId(int tramokmId) { + this.tramokmId = tramokmId; + } + + public Integer getCantkmpagoconductor() { + return this.cantkmpagoconductor; + } + + public void setCantkmpagoconductor(Integer cantkmpagoconductor) { + this.cantkmpagoconductor = cantkmpagoconductor; + } + + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoKmServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoKmServicio.java new file mode 100644 index 000000000..92273356e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoKmServicio.java @@ -0,0 +1,165 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "TRAMO_SERVICIO_SEQ", sequenceName = "TRAMO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "TRAMO_KM_SERVICIO") +public class TramoKmServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_SERVICIO_SEQ") + @Column(name = "TRAMOKMSERVICIO") + private Integer tramokmservicioId; + @Basic(optional = false) + @Column(name = "CANTKMPAGOCONDUCTOR") + private BigDecimal cantkmpagoconductor; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public TramoKmServicio() { + } + + public TramoKmServicio(Integer tramokmservicio) { + this.tramokmservicioId = tramokmservicio; + } + + public TramoKmServicio(Integer tramokmservicio, BigDecimal cantkmpagoconductor, Boolean activo) { + this.tramokmservicioId = tramokmservicio; + this.cantkmpagoconductor = cantkmpagoconductor; + this.activo = activo; + } + + public Integer getTramokmservicioId() { + return tramokmservicioId; + } + + public void setTramokmservicioId(Integer tramokmservicioId) { + this.tramokmservicioId = tramokmservicioId; + } + + + + public BigDecimal getCantkmpagoconductor() { + return cantkmpagoconductor; + } + + public void setCantkmpagoconductor(BigDecimal cantkmpagoconductor) { + this.cantkmpagoconductor = cantkmpagoconductor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tramokmservicioId != null ? tramokmservicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TramoKmServicio)) { + return false; + } + TramoKmServicio other = (TramoKmServicio) object; + if ((this.tramokmservicioId == null && other.tramokmservicioId != null) || (this.tramokmservicioId != null && !this.tramokmservicioId.equals(other.tramokmservicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TramoKmServicio[tramokmservicio=" + tramokmservicioId + "]"; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoServicio.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoServicio.java new file mode 100644 index 000000000..24b147704 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoServicio.java @@ -0,0 +1,149 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TRAMO_SERVICIO_SEQ", sequenceName = "TRAMO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "TRAMO_SERVICIO") +public class TramoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_SERVICIO_SEQ") + @Column(name = "TRAMOSERVICIO_ID") + private Integer tramoservicioId; + @Column(name = "TIEMPORECORRIDO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiemporecorrido; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public TramoServicio() { + } + + public TramoServicio(Integer tramoservicioId) { + this.tramoservicioId = tramoservicioId; + } + + public Integer getTramoservicioId() { + return tramoservicioId; + } + + public void setTramoservicioId(Integer tramoservicioId) { + this.tramoservicioId = tramoservicioId; + } + + public Date getTiemporecorrido() { + return tiemporecorrido; + } + + public void setTiemporecorrido(Date tiemporecorrido) { + this.tiemporecorrido = tiemporecorrido; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final TramoServicio other = (TramoServicio) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.tramo != other.tramo && (this.tramo == null || !this.tramo.equals(other.tramo))) { + return false; + } + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + return hash; + } + + @Override + public String toString() { + return "teste.TramoServicio[tramoservicioId=" + tramoservicioId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoTiempo.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoTiempo.java new file mode 100644 index 000000000..0687b3392 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/TramoTiempo.java @@ -0,0 +1,236 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TRAMO_TIEMPO_SEQ", sequenceName = "TRAMO_TIEMPO_SEQ", allocationSize = 1) +@Table(name = "TRAMO_TIEMPO") +public class TramoTiempo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_TIEMPO_SEQ") + @Column(name = "TRAMOTIEMPO_ID") + private Integer tramotiempoId; + @Column(name = "TIEMPORECORRIDO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiemporecorrido; + @Column(name = "HORAINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date horainicio; + @Column(name = "HORAFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date horafin; + @Column(name = "INDAPLICLUN") + private Boolean indapliclun; + @Column(name = "INDAPLICMAR") + private Boolean indaplicmar; + @Column(name = "INDAPLICMIE") + private Boolean indaplicmie; + @Column(name = "INDAPLICJUE") + private Boolean indaplicjue; + @Column(name = "INDAPLICVIE") + private Boolean indaplicvie; + @Column(name = "INDAPLICSAB") + private Boolean indaplicsab; + @Column(name = "INDAPLICDOM") + private Boolean indaplicdom; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public TramoTiempo() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Date getHorafin() { + return horafin; + } + + public void setHorafin(Date horafin) { + this.horafin = horafin; + } + + public Date getHorainicio() { + return horainicio; + } + + public void setHorainicio(Date horainicio) { + this.horainicio = horainicio; + } + + public Boolean getIndaplicdom() { + return indaplicdom; + } + + public void setIndaplicdom(Boolean indaplicdom) { + this.indaplicdom = indaplicdom; + } + + public Boolean getIndaplicjue() { + return indaplicjue; + } + + public void setIndaplicjue(Boolean indaplicjue) { + this.indaplicjue = indaplicjue; + } + + public Boolean getIndapliclun() { + return indapliclun; + } + + public void setIndapliclun(Boolean indapliclun) { + this.indapliclun = indapliclun; + } + + public Boolean getIndaplicmar() { + return indaplicmar; + } + + public void setIndaplicmar(Boolean indaplicmar) { + this.indaplicmar = indaplicmar; + } + + public Boolean getIndaplicmie() { + return indaplicmie; + } + + public void setIndaplicmie(Boolean indaplicmie) { + this.indaplicmie = indaplicmie; + } + + public Boolean getIndaplicsab() { + return indaplicsab; + } + + public void setIndaplicsab(Boolean indaplicsab) { + this.indaplicsab = indaplicsab; + } + + public Boolean getIndaplicvie() { + return indaplicvie; + } + + public void setIndaplicvie(Boolean indaplicvie) { + this.indaplicvie = indaplicvie; + } + + public Date getTiemporecorrido() { + return tiemporecorrido; + } + + public void setTiemporecorrido(Date tiemporecorrido) { + this.tiemporecorrido = tiemporecorrido; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Integer getTramotiempoId() { + return tramotiempoId; + } + + public void setTramotiempoId(Integer tramotiempoId) { + this.tramotiempoId = tramotiempoId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final TramoTiempo other = (TramoTiempo) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.tramo != other.tramo && (this.tramo == null || !this.tramo.equals(other.tramo))) { + return false; + } + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TramoTiempo[tramotiempoId=" + tramotiempoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Turno.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Turno.java new file mode 100644 index 000000000..cbbdf6522 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Turno.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TURNO_SEQ", sequenceName = "TURNO_SEQ", allocationSize = 1) +@Table(name = "TURNO") +public class Turno implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TURNO_SEQ") + @Column(name = "TURNO_ID") + private Short turnoId; + @Column(name = "DESCTURNO") + private String descturno; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public Turno() { + } + + public Turno(Short turnoId) { + this.turnoId = turnoId; + } + + public Short getTurnoId() { + return turnoId; + } + + public void setTurnoId(Short turnoId) { + this.turnoId = turnoId; + } + + public String getDescturno() { + return descturno; + } + + public void setDescturno(String descturno) { + this.descturno = descturno; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (turnoId != null ? turnoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Turno)) { + return false; + } + Turno other = (Turno) object; + if ((this.turnoId == null && other.turnoId != null) || (this.turnoId != null && !this.turnoId.equals(other.turnoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Turno[turnoId=" + turnoId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Usuario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Usuario.java new file mode 100644 index 000000000..623cc55d7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Usuario.java @@ -0,0 +1,408 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1) +@Table(name = "USUARIO") +public class Usuario implements Serializable, Authentication, UserDetails { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SEQ") + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NOMBUSUARIO") + private String nombusuario; + @Column(name = "NOMBPATERNO") + private String nombpaterno; + @Column(name = "NOMBMATERNO") + private String nombmaterno; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + @Column(name = "DESCCONTRASENA") + private String senha; + @Column(name = "CVEUSUARIO") + private String claveUsuario; + @Column(name = "DESCCORREO") + private String descCorreo; + @OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + private List usuarioPerfilList; + @Column(name = "INDCORTEAUTOMATICO") + private Boolean indCorteAutomatico; + @OneToOne + @JoinColumn(name = "EMPLEADO_ID") + private Empleado empleado; + @OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + private List usuarioEmpresaList; + + @OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + private List usuarioUbicacionList; + + @Column(name = "FECCONTRASENA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecContrasena; + + /* Lista de permissoes do usuario */ + @Transient + private List listClavesPermisos; + + public String getClaveUsuario() { + return claveUsuario; + } + + public void setClaveUsuario(String claveUsuario) { + this.claveUsuario = claveUsuario; + } + + public Usuario() { + } + + public Usuario(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public String getNombpaterno() { + return nombpaterno; + } + + public void setNombpaterno(String nombpaterno) { + this.nombpaterno = nombpaterno; + } + + public String getNombmaterno() { + return nombmaterno; + } + + public void setNombmaterno(String nombmaterno) { + this.nombmaterno = nombmaterno; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public List getUsuarioEmpresaList() { + List tmp = new ArrayList(); + if (usuarioEmpresaList != null) { + for (UsuarioEmpresa ce : this.usuarioEmpresaList) { + if (ce.getActivo()) { + tmp.add(ce); + } + } + } + + return tmp; + } + + public void setUsuarioEmpresaList(List usuarioEmpresaList) { + this.usuarioEmpresaList = usuarioEmpresaList; + } + + public List getUsuarioPerfilList() { + List tmp = new ArrayList(); + if (usuarioPerfilList != null) { + for (UsuarioPerfil cp : this.usuarioPerfilList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public List getEmpresa() { + List tmp = new ArrayList(); + if (usuarioEmpresaList != null) { + for (UsuarioEmpresa cp : this.usuarioEmpresaList) { + if ((cp.getActivo())) { + tmp.add(cp.getEmpresa()); + } + } + } + + return tmp; + } + + public void setUsuarioPerfilList(List usuarioPerfilList) { + this.usuarioPerfilList = usuarioPerfilList; + } + + public Empleado getEmpleado() { + return empleado; + } + + public void setEmpleado(Empleado empleado) { + this.empleado = empleado; + } + + public void updateUsuarioUbicacionForClonedUser(){ + for (UsuarioUbicacion ub : usuarioUbicacionList){ + ub.setUsuarioubicacionId(null); + } + } + + public void updateUsuarioEmpresaForClonedUser(){ + for (UsuarioEmpresa ue : usuarioEmpresaList){ + ue.setUsuarioEmpresaId(null); + } + } + + public void updateUsuarioPerfilForClonedUser(){ + for (UsuarioPerfil ub : usuarioPerfilList){ + ub.setUsuarioperfilId(null); + } + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioId != null ? usuarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Usuario)) { + return false; + } + Usuario other = (Usuario) object; + if ((this.usuarioId == null && other.usuarioId != null) || (this.usuarioId != null && !this.usuarioId.equals(other.usuarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombUsuarioCompleto(); + } + + public Collection getAuthorities() { + return new ArrayList(); + } + + public String getPassword() { + return this.senha; + } + + public String getUsername() { + return this.nombusuario; + } + + public boolean isAccountNonExpired() { + return true; + } + + public boolean isAccountNonLocked() { + return true; + } + + public boolean isCredentialsNonExpired() { + if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) { + if (getFecContrasena() != null) { + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante contante = constanteService.buscarPorNomeConstante("CANT_DIAS_CONTRASENA"); + Integer maxPrazoCambioContrasena = Integer.valueOf(contante.getValorconstante()); + Date maxFechaContrasena = DateUtil.somarDias(getFecContrasena(), maxPrazoCambioContrasena); + if (Calendar.getInstance().getTime().after(maxFechaContrasena)) { + return false; + } + } else { + return false; + } + } + + return true; + } + + public boolean isEnabled() { + return true; + } + + public Object getCredentials() { + return new Object(); + } + + public Object getDetails() { + return new Object(); + } + + public Object getPrincipal() { + return this; + } + + public boolean isAuthenticated() { + return Boolean.TRUE; + } + + public void setAuthenticated(boolean bln) throws IllegalArgumentException { + } + + public String getName() { + return this.getNombusuario(); + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + public Boolean getIndCorteAutomatico() { + return indCorteAutomatico; + } + + public void setIndCorteAutomatico(Boolean indCorteAutomatico) { + this.indCorteAutomatico = indCorteAutomatico; + } + + public List getUsuarioUbicacionList() { + List ubicacionActivos = new ArrayList(); + + if (usuarioUbicacionList != null) + for (UsuarioUbicacion ubicacion : usuarioUbicacionList) + if (ubicacion.getActivo()) + ubicacionActivos.add(ubicacion); + + return ubicacionActivos; + } + + public void setUsuarioUbicacionList(List usuarioUbicacionList) { + this.usuarioUbicacionList = usuarioUbicacionList; + } + + public Date getFecContrasena() { + return fecContrasena; + } + + public void setFecContrasena(Date fecContrasena) { + this.fecContrasena = fecContrasena; + } + + public String getNombUsuarioCompleto() { + StringBuilder sNome = new StringBuilder(getNombusuario()); + if(StringUtils.isNotBlank(getNombpaterno())) { + sNome.append(" ") + .append(getNombpaterno()); + } + if(StringUtils.isNotBlank(getNombmaterno())) { + sNome.append(" ") + .append(getNombmaterno()); + } + + return sNome.toString(); + } + + public List getListClavesPermisos() { + return listClavesPermisos; + } + + public void setListClavesPermisos(List listClavesPermisos) { + this.listClavesPermisos = listClavesPermisos; + } + + @Transient + public boolean isPermisoClave(String clave) { + return listClavesPermisos != null && listClavesPermisos.contains(clave); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioBancario.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioBancario.java new file mode 100644 index 000000000..f176eedbc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioBancario.java @@ -0,0 +1,157 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "USUARIO_BANCARIO_SEQ", sequenceName = "USUARIO_BANCARIO_SEQ", allocationSize = 1) +@Table(name = "USUARIO_BANCARIO") +public class UsuarioBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_BANCARIO_SEQ") + @Column(name = "USUARIOBANCARIO_ID") + private Integer usuariobancarioId; + @Column(name = "CVEUSUARIO") + private String cveusuario; + @Column(name = "PASSWORD") + private String password; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @JoinColumn(name = "COMPANIABANCARIA_ID", referencedColumnName = "COMPANIABANCARIA_ID") + @ManyToOne(optional = false) + private CompaniaBancaria companiaBancaria; + + public UsuarioBancario() { + } + + public UsuarioBancario(Integer usuariobancarioId) { + this.usuariobancarioId = usuariobancarioId; + } + + public UsuarioBancario(Integer usuariobancarioId, Boolean activo) { + this.usuariobancarioId = usuariobancarioId; + this.activo = activo; + } + + public Integer getUsuariobancarioId() { + return usuariobancarioId; + } + + public void setUsuariobancarioId(Integer usuariobancarioId) { + this.usuariobancarioId = usuariobancarioId; + } + + public String getCveusuario() { + return cveusuario; + } + + public void setCveusuario(String cveusuario) { + this.cveusuario = cveusuario; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public CompaniaBancaria getCompaniaBancaria() { + return companiaBancaria; + } + + public void setCompaniaBancaria(CompaniaBancaria companiaBancaria) { + this.companiaBancaria = companiaBancaria; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final UsuarioBancario other = (UsuarioBancario) obj; + if ((this.cveusuario == null) ? (other.cveusuario != null) : !this.cveusuario.equals(other.cveusuario)) { + return false; + } + if ((this.password == null) ? (other.password != null) : !this.password.equals(other.password)) { + return false; + } + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 67 * hash + (this.cveusuario != null ? this.cveusuario.hashCode() : 0); + hash = 67 * hash + (this.password != null ? this.password.hashCode() : 0); + hash = 67 * hash + (this.activo != null ? this.activo.hashCode() : 0); + return hash; + } + + + + @Override + public String toString() { + return getCveusuario(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java new file mode 100644 index 000000000..d2280e4cb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java @@ -0,0 +1,151 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + + +@Entity +@SequenceGenerator(name = "USUARIO_EMPRESA_SEQ", sequenceName = "USUARIO_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "USUARIO_EMPRESA") +public class UsuarioEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_EMPRESA_SEQ") + @Basic(optional = false) + @Column(name = " USUARIOEMPRESA_ID") + private Integer usuarioEmpresaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuarioLog; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @Column(name = "INDVALIDAPREIMPRESO") + private Boolean indValidaPreimpreso; + + public UsuarioEmpresa() { + } + + public UsuarioEmpresa(Integer usuarioEmpresaId) { + this.usuarioEmpresaId = usuarioEmpresaId; + } + + + + public Integer getUsuarioEmpresaId() { + return usuarioEmpresaId; + } + + public void setUsuarioEmpresaId(Integer usuarioEmpresaId) { + this.usuarioEmpresaId = usuarioEmpresaId; + } + + + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + + + public Empresa getEmpresa() { + return empresa; + } + + + public Usuario getUsuarioLog() { + return usuarioLog; + } + + public void setUsuarioLog(Usuario usuario) { + this.usuarioLog = usuario; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndValidaPreimpreso() { + return indValidaPreimpreso; + } + + public void setIndValidaPreimpreso(Boolean indValidaPreimpreso) { + this.indValidaPreimpreso = indValidaPreimpreso; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioEmpresaId != null ? usuarioEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioEmpresa)) { + return false; + } + UsuarioEmpresa other = (UsuarioEmpresa) object; + if ((this.usuarioEmpresaId == null && other.usuarioEmpresaId != null) || (this.usuarioEmpresaId != null && !this.usuarioEmpresaId.equals(other.usuarioEmpresaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa[usuarioEmpresaId=" + usuarioEmpresaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioPerfil.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioPerfil.java new file mode 100644 index 000000000..25ee80afc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioPerfil.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "USUARIO_PERFIL_SEQ", sequenceName = "USUARIO_PERFIL_SEQ", allocationSize = 1) +@Table(name = "USUARIO_PERFIL") +public class UsuarioPerfil implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_PERFIL_SEQ") + @Column(name = "USUARIOPERFIL_ID") + private Integer usuarioperfilId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuario; + @JoinColumn(name = "PERFIL_ID", referencedColumnName = "PERFIL_ID") + @ManyToOne + private Perfil perfil; + + public UsuarioPerfil() { + } + + public UsuarioPerfil(Integer usuarioperfilId) { + this.usuarioperfilId = usuarioperfilId; + } + + public Integer getUsuarioperfilId() { + return usuarioperfilId; + } + + public void setUsuarioperfilId(Integer usuarioperfilId) { + this.usuarioperfilId = usuarioperfilId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Perfil getPerfil() { + return perfil; + } + + public void setPerfil(Perfil perfil) { + this.perfil = perfil; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioperfilId != null ? usuarioperfilId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioPerfil)) { + return false; + } + UsuarioPerfil other = (UsuarioPerfil) object; + if ((this.usuarioperfilId == null && other.usuarioperfilId != null) || (this.usuarioperfilId != null && !this.usuarioperfilId.equals(other.usuarioperfilId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.hibernate.UsuarioPerfil[usuarioperfilId=" + usuarioperfilId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioSesion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioSesion.java new file mode 100644 index 000000000..3be3ed28e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioSesion.java @@ -0,0 +1,167 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ Consultores + */ +@Entity +@SequenceGenerator(name = "USUARIO_SESION_SEQ", sequenceName = "USUARIO_SESION_SEQ", allocationSize = 1) +@Table(name = "USUARIO_SESION") +public class UsuarioSesion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SESION_SEQ") + @Basic(optional = false) + @Column(name = "USUARIOSESION_ID") + private Integer usuarioSesionId; + + @JoinColumn(name = "SISTEMA_ID", referencedColumnName = "SISTEMA_ID") + @ManyToOne + private Sistema sistema; + + @Column(name = "INDFIRMADO") + private Boolean indFirmado; + + @Column(name = "FECHORINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecHorInicio; + + @Column(name = "FECHORACTIVIDAD") + @Temporal(TemporalType.TIMESTAMP) + private Date fecHorActividad; + + @OneToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + private Usuario usuario; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + public Integer getUsuarioSesionId() { + return usuarioSesionId; + } + + public void setUsuarioSesionId(Integer usuarioSesionId) { + this.usuarioSesionId = usuarioSesionId; + } + + public Sistema getSistema() { + return sistema; + } + + public void setSistema(Sistema sistema) { + this.sistema = sistema; + } + + public Boolean getIndFirmado() { + return indFirmado; + } + + public void setIndFirmado(Boolean indFirmado) { + this.indFirmado = indFirmado; + } + + public Date getFecHorInicio() { + return fecHorInicio; + } + + public void setFecHorInicio(Date fecHorInicio) { + this.fecHorInicio = fecHorInicio; + } + + public Date getFecHorActividad() { + return fecHorActividad; + } + + public void setFecHorActividad(Date fecHorActividad) { + this.fecHorActividad = fecHorActividad; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioSesionId != null ? usuarioSesionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioSesion)) { + return false; + } + UsuarioSesion other = (UsuarioSesion) object; + if ((this.usuarioSesionId == null && other.usuarioSesionId != null) || (this.usuarioSesionId != null && !this.usuarioSesionId.equals(other.usuarioSesionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.UsuarioSesion[usuarioSesionId=" + usuarioSesionId + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioUbicacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioUbicacion.java new file mode 100644 index 000000000..aeffb5bdb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/UsuarioUbicacion.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "USUARIO_UBICACION") +@SequenceGenerator(name = "USUARIO_UBICACION_SEQ", sequenceName = "USUARIO_UBICACION_SEQ", allocationSize = 1) +public class UsuarioUbicacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_UBICACION_SEQ") + @Column(name = "USUARIOUBICACION_ID") + private Integer usuarioubicacionId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + @OneToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + private Usuario usuario; + @OneToOne + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + private Parada parada; + @OneToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + public UsuarioUbicacion() { + } + + public UsuarioUbicacion(Integer usuarioubicacionId) { + this.usuarioubicacionId = usuarioubicacionId; + } + + public Integer getUsuarioubicacionId() { + return usuarioubicacionId; + } + + public void setUsuarioubicacionId(Integer usuarioubicacionId) { + this.usuarioubicacionId = usuarioubicacionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioubicacionId != null ? usuarioubicacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioUbicacion)) { + return false; + } + UsuarioUbicacion other = (UsuarioUbicacion) object; + if ((this.usuarioubicacionId == null && other.usuarioubicacionId != null) || (this.usuarioubicacionId != null && !this.usuarioubicacionId.equals(other.usuarioubicacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion[usuarioubicacionId=" + usuarioubicacionId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/VendaPacote.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/VendaPacote.java new file mode 100644 index 000000000..6b4fbb180 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/VendaPacote.java @@ -0,0 +1,202 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Where; + +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; + +@Entity +@Table(name = "VENDA_PACOTE") +@SequenceGenerator(name = "VENDA_PACOTE_SEQ", sequenceName = "VENDA_PACOTE_SEQ", allocationSize = 1) +public class VendaPacote implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "VENDA_PACOTE_SEQ") + @Column(name = "VENDAPACOTE_ID") + private Long vendapacoteId; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "DATAVENDA") + private Date datavenda; + + @Temporal(TemporalType.DATE) + @Column(name = "DATAPACOTE") + private Date datapacote; + + @Column(name = "NUMOPERACION") + private String numoperacion; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PACOTE_ID") + private Pacote pacote; + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "vendaPacote") + @Where(clause = "activo=1") + private List enderecoApanhes; + + @Column(name = "INDCANCELADO") + private Boolean indcancelado; + + @Temporal(TemporalType.DATE) + @Column(name = "DATACANCELAMENTO") + private Date datacancelamento; + + @Column(name = "USUARIO_CANCELAMENTO_ID") + private Integer usuarioCancelamentoId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @Column(name = "SUBTOTAL") + private BigDecimal subtotal; + + @Column(name = "DESCONTO") + private BigDecimal desconto; + + @Column(name = "TOTAL") + private BigDecimal total; + + @ManyToOne + @JoinColumn(name = "CLIENTEPACOTE_ID") + private ClientePacote clientePacote; + + @Column(name = "MOTIVOCANCELVENDAPACOTE_ID") + private Integer motivoCancelVendaPacoteId; + + @Column(name = "SITUACAO") + private SituacaoVendaPacote situacao; + + @Column(name = "DATA_CONFIRMACAO_RESERVA") + private Date dataConfirmacaoReserva; + + @Column(name = "USUARIO_CONFIRMACAO_RESERVA_ID") + private Long usuarioConfirmacaoReserva; + + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + public Date getDatavenda() { + return datavenda; + } + + public void setDatavenda(Date datavenda) { + this.datavenda = datavenda; + } + + public Date getDatapacote() { + return datapacote; + } + + public void setDatapacote(Date datapacote) { + this.datapacote = datapacote; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public Boolean getIndcancelado() { + return indcancelado; + } + + public void setIndcancelado(Boolean indcancelado) { + this.indcancelado = indcancelado; + } + + public Date getDatacancelamento() { + return datacancelamento; + } + + public void setDatacancelamento(Date datacancelamento) { + this.datacancelamento = datacancelamento; + } + + public Integer getUsuarioCancelamentoId() { + return usuarioCancelamentoId; + } + + public void setUsuarioCancelamentoId(Integer usuarioCancelamentoId) { + this.usuarioCancelamentoId = usuarioCancelamentoId; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + public BigDecimal getDesconto() { + return desconto; + } + + public void setDesconto(BigDecimal desconto) { + this.desconto = desconto; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public List getEnderecoApanhes() { + return enderecoApanhes; + } + + public void setEnderecoApanhes(List enderecoApanhes) { + this.enderecoApanhes = enderecoApanhes; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Via.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Via.java new file mode 100644 index 000000000..735e7c394 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Via.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "VIA_SEQ", sequenceName = "VIA_SEQ", allocationSize = 1) +@Table(name = "VIA") +public class Via implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "VIA_SEQ") + @Basic(optional = false) + @Column(name = "VIA_ID") + private Integer viaId; + @Column(name = "NOMBVIA") + private String nombvia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "via") + private List tramoList; + + public Via() { + } + + public Via(Integer viaId) { + this.viaId = viaId; + } + + public Integer getViaId() { + return viaId; + } + + public void setViaId(Integer viaId) { + this.viaId = viaId; + } + + public String getNombvia() { + return nombvia; + } + + public void setNombvia(String nombvia) { + this.nombvia = nombvia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTramoList() { + return tramoList; + } + + public void setTramoList(List tramoList) { + this.tramoList = tramoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (viaId != null ? viaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Via)) { + return false; + } + Via other = (Via) object; + if ((this.viaId == null && other.viaId != null) || (this.viaId != null && !this.viaId.equals(other.viaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombvia(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/VigenciaTarifa.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/VigenciaTarifa.java new file mode 100644 index 000000000..f21b0f9cc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/VigenciaTarifa.java @@ -0,0 +1,154 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "VIGENCIA_TARIFA_SEQ", sequenceName = "VIGENCIA_TARIFA_SEQ", allocationSize = 1) +@Table(name = "VIGENCIA_TARIFA") +public class VigenciaTarifa implements Serializable { + + @OneToMany(mappedBy = "vigenciaTarifa") + private List tarifaHistList; + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "VIGENCIA_TARIFA_SEQ") + @Basic(optional = false) + @Column(name = "VIGENCIATARIFA_ID") + private Integer vigenciatarifaId; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecfinvigencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECHABILITACIONVENTA") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fechabilitacionventa; + + public VigenciaTarifa() { + } + + public VigenciaTarifa(Integer vigenciatarifaId) { + this.vigenciatarifaId = vigenciatarifaId; + } + + public Integer getVigenciatarifaId() { + return vigenciatarifaId; + } + + public void setVigenciatarifaId(Integer vigenciatarifaId) { + this.vigenciatarifaId = vigenciatarifaId; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public java.util.Date getFechabilitacionventa() { + return fechabilitacionventa; + } + + public void setFechabilitacionventa(java.util.Date fechabilitacionventa) { + this.fechabilitacionventa = fechabilitacionventa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (vigenciatarifaId != null ? vigenciatarifaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof VigenciaTarifa)) { + return false; + } + VigenciaTarifa other = (VigenciaTarifa) object; + if ((this.vigenciatarifaId == null && other.vigenciatarifaId != null) || (this.vigenciatarifaId != null && !this.vigenciatarifaId.equals(other.vigenciatarifaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy HH:mm"); + + return f.format(feciniciovigencia) + " - " + f.format(fecfinvigencia); + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Zona.java b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Zona.java new file mode 100644 index 000000000..a9c59a26a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/entidad/Zona.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "ZONA_SEQ", sequenceName = "ZONA_SEQ", allocationSize=1) +@Table(name = "ZONA") +public class Zona implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ZONA_SEQ") + @Column(name = "ZONA_ID") + private Integer zonaId; + @Column(name = "DESCZONA") + private String desczona; + @Column(name = "ACTIVO") + private Short activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "zona") + private List corridaList; + + public Zona() { + } + + public Zona(Integer zonaId) { + this.zonaId = zonaId; + } + + public Integer getZonaId() { + return zonaId; + } + + public void setZonaId(Integer zonaId) { + this.zonaId = zonaId; + } + + public String getDesczona() { + return desczona; + } + + public void setDesczona(String desczona) { + this.desczona = desczona; + } + + public Short getActivo() { + return activo; + } + + public void setActivo(Short activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (zonaId != null ? zonaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Zona)) { + return false; + } + Zona other = (Zona) object; + if ((this.zonaId == null && other.zonaId != null) || (this.zonaId != null && !this.zonaId.equals(other.zonaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Zona[zonaId=" + zonaId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/IndStatusBoleto.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/IndStatusBoleto.java new file mode 100644 index 000000000..41517f347 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/IndStatusBoleto.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum IndStatusBoleto { + + V("VENDIDO", "V"), + C("CANCELADO", "C"), + T("TRANSFERIDO", "T"), + E("ENTREGUE", "E"), + S("RESERVADO", "S"), + X("EXTRAVIADO", "X"), + R("REIMPRESSO", "R"), + M("MARCADO", "M"); + + private String value; + private String shortValue; + + private IndStatusBoleto(String value, String shortValue) { + this.value = value; + this.shortValue = shortValue; + } + + public String getValue() { + return value; + } + + public String getShortValue() { + return shortValue; + } + + public static IndStatusBoleto getIndStatusBoleto(String shortValue) { + if(V.getShortValue().equals(shortValue)) { + return V; + } else if(C.getShortValue().equals(shortValue)) { + return C; + } else if(T.getShortValue().equals(shortValue)) { + return T; + } else if(E.getShortValue().equals(shortValue)) { + return E; + } else if(S.getShortValue().equals(shortValue)) { + return S; + } else if(X.getShortValue().equals(shortValue)) { + return X; + } else if(R.getShortValue().equals(shortValue)) { + return R; + } else if(M.getShortValue().equals(shortValue)) { + return M; + } + + return null; + } + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/LocalEnderecoApanhe.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/LocalEnderecoApanhe.java new file mode 100644 index 000000000..e8f4996e4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/LocalEnderecoApanhe.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum LocalEnderecoApanhe { + + APANHE_EM_CASA(0,"Apanhe em Casa"), + HOTEL(1,"Hotel"), + NENHUM(2,"Nenhum"), + REGIAO_METROPOLITANA(3,"Região Metropolitana"); + + private Integer valor; + private String descricao; + + private LocalEnderecoApanhe(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return this.valor; + } + + @Override + public String toString() { + return this.descricao; + } + + public static LocalEnderecoApanhe getLocalEnderecoApanhe(Integer valor) { + if(APANHE_EM_CASA.getValor().equals(valor)) { + return APANHE_EM_CASA; + } else if(HOTEL.getValor().equals(valor)) { + return HOTEL; + } else if(NENHUM.getValor().equals(valor)) { + return NENHUM; + } else if(REGIAO_METROPOLITANA.getValor().equals(valor)) { + return REGIAO_METROPOLITANA; + } + return null; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/MimeType.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/MimeType.java new file mode 100644 index 000000000..0c99dfec8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/MimeType.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum MimeType { + + PDF("application/pdf"), + XLS("application/vnd.ms-excel"), + DOC("application/msword"), + TXT("text/plain"), + ZIP("application/zip, application/x-compressed-zip"); + + private String descricao; + + private MimeType(String descricao) { + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/SituacaoVendaPacote.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/SituacaoVendaPacote.java new file mode 100644 index 000000000..f23b09067 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/SituacaoVendaPacote.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum SituacaoVendaPacote { + + PAGO("Pago"), + RESERVA("Reserva"), + CANCELADO("Cancelado"); + + private String descricao; + + private SituacaoVendaPacote(String descricao) { + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + + public static SituacaoVendaPacote getSituacaoVendaPacote(Integer value) { + switch (value) { + case 0: + return PAGO; + case 1: + return RESERVA; + case 2: + return CANCELADO; + default: + return null; + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/TipoPessoa.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/TipoPessoa.java new file mode 100644 index 000000000..95f12ca8a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/TipoPessoa.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoPessoa { + + FISICA(0,"Pessoa Física"), + JURIDICA(1, "Pessoa Jurídica"); + + private Integer valor; + private String descricao; + + private TipoPessoa(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return this.valor; + } + + @Override + public String toString() { + return this.descricao; + } + + public static TipoPessoa getTipoPessoa(Integer tipoPessoa) { + if(FISICA.getValor().equals(tipoPessoa)) { + return FISICA; + } else if(JURIDICA.getValor().equals(tipoPessoa)) { + return JURIDICA; + } + return null; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/BoletoStatusComissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/BoletoStatusComissao.java new file mode 100644 index 000000000..1d8244773 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/BoletoStatusComissao.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum BoletoStatusComissao { + + BOLETOS_VENDIDOS, + BOLETO_CANCELADO, + BOLETO_DEVOLVIDO, + BOLETO_DEVOLVIDO_TROCADO, + BOLETO_DEVOLVIDO_TRANSFERIDO, + BOLETO_DEVOLVIDO_OCD, + BOLETO_MANUAL, + GAP_VENDIDOS, + GAP_CANCELADO, + GAP_DEVOLVIDO; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/CoresConferencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/CoresConferencia.java new file mode 100644 index 000000000..79724aa6b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/CoresConferencia.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum CoresConferencia { + + AMARELO("/gui/img/comissao/amarelo.png"), + AZUL("/gui/img/comissao/azul.png"), + PRETO("/gui/img/comissao/preto.png"), + BRANCO("/gui/img/comissao/branco.png"), + LARANJA("/gui/img/comissao/laranja.png"), + VERMELHO("/gui/img/comissao/vermelho.png"); + + private String url; + + private CoresConferencia(String url) { + this.url = url; + } + + public String getUrl() { + return url; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/StatusLogConferencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/StatusLogConferencia.java new file mode 100644 index 000000000..08ef9627c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/StatusLogConferencia.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum StatusLogConferencia { + + CONFERIDO(0,"CONFERIDO"), + PENDENCIA(1,"PENDÊNCIA"); + + private String descricao; + private Integer value; + + private StatusLogConferencia(Integer value, String descricao) { + this.value = value; + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + + public static StatusLogConferencia getStatusLogConferencia(Integer value) { + if(value == CONFERIDO.value) { + return CONFERIDO; + } else if(value == PENDENCIA.value) { + return PENDENCIA; + } + return null; + } + + public Integer getValue() { + return value; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/TipoLogConferencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/TipoLogConferencia.java new file mode 100644 index 000000000..02903e762 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/enums/comissao/TipoLogConferencia.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum TipoLogConferencia { + + BOLETO(0, "Bilhete"), + EVENTO_FINANCEIRO(1, "Evento Financeiro"), + OCD(2, "OCD"), + AVULSO(3, "Avulso"); + + private String descricao; + private Integer value; + + private TipoLogConferencia(Integer value, String descricao) { + this.value = value; + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + + public static TipoLogConferencia getTipoLogConferencia(Integer value) { + if(value == BOLETO.value) { + return BOLETO; + } else if(value == EVENTO_FINANCEIRO.value) { + return EVENTO_FINANCEIRO; + } else if(value == OCD.value) { + return OCD; + } else if(value == AVULSO.value) { + return AVULSO; + } + return null; + } + + public Integer getValue() { + return value; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/BusinessException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/BusinessException.java new file mode 100644 index 000000000..dd665690a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/BusinessException.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +import org.zkoss.util.resource.Labels; + +public class BusinessException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + /** + * + * @param message + * - La clave del archivo de traducción + */ + public BusinessException(String message) { + super(Labels.getLabel(message)); + } + + public BusinessException(String message, Boolean label) { + super(message); + } + + /** + * + * @param message- La clave del archivo de traducción + * @param oMsg - Los parametros de la mensage + */ + public BusinessException(String message,Object oMsg) { + super(new MessageFormat(Labels.getLabel(message)).format(oMsg)); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/ComissaoException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/ComissaoException.java new file mode 100644 index 000000000..b4e9a1411 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/ComissaoException.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +import org.zkoss.util.resource.Labels; + +public class ComissaoException extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * + * @param message + * - La clave del archivo de traducción + */ + public ComissaoException(String message) { + super(Labels.getLabel(message)); + } + + /** + * + * @param message- + * La clave del archivo de traducción + * @param oMsg + * - Los parametros de la mensage + */ + public ComissaoException(String message, Object oMsg) { + super(new MessageFormat(Labels.getLabel(message)).format(oMsg)); + } + + public ComissaoException(String message, Object oMsg, Object... parametros) { + super(new MessageFormat(Labels.getLabel(message, parametros)).format(oMsg)); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/IntegracionException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/IntegracionException.java new file mode 100644 index 000000000..854f2b491 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/IntegracionException.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +public class IntegracionException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * + * @param message + * - La clave del archivo de traducción + */ + public IntegracionException(String message) { + super(message); + } + + /** + * + * @param message + * - La clave del archivo de traducción + * @param oMsg + * - Los parametros de la mensage + */ + public IntegracionException(String message, Object oMsg) { + super(new MessageFormat(message).format(oMsg)); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/ValidacionCampoException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/ValidacionCampoException.java new file mode 100644 index 000000000..814f46172 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/ValidacionCampoException.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +import org.zkoss.util.resource.Labels; + +public class ValidacionCampoException extends Exception { + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * + * @param message + * - La clave del archivo de traducción + */ + public ValidacionCampoException(String message) { + super(Labels.getLabel(message)); + } + + /** + * + * @param message + * - La clave del archivo de traducción + * @param oMsg + * - Los parametros de la mensage + */ + public ValidacionCampoException(String message, Object oMsg) { + super(new MessageFormat(Labels.getLabel(message)).format(oMsg)); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoException.java new file mode 100644 index 000000000..9f0b9d4b5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaBoletoException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaBoletoException(String message) { + super(message); + } + + public VendaEmbarcadaBoletoException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaBoletoException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoFormapagoException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoFormapagoException.java new file mode 100644 index 000000000..9cb4e1c6b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoFormapagoException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaBoletoFormapagoException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaBoletoFormapagoException(String message) { + super(message); + } + + public VendaEmbarcadaBoletoFormapagoException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaBoletoFormapagoException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaException.java new file mode 100644 index 000000000..a8aac1755 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaCajaException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaCajaException(String message) { + super(message); + } + + public VendaEmbarcadaCajaException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaCajaException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaFormapagoException.java b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaFormapagoException.java new file mode 100644 index 000000000..292d74544 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaFormapagoException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaCajaFormapagoException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaCajaFormapagoException(String message) { + super(message); + } + + public VendaEmbarcadaCajaFormapagoException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaCajaFormapagoException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/MovimentoLinha.java b/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/MovimentoLinha.java new file mode 100644 index 000000000..1fad500e7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/MovimentoLinha.java @@ -0,0 +1,82 @@ +package com.rjconsultores.ventaboletos.relatorios; + +public class MovimentoLinha { + private String antt; + private String prefixo; + private Integer mes; + private Integer ano; + private Integer viagensIda; + private Integer viagensVolta; + private Integer lugaresIda; + private Integer lugaresVolta; + + public String getAntt() { + return antt; + } + + public void setAntt(String antt) { + this.antt = antt; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public Integer getMes() { + return mes; + } + + public void setMes(Integer mes) { + this.mes = mes; + } + + public Integer getAno() { + return ano; + } + + public void setAno(Integer ano) { + this.ano = ano; + } + + public Integer getViagensIda() { + return viagensIda; + } + + public void setViagensIda(Integer viagensIda) { + this.viagensIda = viagensIda; + } + + public Integer getViagensVolta() { + return viagensVolta; + } + + public void setViagensVolta(Integer viagensVolta) { + this.viagensVolta = viagensVolta; + } + + public Integer getLugaresIda() { + return lugaresIda; + } + + public void setLugaresIda(Integer lugaresIda) { + this.lugaresIda = lugaresIda; + } + + public Integer getLugaresVolta() { + return lugaresVolta; + } + + public void setLugaresVolta(Integer lugaresVolta) { + this.lugaresVolta = lugaresVolta; + } + + @Override + public String toString() { + return antt + ";" + prefixo + ";" + mes + ";" + ano + ";" + viagensIda + ";" + viagensVolta + ";" + lugaresIda + ";" + lugaresVolta; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/MovimentoSecoes.java b/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/MovimentoSecoes.java new file mode 100644 index 000000000..e174fefb6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/MovimentoSecoes.java @@ -0,0 +1,137 @@ +package com.rjconsultores.ventaboletos.relatorios; + +public class MovimentoSecoes { + + private String antt; + private String prefixo; + private Integer mes; + private Integer ano; + private String localOrigem; + private String localDestino; + private Integer passageirosIda; + private Integer passageirosVolta; + private Integer gratuidadePasseLivreIda; + private Integer gratuidadePasseLivreVolta; + private Integer gratuidadeIdosoIda; + private Integer gratuidadeIdosoVolta; + private Integer descontoIdosoIda; + private Integer descontoIdosoVolta; + + public String getAntt() { + return antt; + } + + public void setAntt(String antt) { + this.antt = antt; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public Integer getMes() { + return mes; + } + + public void setMes(Integer mes) { + this.mes = mes; + } + + public Integer getAno() { + return ano; + } + + public void setAno(Integer ano) { + this.ano = ano; + } + + public String getLocalOrigem() { + return localOrigem; + } + + public void setLocalOrigem(String localOrigem) { + this.localOrigem = localOrigem; + } + + public String getLocalDestino() { + return localDestino; + } + + public void setLocalDestino(String localDestino) { + this.localDestino = localDestino; + } + + public Integer getPassageirosIda() { + return passageirosIda; + } + + public void setPassageirosIda(Integer passageirosIda) { + this.passageirosIda = passageirosIda; + } + + public Integer getPassageirosVolta() { + return passageirosVolta; + } + + public void setPassageirosVolta(Integer passageirosVolta) { + this.passageirosVolta = passageirosVolta; + } + + public Integer getGratuidadePasseLivreIda() { + return gratuidadePasseLivreIda; + } + + public void setGratuidadePasseLivreIda(Integer gratuidadePasseLivreIda) { + this.gratuidadePasseLivreIda = gratuidadePasseLivreIda; + } + + public Integer getGratuidadePasseLivreVolta() { + return gratuidadePasseLivreVolta; + } + + public void setGratuidadePasseLivreVolta(Integer gratuidadePasseLivreVolta) { + this.gratuidadePasseLivreVolta = gratuidadePasseLivreVolta; + } + + public Integer getGratuidadeIdosoIda() { + return gratuidadeIdosoIda; + } + + public void setGratuidadeIdosoIda(Integer gratuidadeIdosoIda) { + this.gratuidadeIdosoIda = gratuidadeIdosoIda; + } + + public Integer getGratuidadeIdosoVolta() { + return gratuidadeIdosoVolta; + } + + public void setGratuidadeIdosoVolta(Integer gratuidadeIdosoVolta) { + this.gratuidadeIdosoVolta = gratuidadeIdosoVolta; + } + + public Integer getDescontoIdosoIda() { + return descontoIdosoIda; + } + + public void setDescontoIdosoIda(Integer descontoIdosoIda) { + this.descontoIdosoIda = descontoIdosoIda; + } + + public Integer getDescontoIdosoVolta() { + return descontoIdosoVolta; + } + + public void setDescontoIdosoVolta(Integer descontoIdosoVolta) { + this.descontoIdosoVolta = descontoIdosoVolta; + } + + @Override + public String toString() { + return antt + ";" + prefixo + ";" + localOrigem + ";" + localDestino + ";" + mes + ";" + ano + ";" + passageirosIda + ";" + passageirosVolta + ";" + gratuidadePasseLivreIda + ";" + gratuidadePasseLivreVolta + ";" + gratuidadeIdosoIda + ";" + gratuidadeIdosoVolta + ";" + descontoIdosoIda + ";" + descontoIdosoVolta; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/PrefixoAntt.java b/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/PrefixoAntt.java new file mode 100644 index 000000000..969f9e907 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/relatorios/PrefixoAntt.java @@ -0,0 +1,84 @@ +package com.rjconsultores.ventaboletos.relatorios; + +public class PrefixoAntt { + private String antt; + private String prefixo; + private String localOrigem; + private String localDestino; + + public String getAntt() { + return antt; + } + + public void setAntt(String antt) { + this.antt = antt; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getLocalOrigem() { + return localOrigem; + } + + public void setLocalOrigem(String localOrigem) { + this.localOrigem = localOrigem; + } + + public String getLocalDestino() { + return localDestino; + } + + public void setLocalDestino(String localDestino) { + this.localDestino = localDestino; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((antt == null) ? 0 : antt.hashCode()); + result = prime * result + ((localDestino == null) ? 0 : localDestino.hashCode()); + result = prime * result + ((localOrigem == null) ? 0 : localOrigem.hashCode()); + result = prime * result + ((prefixo == null) ? 0 : prefixo.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PrefixoAntt other = (PrefixoAntt) obj; + if (antt == null) { + if (other.antt != null) + return false; + } else if (!antt.equals(other.antt)) + return false; + if (localDestino == null) { + if (other.localDestino != null) + return false; + } else if (!localDestino.equals(other.localDestino)) + return false; + if (localOrigem == null) { + if (other.localOrigem != null) + return false; + } else if (!localOrigem.equals(other.localOrigem)) + return false; + if (prefixo == null) { + if (other.prefixo != null) + return false; + } else if (!prefixo.equals(other.prefixo)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoBoletoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoBoletoService.java new file mode 100644 index 000000000..5f06816a2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoBoletoService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; + +public interface AbastoBoletoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java new file mode 100644 index 000000000..1135f51bf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; + + +public interface AbastoCentralService extends GenericService { + + public List buscaBilhetesPorAidf(Aidf aidf); + public void borrarLosQueTienenAIDF(Aidf aidf); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java new file mode 100644 index 000000000..979d3263f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; + +public interface AbastoHistoService extends GenericService { + public void borrarLosQueTienenAIDF(Aidf aidf); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AidfService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AidfService.java new file mode 100644 index 000000000..81cb36f1f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AidfService.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.service; + +import java.sql.Connection; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +public interface AidfService { + + public List obtenerTodos(); + public Aidf obtenerID(Long id); + public Aidf suscribir(Aidf entidad); + public Aidf actualizacion(Aidf entidad); + public void borrar(Aidf entidad); + + public List obtenerTodosAdifEspecie(); + public List obtenerTodosAdifTipo(); + public List buscaAidfsPorEmpresas(List empresas); + public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn); + public List obtenerAidfFromSerieDocfiscal(String serie,String docfiscal, Connection conn); + public Boolean validarDocFiscalPorEstado(Long idAidf, String docFiscal, Estado estado); + public Boolean validarTipoVenda(String tipoVenda, String serie, Integer idTipo); + public Boolean validarVendaManual(Integer idTipo, String serie); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AjusteEventoExtraService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AjusteEventoExtraService.java new file mode 100644 index 000000000..44c132a1f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AjusteEventoExtraService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; + +public interface AjusteEventoExtraService extends + GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AlertaCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AlertaCtrlService.java new file mode 100644 index 000000000..d907fe2e6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AlertaCtrlService.java @@ -0,0 +1,35 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AlertaCtrlService { + + public List obtenerTodos(); + + public AlertaCtrl obtenerID(Integer id); + + public AlertaCtrl suscribirActualizar(AlertaCtrl entidad) throws BusinessException; + + public void borrar(AlertaCtrl entidad); + + public List buscar(Parada origem, Parada destino, Ruta ruta, ClaseServicio claseServicio, Integer tiempoAlta, Integer tiempoBaja, BigDecimal percAlta, + BigDecimal percBaja); + + public List buscarCorrida(Corrida corrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AliasServicoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AliasServicoService.java new file mode 100644 index 000000000..0eabd13ca --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AliasServicoService.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface AliasServicoService{ + + public List obtenerTodos(); + + public AliasServico obtenerID(Integer id); + + public AliasServico suscribirActualizar(AliasServico entidad) throws BusinessException; + + public void borrar(AliasServico entidad); + + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo); + + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ArticuloService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ArticuloService.java new file mode 100644 index 000000000..cb40d4ad4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ArticuloService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Articulo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ArticuloService extends GenericService { + + public List buscar(String descarticulo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java new file mode 100644 index 000000000..e932896fa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; + +/** + * + * @author rodrigo + */ +public interface AsientoExclusivoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java new file mode 100644 index 000000000..f7e38687e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +public interface AutobusDocService extends GenericService { + public List obtenerPorAutobus(Autobus autobus); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AutobusService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutobusService.java new file mode 100644 index 000000000..e625abace --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutobusService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutobusService extends GenericService { + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizaFolioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizaFolioService.java new file mode 100644 index 000000000..ac879b831 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizaFolioService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface AutorizaFolioService { + + public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa, Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion); + + public String noChequeFolioPreimpresos(EstacionImpresora estacionImpresora, boolean isImpressoraFiscal); + + public void devolverFoliosAutomaticosImpressoraFiscal(EstacionImpresora ei); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizacionPerfilService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizacionPerfilService.java new file mode 100644 index 000000000..f0af6782b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizacionPerfilService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionPerfilService extends GenericService { + + public List buscar(Autorizacion autorizacion, Perfil perfil); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizacionService.java new file mode 100644 index 000000000..792bc420f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/AutorizacionService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionService extends GenericService { + + public List buscar(String nombautorizacion, String descautorizacion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/BancoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/BancoService.java new file mode 100644 index 000000000..de2ff14c2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/BancoService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Banco; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface BancoService extends GenericService{ + + public List buscar(Banco banco); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java new file mode 100644 index 000000000..31729f55f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public interface CalcularPeajeService { + public List buscarCasetasPeajeWithinTramo(Ruta ruta); + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc); + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CalculoComissaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CalculoComissaoService.java new file mode 100644 index 000000000..dd35e9e9d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CalculoComissaoService.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.ComissaoException; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo; + +public interface CalculoComissaoService { + + public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException; + + public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException; + + public void cancelarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException; + + public List relatorioCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException; + + public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException; + + public void cancelarCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException; + + public List relatorioReciboComissao(Integer puntoVentaId, Integer empresaId, String competencia) throws ComissaoException; + + public void enviarEmailReciboComissao(HistoricoComissao historicoComissao, byte[] recibo); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CancelacionCargoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CancelacionCargoService.java new file mode 100644 index 000000000..419919929 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CancelacionCargoService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; + +/** + * + * @author Rafius + */ +public interface CancelacionCargoService extends GenericService{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CancelacionCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CancelacionCtrlService.java new file mode 100644 index 000000000..8e629fcc8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CancelacionCtrlService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CancelacionCtrlService extends GenericService{ + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, Parada paradaDestino, Marca marca); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CasetaPeajeService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CasetaPeajeService.java new file mode 100644 index 000000000..219faba82 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CasetaPeajeService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; + +public interface CasetaPeajeService extends GenericService { + public List buscar(String descricaoPracaPedagio); + public Boolean validarDescricaoCasetaPeaje(CasetaPeaje casetaPeaje); + public List buscarTodosOrdenadoPorDescricao(); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaClaseService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaClaseService.java new file mode 100644 index 000000000..f0562a709 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaClaseService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaClaseService extends GenericService { + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaCorridaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaCorridaService.java new file mode 100644 index 000000000..e2c9fd2fb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaCorridaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCorridaService extends GenericService { + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java new file mode 100644 index 000000000..fd5a87615 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCtrlService { + + public CategoriaCtrl obtenerID(Integer id); + + public CategoriaCtrl suscribir(CategoriaCtrl entidad); + + public CategoriaCtrl actualizacion(CategoriaCtrl entidad); + + public void borrar(CategoriaCtrl entidad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaDescuentoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaDescuentoService.java new file mode 100644 index 000000000..3095b0ea0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaDescuentoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; + +/** + * + * @author Administrador + */ +public interface CategoriaDescuentoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaMarcaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaMarcaService.java new file mode 100644 index 000000000..83c028568 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaMarcaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; + +/** + * + * @author Administrador + */ +public interface CategoriaMarcaService extends GenericService { + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaMercadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaMercadoService.java new file mode 100644 index 000000000..5cc312922 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaMercadoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; + +/** + * + * @author Administrador + */ +public interface CategoriaMercadoService extends GenericService { + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaOrgaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaOrgaoService.java new file mode 100644 index 000000000..2c5d95716 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaOrgaoService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; + +public interface CategoriaOrgaoService extends GenericService { + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaPeriodoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaPeriodoService.java new file mode 100644 index 000000000..5f7c32179 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaPeriodoService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface CategoriaPeriodoService extends GenericService { + + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo); + + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaService.java new file mode 100644 index 000000000..1a5d28485 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; + +/** + * + * @author Administrador + */ +public interface CategoriaService extends GenericService { + + public List buscar(String desccategoria); + + /** + * Hance una búsqueda de todas las categorias que son visibles al usuario Ejemplo de categorias que no son vis + * + * @return + */ + public List obtenerTodasCategoriasVisibles(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaTipoPtoVtaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaTipoPtoVtaService.java new file mode 100644 index 000000000..18b8a3917 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CategoriaTipoPtoVtaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface CategoriaTipoPtoVtaService extends + GenericService { + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta); + + public void borrarFisico(CategoriaTipoPtoVta cd); + } diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CiudadService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CiudadService.java new file mode 100644 index 000000000..3292b34a9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CiudadService.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; + +/** + * + * @author MCosso + */ +public interface CiudadService extends GenericService { + + public List buscar(String nombciudad, Estado estado, Plaza plaza); + + public List buscaLike(String strCiudad); + + public List buscaCodMun(Integer codMun, Estado estado); + + public List buscarPorEstado(Estado estado); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ClaseServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClaseServicioService.java new file mode 100644 index 000000000..0930f69ad --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClaseServicioService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClaseServicioService extends GenericService { + + public List buscarPorNome(String nomeClaseServicio); + + public List buscarTodosExceto(Integer ... idClase); + + public List buscarPorEmpresasDoUsuario (List empresasUsuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ClaseservicioEquivalenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClaseservicioEquivalenciaService.java new file mode 100644 index 000000000..e2c1748a1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClaseservicioEquivalenciaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClaseservicioEquivalenciaService + extends GenericService { + + public List buscar(ClaseServicio parada, ComisionistaExterno comisionistaExterno); + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteCursoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteCursoService.java new file mode 100644 index 000000000..f6f33420d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteCursoService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; + +public interface ClienteCursoService extends GenericService { + + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteDescuentoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteDescuentoService.java new file mode 100644 index 000000000..f85c2bcc4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteDescuentoService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; + +public interface ClienteDescuentoService extends GenericService{ + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteDireccionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteDireccionService.java new file mode 100644 index 000000000..3c9daf920 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteDireccionService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; + + + + +public interface ClienteDireccionService extends GenericService { + + public List buscar(Integer clienteId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteService.java new file mode 100644 index 000000000..1197be07f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ClienteService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ClienteService extends GenericService { + + public List buscar(String numCliente); + + public Cliente buscarPorNumeroFidelidade(Integer numeroFidelidade, Empresa empresa); + + public List buscarPorDocumento(String documento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CoeficienteTarifaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CoeficienteTarifaService.java new file mode 100644 index 000000000..8a69a2a78 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CoeficienteTarifaService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +public interface CoeficienteTarifaService { + + public List obtenerTodos(); + + public CoeficienteTarifa obtenerID(Integer id); + + public CoeficienteTarifa suscribir(CoeficienteTarifa entidad); + + public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad); + + public void borrar(CoeficienteTarifa entidad) throws RegistroConDependenciaException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ColoniaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ColoniaService.java new file mode 100644 index 000000000..a63e11d5c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ColoniaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; + +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ColoniaService extends GenericService { + + public List buscar(String desccolonia); + public List buscarPorCiudad(Ciudad ciudad); + public List buscaLike(String desccolonia); + public List buscarPorCodMun(Ciudad ciudad, String desccolonia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ComisionistaExternoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ComisionistaExternoService.java new file mode 100644 index 000000000..d7cd83b2e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ComisionistaExternoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ComisionistaExternoService extends GenericService { + + public List buscar(String desccomisionista); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ComissaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ComissaoService.java new file mode 100644 index 000000000..ae66dd04a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ComissaoService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +public interface ComissaoService extends GenericService { + + public List buscaHistoricoComissao(Integer puntoVentaId, Integer empresaId, Date periodoInicio, Date periodoFim); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CompaniaBancariaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CompaniaBancariaService.java new file mode 100644 index 000000000..4d5576ab2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CompaniaBancariaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CompaniaBancariaService extends GenericService { + + public List buscar(CompaniaBancaria companiaBancaria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConductorService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConductorService.java new file mode 100644 index 000000000..5b2022ab5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConductorService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Conductor; + +/** + * + * @author Administrador + */ +public interface ConductorService extends GenericService { + + public Conductor buscar(String claveConductor, String contraSenha); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionConfService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionConfService.java new file mode 100644 index 000000000..5d48b7f87 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionConfService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionConfService extends GenericService { + + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo); + + public List buscarPorConexionCtrl(ConexionCtrl entidad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java new file mode 100644 index 000000000..c8a5c70cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionCtrlService extends GenericService { + + public List buscarConexionesCtrl(Integer origenId, Integer destinoId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionRutaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionRutaService.java new file mode 100644 index 000000000..74a88202c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionRutaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; + +public interface ConexionExcepcionRutaService extends GenericService { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionService.java new file mode 100644 index 000000000..cc2445353 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; + +public interface ConexionExcepcionService extends GenericService { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionService.java new file mode 100644 index 000000000..2343b77d2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConexionService.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +public interface ConexionService { + + /** + * Gera as conexões possíveis para os tramos do sistema + * + */ + public void gerarConexiones(); + + public List buscarConexiones(Integer origenId, Integer destinoId); + + public Conexion suscribir(Conexion conexion); + + public Conexion actualizacion(Conexion conexion); + + public void borrar(Conexion conexion); + + public List buscarPorConexionCtrl(Long conexcionCtrlId); + + public List buscarConexionesValidas(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java new file mode 100644 index 000000000..2186bc9b1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface ConfRestricaoCanalVentaService{ + + public ConfRestricaoCanalVenta obtenerID(Integer id); + + public void borrar(ConfRestricaoCanalVenta entidad); + + public ConfRestricaoCanalVenta suscribirActualizar(ConfRestricaoCanalVenta entidad) throws BusinessException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoExcecaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoExcecaoService.java new file mode 100644 index 000000000..30bdab0cb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoExcecaoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; + +public interface ConfRestricaoExcecaoService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoPtovtaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoPtovtaService.java new file mode 100644 index 000000000..1ec043b1c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfRestricaoPtovtaService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; + +public interface ConfRestricaoPtovtaService extends GenericService { + + public ConfRestricaoPtovta obtenerPtovtaTodos(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConferenciaComissaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConferenciaComissaoService.java new file mode 100644 index 000000000..a4d9dceaa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConferenciaComissaoService.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EtiquetaMalote; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; +import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao; + +public interface ConferenciaComissaoService extends GenericService { + + public Conferencia suscribirOrActualizacion(Conferencia entidad); + + public List carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException; + + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public List carregarEventosFinanceiros(Conferencia conferencia) throws BusinessException; + + public List carregarLogConferencia(Conferencia conferencia) throws BusinessException; + + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId); + + public List carregarBilhetesComissao(List boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException; + + public List carregarOcds(Conferencia conferencia) throws BusinessException; + + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException; + + public boolean isBilhetesSemConferencia(List lsBoletoComissao) throws BusinessException; + + public boolean isEventosFinanceirosSemConferencia(List lsEventosFinanceiros) throws BusinessException; + + public boolean isOcdSemConferencia(List lsOcd) throws BusinessException; + + public BigDecimal totalizarBoletoComissao(List lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException; + + public BigDecimal totalizarEventosFinanceiros(List lsEventosFinanceiros) throws BusinessException; + + public OcdVO totalizarOcd(List lsOcd) throws BusinessException; + + public ResumoComissao gerarResumo(Conferencia conferencia, List boletoComissaos, List lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos, BigDecimal totalBilhetesCancelados, + BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados, BigDecimal totalBilhetesGapDevolvidos, + BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd) throws BusinessException; + + public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException; + + public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote) throws BusinessException; + + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + + public Map totalizarBoletoComissaoDevolvidosTrocaOcd(List lsBoletoComissao) throws BusinessException; + + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfigRestriccionPagoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfigRestriccionPagoService.java new file mode 100644 index 000000000..55c899544 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConfigRestriccionPagoService.java @@ -0,0 +1,32 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConfigRestriccionPagoService + extends GenericService { + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago); + + /** + * Verifica se puede dar de alta en el registro. + * Ej.:Para una forma de pago que ya esta configurada para "Cancelable", no se puede permitr da de alta en la misma forma de pago con + * restriccion de "No Cancelable" + * @param configRestriccionPago + * @return + */ + public boolean puedoDarDeAlta(ConfigRestriccionPago configRestriccionPago); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConstanteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConstanteService.java new file mode 100644 index 000000000..3b42519c0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConstanteService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Constante; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConstanteService extends GenericService { + + public Constante buscarPorNomeConstante(String nomeConstante); + + public List buscar(String nombconstante); + + String buscarNombreAmbiente(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConvenioDetService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConvenioDetService.java new file mode 100644 index 000000000..74f0bb549 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConvenioDetService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; + +/** + * + * @author Administrador + */ +public interface ConvenioDetService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ConvenioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConvenioService.java new file mode 100644 index 000000000..68ab7dc4d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ConvenioService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Convenio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConvenioService extends GenericService { + + public List buscar(String descconvenio, String cveconvenio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaCtrlService.java new file mode 100644 index 000000000..6e42cb231 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaCtrlService.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +/** + * + * @author Administrador + */ +public interface CorridaCtrlService { + + public CorridaCtrl obtenerID(Integer id); + + public CorridaCtrl suscribir(CorridaCtrl entidad); + + public CorridaCtrl actualizacion(CorridaCtrl entidad); + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, Date horario, boolean pisoExtra); + + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaService.java new file mode 100644 index 000000000..4a840c4cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaService.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author rodrigo + */ +public interface CorridaService extends GenericService { + + /** + * Genera las corridas de acuerdo con el parametro de cant dias. + * + * + * @return - Si fue generado exitosamente o no + */ + public boolean generarCorridaAutomatica(); + + public List buscarPorAutobusCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorRolOperativoCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorFecCorrida(Date value); + + public List verificarCorridaId(Integer corridaId); + + public List buscarPorId(Integer idCorrida); + + public List buscarFiltro(Parada ori, Parada des, Date hora, ClaseServicio cs); + + /** + * Regresa la fecha final para el período de generación automatica de corridas. + * + * + * @return + */ + public Date calcularDataFinalGeneracionCorrida(); + + public List buscarDistinct(Parada ori, Parada des, Date horaSalidaInicio, Date horaSalidaFin, ClaseServicio cs, Integer corridaId); + + /** + * Gera corrida a partir dos servicos selecionados e no intervalo de dias informados.
+ * + * @param lsEsquemaCorrida + * @param dataDe + * @param dataAte + * @return A quantidade de corridas geradas + * @throws BusinessException + */ + public Long generarCorridasSelecionadas(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException; + + public List buscarGroupCorrridaId(Integer corridaId, Date dateInicio, Date dateFin); + + public List buscarGroupCorrridaId(Integer corridaId, Integer origem, Integer destino, Integer ruta, Integer numRuta, Date dateInicio, Date dateFin); + + public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial); + + Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId); + + public List buscarCorridaRelatorio(Connection conexao, Parada origem, Parada destino, Date feccorrida, Integer corridaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaTramoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaTramoService.java new file mode 100644 index 000000000..fa5de7e5d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CorridaTramoService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; + +public interface CorridaTramoService extends GenericService { + + public List obtenerTramoTarjetaEmitida(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaBeneficiarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaBeneficiarioService.java new file mode 100644 index 000000000..980554421 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaBeneficiarioService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; + +/** + * + * @author Shiro + */ +public interface CortesiaBeneficiarioService extends GenericService{ + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaDireccionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaDireccionService.java new file mode 100644 index 000000000..28c1f9a74 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaDireccionService.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.util.Date; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaDireccionService extends GenericService { + + public List pesquisar(Marca marca, ClaseServicio claseServicio, Date fecInicio, Date fecFinal); + + public List buscar(CortesiaDireccion cortesiaDireccion); + + public List buscarFolio(CortesiaDireccion cortesiaDireccion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaService.java new file mode 100644 index 000000000..9da186c6f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CortesiaService.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaService extends GenericService { + + public List pesquisar(String empleadoClave); + + public Cortesia buscar(Integer cortesiaId); + + public List buscarDplicidad(Cortesia cortesia); + + /** + * Indica se la cortesia ya fue utilizada + * @param cortesia + * @return + */ + public boolean cortesiaUtilizada(Cortesia cortesia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CuponConvenioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CuponConvenioService.java new file mode 100644 index 000000000..171cdc6f2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CuponConvenioService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CuponConvenioService extends GenericService{ + + public List pesquisar(TipoConvenio tipoConvenio); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CuponSecretariaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CuponSecretariaService.java new file mode 100644 index 000000000..55f1f8f6b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CuponSecretariaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; + +/** + * + * @author Administrador + */ +public interface CuponSecretariaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/CursoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/CursoService.java new file mode 100644 index 000000000..f5c237de4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/CursoService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Curso; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +public interface CursoService { + public List obtenerTodos(); + + public Curso obtenerID(Integer id); + + public Curso suscribir(Curso entidad); + + public Curso actualizacion(Curso entidad); + + public void borrar(Curso entidad) throws RegistroConDependenciaException; + + public List buscar(String nomcurso); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/DepositoBancarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/DepositoBancarioService.java new file mode 100644 index 000000000..41c544abb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/DepositoBancarioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; + +/** + * + * @author Rafius + */ +public interface DepositoBancarioService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/DescontoComissaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/DescontoComissaoService.java new file mode 100644 index 000000000..71aebd497 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/DescontoComissaoService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; + +public interface DescontoComissaoService extends GenericService { + + public DescontoComissao suscribirOrActualizacion(DescontoComissao entidad); + + public List buscaDescontoComissaoPeriodo(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/DetAbastoBoletoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/DetAbastoBoletoService.java new file mode 100644 index 000000000..1f30d8dc9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/DetAbastoBoletoService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; + +public interface DetAbastoBoletoService extends GenericService { + + public Long getSecuencia(); + + public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa); + + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa); + + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf Aidf); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/DetDiagramaAutobusService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/DetDiagramaAutobusService.java new file mode 100644 index 000000000..c83fe7f45 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/DetDiagramaAutobusService.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; + +/** + * + * @author Administrador + */ +public interface DetDiagramaAutobusService { + + public List obtenerTodos(); + + public DetDiagramaAutobus obtenerID(Short id); + + public DetDiagramaAutobus suscribir(DetDiagramaAutobus entidad); + + public DetDiagramaAutobus actualizacion(DetDiagramaAutobus entidad); + + public void borrar(DetDiagramaAutobus entidad); + + DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/DiagramaAutobusService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/DiagramaAutobusService.java new file mode 100644 index 000000000..faf601420 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/DiagramaAutobusService.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; + +/** + * + * @author Administrador + */ +public interface DiagramaAutobusService { + + public List obtenerTodos(); + + public DiagramaAutobus obtenerID(Short id); + + public DiagramaAutobus suscribir(DiagramaAutobus entidad); + + public DiagramaAutobus actualizacion(DiagramaAutobus entidad); + + public void borrar(DiagramaAutobus entidad); + + public List buscar(String descDiagrama, Short maxparados, Short cantasientos); + + public List buscar(String descDiagrama); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/DivisionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/DivisionService.java new file mode 100644 index 000000000..2d9c9da8f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/DivisionService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Division; + +public interface DivisionService extends GenericService{ + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpleadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpleadoService.java new file mode 100644 index 000000000..387dd1278 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpleadoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +import java.util.List; + +/** + * + * @author Shiro + */ +public interface EmpleadoService extends GenericService { + + public List pesquisaClave(String empleadoClave); + + public List pesquisaEmpresa(Empresa empresa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaContaBancariaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaContaBancariaService.java new file mode 100644 index 000000000..88a8ed961 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaContaBancariaService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface EmpresaContaBancariaService { + + public EmpresaContaBancaria suscribirActualizacion(EmpresaContaBancaria entidad) throws BusinessException; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaEquivalenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaEquivalenciaService.java new file mode 100644 index 000000000..37e9625ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaEquivalenciaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface EmpresaEquivalenciaService extends GenericService { + + public List buscar(Empresa parada, ComisionistaExterno comisionistaExterno); + + public List buscarEquivalencia(EmpresaEquivalencia empresaEquivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java new file mode 100644 index 000000000..a4584f905 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Administrador + */ +public interface EmpresaImpostoService extends GenericService { + + public List buscarByEmpresa(Empresa empresa); + + public List buscarEmpresaImposto(Integer empresaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaService.java new file mode 100644 index 000000000..273b5b6ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EmpresaService.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Administrador + */ +public interface EmpresaService { + + public List obtenerTodos(); + + public Empresa obtenerID(Integer id); + + public Empresa suscribirActualizacion(Empresa entidad) throws BusinessException; + + public void borrar(Empresa entidad) throws RegistroConDependenciaException; + + public List buscar(String nombempresa, Boolean indExterna, Short indTipo); + + public List buscarTodosExceto(List empresa, Integer... idEmpresa); + + public List obtenerIndExternoFalse(); + + public List obtenerIndTipo2(); + + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta); + + public List buscaInscricoesEstaduais(Empresa empresa); + + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual); + + public List buscaLike(String nombempresa); + + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public List obtenerTodosIncluindoEmpresaTodas(); + + public ComEmpConferencia suscribirOrActualizacion(ComEmpConferencia comEmpConferencia); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EnderecoApanheService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EnderecoApanheService.java new file mode 100644 index 000000000..84078afa5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EnderecoApanheService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; + +public interface EnderecoApanheService extends GenericService { + + public List buscar(Date datapacote, String numoperacion); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EscolaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EscolaService.java new file mode 100644 index 000000000..e7bf3a1e6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EscolaService.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +public interface EscolaService { + public List obtenerTodos(); + + public Escola obtenerID(Integer id); + + public Escola suscribir(Escola entidad); + + public Escola actualizacion(Escola entidad); + + public void borrar(Escola entidad) throws RegistroConDependenciaException; + + public List buscar(String nombescola, Ciudad ciudad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaAgrupacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaAgrupacionService.java new file mode 100644 index 000000000..0137a4a97 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaAgrupacionService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; + +/** + * + * @author RJ Consultores + */ +public interface EsquemaAgrupacionService extends GenericService { + + public List buscar(EsquemaAgrupacion esquemaAgrupacion); + + public EsquemaAgrupacion obtenerByEsquemaAgrupacion(Integer numAgrupacion); + + public boolean buscarNumAgrupacion(Integer numAgrupacion); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java new file mode 100644 index 000000000..5ebee36c8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Rafius + */ +public interface EsquemaAsientoService { + + public void borrar(EsquemaAsiento entidad); + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida); + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento); + + /*** + * Hace la configuración de bloqueo de asientos de acuerdo la origen informada.
+ * + * + * + * @param asiento + * - Indica los asientos. Ej.: 1,2,3,4 o 1-4, + * @param origenId + * @return + */ + public void bloqueoAsientoExclusivo(EsquemaCorrida esquemaCorrida, String asiento, Parada origen, Integer tiempoLiberacion) throws BusinessException; + + /** + * Hace la configuración de ocupación de bloqueo de asientos de acuerdo con el tramo informado (origen - destino).
+ * + * @param asiento + * - Indica los asientos. Ej.: 1,2,3,4 o 1-4, + * @param origenId + * @param destinoId + * @param motivoOcupacion + * @return + */ + public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String asiento, Parada origen, Parada destino, Integer tiempoLiberacion, String motivoOcupacion) throws BusinessException; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaService.java new file mode 100644 index 000000000..dbbbf4896 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaService.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ParadaEsquema; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; + +/** + * + * @author Rafius + */ +public interface EsquemaCorridaService extends GenericService { + + public List buscarPorEsquemaOperacional(EsquemaOperacional eo); + + public List buscarPorEmpresaCorrida(Empresa empresa); + + public List buscar(Marca marca, RolOperativo rolOperativo,Ruta ruta, ClaseServicio claseServicio); + + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra); + + public void actualizaEsquemaTramo(List listParadaEsquema, EsquemaCorrida ec); + + public List buscaDentroVigencia(Date dataGeracao); + + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo); + + /** + * See {@link EsquemaCorridaDAO#existe(Ruta, Integer)} + * + * @param ruta + * @param paradaId + * @return + */ + public List existe(Ruta ruta, Integer paradaId); + + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao); + + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataDe); + + public EsquemaCorrida obtenerByEsquemaCorrida(Integer numCorrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaOperacionalService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaOperacionalService.java new file mode 100644 index 000000000..77489d02b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaOperacionalService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaOperacionalService + extends GenericService { + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao); + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaTramoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaTramoService.java new file mode 100644 index 000000000..25d346a8d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EsquemaTramoService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaTramoService extends GenericService { + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec); + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec); + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EstacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EstacionService.java new file mode 100644 index 000000000..2f8f8a301 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EstacionService.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Administrador + */ +public interface EstacionService { + + public List obtenerTodos(); + + public Estacion obtenerID(Integer id); + + /** + * Suscribe/Actualiza la entidad informada. + * + * @param entidad + * @return + * @throws BusinessException + * - Cuando la estacion es duplicada + */ + public Estacion suscribirActualizar(Estacion entidad) throws BusinessException; + + public void borrar(Estacion entidad) throws BusinessException; + + public List buscar(String descEstacion, String descMac, Long nunCaja, PuntoVenta pv); + + public List buscar(String descMac); + + public Long getDecimalMAC(String mac); + + public List buscarEstaciones(PuntoVenta puntoVenta); + + public void devolverFoliosAutomaticosImpressoraFiscal(EstacionImpresora ei); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EstadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EstadoService.java new file mode 100644 index 000000000..9cd4b9eb1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EstadoService.java @@ -0,0 +1,35 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author MCosso + */ +public interface EstadoService { + + public List obtenerTodos(); + + public Estado obtenerID(Integer id); + + public Estado suscribir(Estado entidad); + + public Estado actualizacion(Estado entidad); + + public void borrar(Estado entidad) throws RegistroConDependenciaException; + + public List buscar(String nombestado, Pais pais); + + public List buscarNotInEmpresaImposto(Empresa empresa); + + public List buscarCveEstado(String cveEstado); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/EventoExtraService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/EventoExtraService.java new file mode 100644 index 000000000..7c94b8a47 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/EventoExtraService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +public interface EventoExtraService extends GenericService { + + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java new file mode 100644 index 000000000..de1f717d2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; + +public interface ExcepcionPeajeService extends GenericService { + + public List buscar(String descconvenio, String cveconvenio); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ExcepcionRedondoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ExcepcionRedondoService.java new file mode 100644 index 000000000..de2a15542 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ExcepcionRedondoService.java @@ -0,0 +1,34 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ExcepcionRedondoService{ + + public List obtenerTodos(); + + public ExcepcionRedondo obtenerID(Integer id); + + /** + * Suscribe o actualiza la exception + * @param entidad + * @return + * @throws BusinessException - Si genera una exception si hay un error de validación + */ + public ExcepcionRedondo suscribirActualizar(ExcepcionRedondo entidad) throws BusinessException; + + public void borrar(ExcepcionRedondo entidad); + + public List buscar(String indTipo, Parada origem, Parada destino); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FechamentoParamgeralService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FechamentoParamgeralService.java new file mode 100644 index 000000000..cc6f95748 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FechamentoParamgeralService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; + +public interface FechamentoParamgeralService extends GenericService { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + public FechamentoParamgeral suscribirOrActualizacion(FechamentoParamgeral fechamentoParamgeral); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FechamentoParamptovtaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FechamentoParamptovtaService.java new file mode 100644 index 000000000..117749935 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FechamentoParamptovtaService.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface FechamentoParamptovtaService extends GenericService { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + public FechamentoParamptovta suscribirOrActualizacion(FechamentoParamptovta FechamentoParamptovta); + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FeriadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FeriadoService.java new file mode 100644 index 000000000..316ce8669 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FeriadoService.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.service; + +import java.sql.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; + +public interface FeriadoService extends GenericService { + + public List buscar(Date descferiado); + + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalAliquotaEmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalAliquotaEmpresaService.java new file mode 100644 index 000000000..41af81023 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalAliquotaEmpresaService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface FiscalAliquotaEmpresaService { + + public List obtenerTodos(); + + public FiscalAliquotaEmpresa obtenerID(Integer id); + + public FiscalAliquotaEmpresa suscribirActualizar(FiscalAliquotaEmpresa entidad) throws BusinessException; + + public void borrar(FiscalAliquotaEmpresa entidad); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraService.java new file mode 100644 index 000000000..137a1c2ae --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraService.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface FiscalImpressoraService{ + + public List obtenerTodos(); + public FiscalImpressora obtenerID(Integer id); + public FiscalImpressora suscribir(FiscalImpressora entidad); + public FiscalImpressora actualizacion(FiscalImpressora entidad); + + + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId); + public List obtenerTodosTotnaofiscalEmpresa(); + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id); + public FiscalTotnaofiscalEmpresa suscribirActualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) throws BusinessException; + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + + + public List buscarFormaPagoEmpresa(Integer empresaEcfId); + public List obtenerTodosFormapagoEmpresa(); + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id); + public FiscalFormapagoEmpresa suscribirActualizarFormapagoEmpresa(FiscalFormapagoEmpresa entidad) throws BusinessException; + public FiscalFormapagoEmpresa borrarFormapagoEmpresa(FiscalFormapagoEmpresa entidad); + + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId); + public List obtenerTodosRelgerencialEmpresa(); + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id); + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalService.java new file mode 100644 index 000000000..3f6c61e7b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FiscalService.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.service; + +import java.io.File; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; + +public interface FiscalService { + + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte); + + public HashMap importacionFiscalECFValidaReducaoZ(Date inicio, Date fim, Empresa empresa); + + public File importacionFiscalECF(Date inicio, Date fim, Empresa empresa); + + public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa); + + public File importacionFiscalReducaoZPendencia(Date inicio, Date fim, Empresa empresa); + + public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa); + + public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa); + + public File importacionFiscalECFCancelados(Date inicio, Date fim, Empresa empresa); + + public File importacionFiscalECFXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalReducaoZXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalECFManualXls(Empresa empresa, File arquivoTxt); + + public File importacionNaoFiscalXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalECFCanceladosXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalECFPendencias(Date inicio, Date fim, Empresa empresa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FolioPreimpresoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FolioPreimpresoService.java new file mode 100644 index 000000000..a58a8449c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FolioPreimpresoService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; + +public interface FolioPreimpresoService extends GenericService { + + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FormaPagoDetService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FormaPagoDetService.java new file mode 100644 index 000000000..ba5fcfad8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FormaPagoDetService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; + +/** + * + * @author Administrador + */ +public interface FormaPagoDetService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FormaPagoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FormaPagoService.java new file mode 100644 index 000000000..7370f8790 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FormaPagoService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface FormaPagoService extends GenericService { + + public List buscarPorDescricao(String descpago); + + + /** + * Hace las búsqueda de todas las formas de pagos, excepto las formas de pagos especiales. + * La formar de pago especiales son definidas de forma fija. No hay un campo que identifique eso. + * @return + */ + public List buscarFormasPagoExceptoEspeciales(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/FuncionSistemaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/FuncionSistemaService.java new file mode 100644 index 000000000..b689ada6d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/FuncionSistemaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; + +/** + * + * @author rodrigo + */ +public interface FuncionSistemaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/GenericService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/GenericService.java new file mode 100644 index 000000000..400236974 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/GenericService.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface GenericService { + + public List obtenerTodos(); + + public T obtenerID(ID id); + + public T suscribir(T entidad); + + public T actualizacion(T entidad); + + public void borrar(T entidad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/GenericServiceInforme.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/GenericServiceInforme.java new file mode 100644 index 000000000..e6dfa249c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/GenericServiceInforme.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.io.InputStream; +import java.util.Map; + +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.exception.BusinessException; + + +/** + * + * @author Administrador + */ +public interface GenericServiceInforme { + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoCategoriaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoCategoriaService.java new file mode 100644 index 000000000..73674693f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoCategoriaService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; + +public interface GrupoCategoriaService extends GenericService { + + public List buscar(String descricao); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoCortesiasService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoCortesiasService.java new file mode 100644 index 000000000..4747d06a9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoCortesiasService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface GrupoCortesiasService extends GenericService { + + public List buscar(String descgrupo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoRutaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoRutaService.java new file mode 100644 index 000000000..af3ff2ebc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/GrupoRutaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +public interface GrupoRutaService extends GenericService { + + public List buscarPorNome(String descgrupo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/HotelService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/HotelService.java new file mode 100644 index 000000000..bcb5fab0e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/HotelService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Hotel; + +public interface HotelService extends GenericService { + + public List buscar(String deschotel); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java new file mode 100644 index 000000000..3fb599839 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.io.Reader; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ImportacaoClientesService { + public String[] lerArquivo(Reader reader, List empresas); + + public Integer[] salvarClientes(String[] cliente, List empresas); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeCategoriaVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeCategoriaVentaService.java new file mode 100644 index 000000000..b15cc88aa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeCategoriaVentaService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformeCategoriaVentaService extends GenericServiceInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/InformePasajeroServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformePasajeroServicioService.java new file mode 100644 index 000000000..9016f83d9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformePasajeroServicioService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformePasajeroServicioService extends GenericServiceInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeServicioDiarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeServicioDiarioService.java new file mode 100644 index 000000000..17b90d65c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeServicioDiarioService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformeServicioDiarioService extends GenericServiceInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeVentasPuntoVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeVentasPuntoVentaService.java new file mode 100644 index 000000000..117d64ca4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/InformeVentasPuntoVentaService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformeVentasPuntoVentaService extends GenericServiceInforme { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/InstiFinanceiraService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/InstiFinanceiraService.java new file mode 100644 index 000000000..b41a9988c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/InstiFinanceiraService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +public interface InstiFinanceiraService { + + public List obtenerTodos(); + public List buscarContasBancariasPorIdEmpresa(Integer empresaId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ItemAdicionalService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ItemAdicionalService.java new file mode 100644 index 000000000..308ee14a4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ItemAdicionalService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +public interface ItemAdicionalService extends GenericService { + + public List buscaItemAdicionalPacote(Pacote pacote); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ItemDescontoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ItemDescontoService.java new file mode 100644 index 000000000..d2adb4997 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ItemDescontoService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; + +public interface ItemDescontoService extends GenericService { + + public List buscarPorNome(String nomitemdesconto); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java new file mode 100644 index 000000000..45de9ad5f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + +public interface MarcaAutobusService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaClaseServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaClaseServicioService.java new file mode 100644 index 000000000..3bb46d265 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaClaseServicioService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MarcaClaseServicioService + extends GenericService { + + public List buscar(ClaseServicio clase); + + public List buscarPorEmpresasPermitidas(ClaseServicio clase, Usuario usuarioLoggado); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaService.java new file mode 100644 index 000000000..cbd92c86b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MarcaService.java @@ -0,0 +1,36 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MarcaService { + + public List obtenerTodos(); + + public Marca obtenerID(Short id); + + public Marca suscribir(Marca entidad); + + public Marca actualizacion(Marca entidad); + + public void borrar(Marca entidad); + + public List buscarPorNome(String nomeMarca); + + public List buscarTodosExceto(Usuario usuario,Integer ... idMarca); + + public List buscarDescricaoIdMarca(); + + public List buscarMarcaPorEmpresa(List empresa); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MercadoCompetidoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MercadoCompetidoService.java new file mode 100644 index 000000000..112c5df8d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MercadoCompetidoService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface MercadoCompetidoService extends GenericService { + + public boolean existe(ClaseServicio claseServicio, + Parada origem, Parada destino); + + public List buscar(Parada origem, Parada destino); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MerchantBancarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MerchantBancarioService.java new file mode 100644 index 000000000..5b87810f6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MerchantBancarioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; + +/** + * + * @author Rafius + */ +public interface MerchantBancarioService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MigracaoControleEstoqueService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MigracaoControleEstoqueService.java new file mode 100644 index 000000000..f56264c9c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MigracaoControleEstoqueService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface MigracaoControleEstoqueService { + + public void migraDadosBoletosPuntoVenta(PuntoVenta puntoVenta); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MonedaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MonedaService.java new file mode 100644 index 000000000..d917e5da7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MonedaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MonedaService extends GenericService { + + public List buscar(String descmoneda); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoCancelacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoCancelacionService.java new file mode 100644 index 000000000..db25c8c98 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoCancelacionService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoCancelacionService extends GenericService { + + public List buscar(String descmotivo, String tipomotivo); + + public List obtenerTodosTipoMotivoB(); + + public List obtenerTodosEspecificos(Integer[] motivos); + + public boolean validaMotivoCancelacionConstante(MotivoCancelacion motivoCancelacion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoReimpresionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoReimpresionService.java new file mode 100644 index 000000000..0a9f2deb0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoReimpresionService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoReimpresionService extends GenericService { + + public List buscar(String descmotivo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoViajeService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoViajeService.java new file mode 100644 index 000000000..5fae57531 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivoViajeService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; + +/** + * + * @author Shiro + */ +public interface MotivoViajeService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivocancelacionEquivalenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivocancelacionEquivalenciaService.java new file mode 100644 index 000000000..b6f9cc932 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MotivocancelacionEquivalenciaService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MotivocancelacionEquivalenciaService + extends GenericService { + + public List buscar(ComisionistaExterno comisionistaExterno, + MotivoCancelacion motivoCancelacion); + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java new file mode 100644 index 000000000..483ed6f4c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface MovimentacionBilhetesService { + + public List obtenerHistoricoMovimetacion(String numBilhete); + public List obtenerHistoricoMovimetacion(Aidf aidf); + public List obtenerHistoricoMovimetacion(Aidf aidf, Date fecInicial, Date fecFinal); + public List obtenerTiposMovimetacion(); + + + public void realizaAdquisicionBilhetes(Aidf aidf); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, Long cantidad, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion); + + public PuntoVenta buscarAgSuprimento(); + public PuntoVenta buscarAgContabilidade(); + + public List obtenerTiposMovimetacionPuntoVenta(); + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String numSerie, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion); + + public List buscarSeriesBilhetesPorEstacion(Estacion estacion); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/NodoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/NodoService.java new file mode 100644 index 000000000..663fbb269 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/NodoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Nodo; + +/** + * + * @author Administrador + */ +public interface NodoService { + + public List obtenerTodos(); + + public Nodo obtenerId(Integer id); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/OCDParamService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/OCDParamService.java new file mode 100644 index 000000000..c17bbaa75 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/OCDParamService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; + +public interface OCDParamService extends GenericService { + + public OCDParam suscribirActualizar(OCDParam entidad); + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa); + public List buscaOCDParams(Empresa empresa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoCancelacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoCancelacionService.java new file mode 100644 index 000000000..f01eafd7d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoCancelacionService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoCancelacionService { + + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente); + + public List obtenerTodos(); + + public OrgaoCancelacion obtenerID(Integer id); + + public void borrar(OrgaoCancelacion entidad); + + public OrgaoCancelacion suscribirActualizacion(OrgaoCancelacion entidad); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoConcedenteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoConcedenteService.java new file mode 100644 index 000000000..945c188b9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoConcedenteService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoConcedenteService { + + public List buscar(String desc); + + + public List obtenerTodos(); + + public OrgaoConcedente obtenerID(Integer id); + + public OrgaoConcedente actualizacion(OrgaoConcedente entidad); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoTramoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoTramoService.java new file mode 100644 index 000000000..7b85c3ffb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/OrgaoTramoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + + +public interface OrgaoTramoService{ + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteConvenioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteConvenioService.java new file mode 100644 index 000000000..28bdf1258 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteConvenioService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; + +public interface PacoteConvenioService extends GenericService { + + public List buscar(String nomconvenio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteDescontoBilheteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteDescontoBilheteService.java new file mode 100644 index 000000000..b441041fd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteDescontoBilheteService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; + +public interface PacoteDescontoBilheteService extends GenericService { + + public List obtenerTodos(Integer pacoteId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteItemService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteItemService.java new file mode 100644 index 000000000..c41240ef4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteItemService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; + +public interface PacoteItemService extends GenericService { + + public PacoteItem vincularItemPacote(PacoteItem pacoteItem, Pacote pacote, ItemAdicional item); + + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item); + + public List buscaItensPacote(Pacote pacote); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteService.java new file mode 100644 index 000000000..4f14d767d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface PacoteService extends GenericService { + + public Boolean verificaCadastroTarifa(Pacote pacote, TipoTarifaPacote tarifa); + + public Boolean verificaCadastroItemAdicional(Pacote pacote, ItemAdicional item); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteTarifaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteTarifaService.java new file mode 100644 index 000000000..880a3eaff --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PacoteTarifaService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface PacoteTarifaService extends GenericService { + + public PacoteTarifa vincularPacoteTarifa(PacoteTarifa pacoteTarifa, Pacote pacote, TipoTarifaPacote tipoTarifaPacote, BigDecimal tarifa); + + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote); + + public List buscaTarifasPacote(Pacote pacote); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PaisService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PaisService.java new file mode 100644 index 000000000..e1a25c29d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PaisService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pais; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PaisService extends GenericService { + + public List buscar(String nombpais); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParadaEquivalenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParadaEquivalenciaService.java new file mode 100644 index 000000000..3faddb60a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParadaEquivalenciaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ParadaEquivalenciaService extends GenericService { + + public List buscar(Parada parada, ComisionistaExterno comisionistaExterno, String equivalencia); + + public List buscarEquivalencia(String equivalencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParadaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParadaService.java new file mode 100644 index 000000000..0f39d0367 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParadaService.java @@ -0,0 +1,41 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ParadaService { + + public Parada obtenerID(Integer id); + + public Parada suscribirActualizar(Parada entidad) throws BusinessException; + + public void borrar(Parada entidad) throws RegistroConDependenciaException; + + public List buscar(String descparada, String cveparada, Ciudad ciudad, + TipoParada tipoParada, Nodo nodo); + + public List buscarCVE(String cveparada); + + public List buscar(String descparada); + + public List buscaLike(String descparada); + + public List obtenerOrigenPorRuta(Ruta ruta); + + public List obtenerTodos(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamAcumulaMasivoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamAcumulaMasivoService.java new file mode 100644 index 000000000..aa8707207 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamAcumulaMasivoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaMasivoService extends GenericService { + + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim); + + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamAcumulaPuntoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamAcumulaPuntoService.java new file mode 100644 index 000000000..15c940a51 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamAcumulaPuntoService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaPuntoService extends GenericService { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamArticuloService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamArticuloService.java new file mode 100644 index 000000000..9eb141bc3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamArticuloService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; + +public interface ParamArticuloService extends + GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCanjePuntoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCanjePuntoService.java new file mode 100644 index 000000000..ceb96f63b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCanjePuntoService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCanjePuntoService extends GenericService { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCompraPuntoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCompraPuntoService.java new file mode 100644 index 000000000..60de1ac96 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCompraPuntoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCompraPuntoService extends GenericService { + + public List buscar(Date ini, Date fim); + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamConexionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamConexionService.java new file mode 100644 index 000000000..113be908c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamConexionService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamConexion; + +public interface ParamConexionService { + + public ParamConexion actualizacion(ParamConexion paramConexion); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCostoTarjetaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCostoTarjetaService.java new file mode 100644 index 000000000..89e7ef132 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamCostoTarjetaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCostoTarjetaService extends GenericService { + + public List buscar(ParamCostoTarjeta paramCostoTarjeta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamRecoleccionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamRecoleccionService.java new file mode 100644 index 000000000..22db5dfe9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ParamRecoleccionService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; + +/** + * + * @author Desenvolvimento + */ +public interface ParamRecoleccionService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PerfilFuncionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PerfilFuncionService.java new file mode 100644 index 000000000..efc691bb9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PerfilFuncionService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; + +/** + * + * @author rodrigo + */ +public interface PerfilFuncionService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PerfilService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PerfilService.java new file mode 100644 index 000000000..e38060be8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PerfilService.java @@ -0,0 +1,33 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Perfil; + +/** + * + * @author rodrigo + */ +public interface PerfilService { + + public List obtenerTodos(); + + public Perfil obtenerID(Integer id); + + public Perfil suscribir(Perfil entidad); + + public Perfil actualizacion(Perfil entidad); + + public void borrar(Perfil entidad); + + public List buscar(String dscPerfil); + + public List buscaPerfilJerarquia(Perfil perfilUsuario); + + public Boolean clonarPerfil(Integer perfilId, String nomePerfil); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PeriodoVacacionalService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PeriodoVacacionalService.java new file mode 100644 index 000000000..af0481d58 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PeriodoVacacionalService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PeriodoVacacionalService extends GenericService { + + public List buscar(Date dataInicio, Date dataFim); + + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PlazaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PlazaService.java new file mode 100644 index 000000000..4f72de132 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PlazaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface PlazaService extends GenericService { + + public List buscar(String nombplaza); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PrecioVentajaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PrecioVentajaService.java new file mode 100644 index 000000000..fc3ce15cb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PrecioVentajaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Igor + */ +public interface PrecioVentajaService { + + public PrecioVentaja suscribirActualizacion(PrecioVentaja entidad) throws BusinessException; + public void borrar(PrecioVentaja entidad) throws RegistroConDependenciaException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java new file mode 100644 index 000000000..0c4a7be10 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +public interface PrecoApanheService extends GenericService { + + public List buscar(String deschotel, String desccolonia, String nombciudad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingAsientoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingAsientoService.java new file mode 100644 index 000000000..9d4a456ab --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingAsientoService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingAsientoService extends GenericService { + + public List obtenerPricingCategoria(Pricing pricing, Integer value); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingCategoriaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingCategoriaService.java new file mode 100644 index 000000000..f30eecc96 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingCategoriaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; + +/** + * + * @author Rafius + */ +public interface PricingCategoriaService extends GenericService { + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingClaseService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingClaseService.java new file mode 100644 index 000000000..b905a66ad --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingClaseService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; + +/** + * + * @author Rafius + */ +public interface PricingClaseService extends GenericService { + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingClasseTarifariaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingClasseTarifariaService.java new file mode 100644 index 000000000..8545cc52e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingClasseTarifariaService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; + +public interface PricingClasseTarifariaService extends GenericService { + + public Boolean validacionSigla(String sigla); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingCorridaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingCorridaService.java new file mode 100644 index 000000000..9140371bf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingCorridaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; + +/** + * + * @author Rafius + */ +public interface PricingCorridaService extends GenericService { + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingDiaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingDiaService.java new file mode 100644 index 000000000..0db7c052b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingDiaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingDiaService extends GenericService { + + public List buscarTraslapa(PricingDia pricingDia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingEspecificoOcupacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingEspecificoOcupacionService.java new file mode 100644 index 000000000..e645cfae6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingEspecificoOcupacionService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; + +public interface PricingEspecificoOcupacionService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingEspecificoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingEspecificoService.java new file mode 100644 index 000000000..c869e3470 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingEspecificoService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingEspecificoService extends GenericService { + + public List buscarPorNome(PricingEspecifico pricingEspecifico); + + public List buscarPorNome(String nome); + + public PricingEspecifico clonarPricing(Long id, String nome); + + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingFormapagoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingFormapagoService.java new file mode 100644 index 000000000..8bc03f5b8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingFormapagoService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; + +public interface PricingFormapagoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingImporteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingImporteService.java new file mode 100644 index 000000000..a675f621c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingImporteService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingImporteService extends GenericService { + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingMarcaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingMarcaService.java new file mode 100644 index 000000000..e5e5b6545 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingMarcaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; + +/** + * + * @author Rafius + */ +public interface PricingMarcaService extends GenericService { + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingMercadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingMercadoService.java new file mode 100644 index 000000000..9a6051f81 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingMercadoService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; + +/** + * + * @author Rafius + */ +public interface PricingMercadoService extends GenericService { + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java new file mode 100644 index 000000000..1d292c14d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface PricingOcupaAntecipaService { + + public PricingOcupaAntecipa suscribir(PricingOcupaAntecipa entidad) throws BusinessException; + + public PricingOcupaAntecipa actualizacion(PricingOcupaAntecipa entidad) throws BusinessException; + + public void borrar(PricingOcupaAntecipa entidad); + + public List updateList(PricingOcupaAntecipa entidad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingPuntoVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingPuntoVentaService.java new file mode 100644 index 000000000..21692527d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingPuntoVentaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingPuntoVentaService extends GenericService { + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingRutaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingRutaService.java new file mode 100644 index 000000000..22dc6ff16 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingRutaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +/** + * + * @author Rafius + */ +public interface PricingRutaService extends GenericService { + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingService.java new file mode 100644 index 000000000..47e56bdf4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingService.java @@ -0,0 +1,32 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; + +/** + * + * @author Rafius + */ +public interface PricingService extends GenericService { + + public void borrarFisico(Pricing pricing); + + public List buscar(String nombPricing, Empresa empresa, + Short cantboleto, Integer cantdiasanticipacion, + BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo); + + public List buscarPorNombre(String nombPricing); + + public void inativar(Pricing entidad); + + public void ativar(Pricing entidad); + + public Boolean clonarPricing(Integer pricingId, String nomePricing); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingTipoPtoVtaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingTipoPtoVtaService.java new file mode 100644 index 000000000..3539b593e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingTipoPtoVtaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingTipoPtoVtaService extends GenericService { + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingTipoServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingTipoServicioService.java new file mode 100644 index 000000000..ef8618860 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingTipoServicioService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; + +/** + * + * @author Desenvolvimento + */ +public interface PricingTipoServicioService extends GenericService { + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingVigenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingVigenciaService.java new file mode 100644 index 000000000..f280ec2ee --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PricingVigenciaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingVigenciaService extends GenericService { + + public List buscarPorVigencias(PricingVigencia pv); + + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, + Date inicio, Date fim); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdClaseServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdClaseServicioService.java new file mode 100644 index 000000000..56d03df84 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdClaseServicioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; + +/** + * + * @author Rafius + */ +public interface ProdClaseServicioService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdFormaPagoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdFormaPagoService.java new file mode 100644 index 000000000..4db91a45f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdFormaPagoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; + +/** + * + * @author Rafius + */ +public interface ProdFormaPagoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdMarcaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdMarcaService.java new file mode 100644 index 000000000..1f7f176ef --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdMarcaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProdMarcaService extends GenericService { + + public ProdMarca actualizacion(ProdMarca entidad,List listPrecios); + public ProdMarca suscribir(ProdMarca entidad,List listPrecios); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdMercadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdMercadoService.java new file mode 100644 index 000000000..39bc9024c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdMercadoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdMercado; + +/** + * + * @author Rafius + */ +public interface ProdMercadoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdPrecioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdPrecioService.java new file mode 100644 index 000000000..b3c7b12c6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdPrecioService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ProdPrecioService extends GenericService { + + /** + * Hace una busqueda en los prodPrecio que estan ativos y con los filtros indicados + * @param marca + * @param productoservicio + * @return + */ + public List buscar(Marca marca, ProductoServicio productoservicio); + + public void borrar(Marca marca); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdPuntoVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdPuntoVentaService.java new file mode 100644 index 000000000..d3652cd6a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdPuntoVentaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ProdPuntoVentaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdRutaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdRutaService.java new file mode 100644 index 000000000..a3fa379e0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdRutaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdRuta; + +/** + * + * @author Rafius + */ +public interface ProdRutaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdTipoptovtaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdTipoptovtaService.java new file mode 100644 index 000000000..cd130e42b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdTipoptovtaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; + +/** + * + * @author Rafius + */ +public interface ProdTipoptovtaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdVigenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdVigenciaService.java new file mode 100644 index 000000000..d82572df6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProdVigenciaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProdVigenciaService extends GenericService { + + public List buscarTraslapa(ProdVigencia prodVigencia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ProductoServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProductoServicioService.java new file mode 100644 index 000000000..5f41a0649 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ProductoServicioService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProductoServicioService extends GenericService { + + public void borrarFisico(ProductoServicio productoServicio); + + public List obtener(ProductoServicio ps); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaCheckinService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaCheckinService.java new file mode 100644 index 000000000..f911a8a86 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaCheckinService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; + +public interface PtoVtaCheckinService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaSeguroService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaSeguroService.java new file mode 100644 index 000000000..d5a70cd59 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaSeguroService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; + +public interface PtoVtaSeguroService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaUsuarioBancarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaUsuarioBancarioService.java new file mode 100644 index 000000000..9ddfbc912 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtoVtaUsuarioBancarioService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; + +/** + * + * @author Desenvolvimento + */ +public interface PtoVtaUsuarioBancarioService extends GenericService { + + public void borrarFisico(PtoVtaUsuarioBancario pto2); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaAgenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaAgenciaService.java new file mode 100644 index 000000000..589665bd7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaAgenciaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + + +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + + +public interface PtovtaAgenciaService extends GenericService { + + public List buscar(String numagencia); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaAntecipacomissaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaAntecipacomissaoService.java new file mode 100644 index 000000000..c51c3bb3a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaAntecipacomissaoService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + + +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; + + +public interface PtovtaAntecipacomissaoService extends GenericService { + + public List buscar(int id); + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaCatIndService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaCatIndService.java new file mode 100644 index 000000000..847c470a8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaCatIndService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; + +public interface PtovtaCatIndService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaComissaoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaComissaoService.java new file mode 100644 index 000000000..ff0fc8128 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaComissaoService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface PtovtaComissaoService extends GenericService { + + public List buscar(int id); + + public List buscarByPuntaVenta(PuntoVenta puntaVenta); + + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaDiversosService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaDiversosService.java new file mode 100644 index 000000000..980fd910c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaDiversosService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; + + + + + +public interface PtovtaDiversosService extends GenericService { + + public List buscar(int id); + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaBloqueadaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaBloqueadaService.java new file mode 100644 index 000000000..5dbc3d564 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaBloqueadaService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; + +public interface PtovtaEmpresaBloqueadaService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaService.java new file mode 100644 index 000000000..f43857c89 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface PtovtaEmpresaService extends GenericService { + + public List buscar(PtovtaEmpresa ptovtaEmpresa); + + public void borrarFisico(PtovtaEmpresa pto); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEstoqueService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEstoqueService.java new file mode 100644 index 000000000..cb0f3155d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaEstoqueService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; + + + + + +public interface PtovtaEstoqueService extends GenericService { + + public List buscar(int id); + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaHorarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaHorarioService.java new file mode 100644 index 000000000..14ad701a8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaHorarioService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; + + + + + +public interface PtovtaHorarioService extends GenericService { + + public List buscar(int id); + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaTitularService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaTitularService.java new file mode 100644 index 000000000..38f4fabfa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PtovtaTitularService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; + + +public interface PtovtaTitularService extends GenericService { + + public List buscar(int id); + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java new file mode 100644 index 000000000..5d9095071 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.IntegracionException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; + +/** + * + * @author Administrador + */ +public interface PuntoVentaService { + + public List obtenerTodos(); + + public PuntoVenta obtenerID(Integer id); + + public PuntoVenta suscribir(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException; + + public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException; + + public void borrar(PuntoVenta entidad)throws BusinessException; + + public List buscaLike(String strEstacion); + + public List buscar(String nomPuntoVenta, String numPuntoVenta); + + public List buscaPuntoVenta(String numPuntoVenta); + + public List buscaPuntoVentaParada(Parada paradaId); + + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta); + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas); + + public List buscarPuntosVentaPorUsuario(Usuario usuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoCtrlService.java new file mode 100644 index 000000000..ccbb24269 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoCtrlService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoCtrlService extends GenericService { + + public List buscar(RedondeoCtrl redondeoCtrl); + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, Boolean indaplicapricing); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoMarcaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoMarcaService.java new file mode 100644 index 000000000..d51a037a3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoMarcaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoMarcaService extends GenericService { + + public List buscar(Marca marca); + + public List obtenerTodasMarcas(Short[] iDMarcas); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoService.java new file mode 100644 index 000000000..fe24eeebb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RedondeoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoService extends GenericService { + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo); + + public List buscarVlrIniVlrFin(BigDecimal valorinicial, BigDecimal valorfinal); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RequisicionBoletoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RequisicionBoletoService.java new file mode 100644 index 000000000..eeb2f63a2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RequisicionBoletoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; + +public interface RequisicionBoletoService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionCategoriaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionCategoriaService.java new file mode 100644 index 000000000..b0ca3150d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionCategoriaService.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; + +/** + * + * @author Administrador + */ +public interface ReservacionCategoriaService + extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionClaseService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionClaseService.java new file mode 100644 index 000000000..e2706a5c3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionClaseService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; + +/** + * + * @author Administrador + */ +public interface ReservacionClaseService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionCtrlService.java new file mode 100644 index 000000000..0afb7d90c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionCtrlService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ReservacionCtrlService extends GenericService { + + public List buscar(ReservacionCtrl reservacionCtrl); + + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrl); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionMarcaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionMarcaService.java new file mode 100644 index 000000000..d9b71dbe1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionMarcaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; + +/** + * + * @author Administrador + */ +public interface ReservacionMarcaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionMercadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionMercadoService.java new file mode 100644 index 000000000..435364b4c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionMercadoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; + +/** + * + * @author Administrador + */ +public interface ReservacionMercadoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionPuntoVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionPuntoVentaService.java new file mode 100644 index 000000000..687502d38 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ReservacionPuntoVentaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ReservacionPuntoVentaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RestriccionPagoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RestriccionPagoService.java new file mode 100644 index 000000000..0c598ba11 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RestriccionPagoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; + +/** + * + * @author Administrador + */ +public interface RestriccionPagoService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RhPagoConductorService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RhPagoConductorService.java new file mode 100644 index 000000000..b0b0d377c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RhPagoConductorService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; + +/** + * + * @author Desenvolvimento + */ +public interface RhPagoConductorService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RolOperativoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RolOperativoService.java new file mode 100644 index 000000000..2dd990e41 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RolOperativoService.java @@ -0,0 +1,32 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Rafius + */ +public interface RolOperativoService { + + public List obtenerTodos(); + + public RolOperativo obtenerID(Integer id); + + public RolOperativo suscribir(RolOperativo entidad); + + public RolOperativo actualizacion(RolOperativo entidad); + + public void borrar(RolOperativo entidad) throws RegistroConDependenciaException; + + public List pesquisar(DiagramaAutobus diagrama, String rol); + + public List buscar(String descroloperativo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaCasetaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaCasetaService.java new file mode 100644 index 000000000..aa30f09b8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaCasetaService.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.service; + + +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface RutaCasetaService { + + public RutaCaseta suscribir(RutaCaseta entidad) throws BusinessException; + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id)throws BusinessException; + +} + + + + + + + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java new file mode 100644 index 000000000..9fb9c596c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +/** + * + * @author Rafius + */ +public interface RutaCombinacionService extends GenericService { + + public void ativar(RutaCombinacion rcExiste); + + public boolean busquedaRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino, Boolean b); + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino); + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino); + + /** + * Regreso el tramo de la entidade RutaCobinacion donde el tramo tines el origen-destino igual y la Rua sea la misma de RutaCombinacion + * + * @param ruta + * @param origen + * @param destino + * @return + */ + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino); + + public List obtenerPorRuta(Ruta ruta); + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo); + + public int borrarCombinaciones(Ruta ruta); + + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino); + + public List pesquisaTarifaObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente); + + public HSSFWorkbook gerarTarifaEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa); + + public HSSFWorkbook gerarTarifaOficialEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa); + + public List pesquisaTarifaOficialObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa); + + /** + * Indica se existe alguma combinação ativa com o tramo informado + * @param tramo + * @return + */ + public boolean existeTramo(Tramo tramo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaEmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaEmpresaService.java new file mode 100644 index 000000000..70aeaed57 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaEmpresaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; + +/** + * + * @author Administrador + */ +public interface RutaEmpresaService extends GenericService { + + public List obtenerPorEmpresa(Empresa empresa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaSecuenciaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaSecuenciaService.java new file mode 100644 index 000000000..ee87da0ff --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaSecuenciaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface RutaSecuenciaService extends GenericService { + + public List buscarSecuenciaOrdenado(Ruta ruta); + + public int borrarSecuencias(Ruta ruta); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaService.java new file mode 100644 index 000000000..30ce40196 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/RutaService.java @@ -0,0 +1,96 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +import java.util.List; + +/** + * + * @author Rafius + */ +public interface RutaService { + + /** + * Regresa el destino de la ruta + * + * @param ruta + * @return + */ + public Parada getDestino(Ruta ruta); + + /** + * Regresa la origen de la ruta + * + * @param ruta + * @return + */ + public Parada getOrigem(Ruta ruta); + + public List buscarPorClaseServicio(ClaseServicio claseServicio); + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa); + + public List buscar(String nomeRuta, ClaseServicio claseServicio, Boolean nomeObrigatorio); + + public List obtenerPorEmpresa(Empresa empresa); + + public List buscarTodosExceto(Integer... idRuta); + + public List buscarNumRuta(String numRuta); + + public void borrar(Ruta entidad) throws RegistroConDependenciaException; + + /** + * Verifica se la parada informadad existe en la ruta informada + * + * @param parada + * @param ruta + * @return + */ + public boolean paradaExisteEnLaRuta(Parada parada, Ruta ruta); + + /** + * Hace la actualización de la ruta. + * + * Si el parametro lsParadasSequencia no es null, quieres decir que hube cambio en la secuencia y la nueva secuencia es la que esta en lsParadasSequencia.
+ * + * Si el parametro lsParadasSequencia es null, no va a cambiar ni la secuencia ni las combinaciones
+ * + * @param ruta + * @param lsParadasSequencia + * @return + * @throws BusinessException + */ + public Ruta actualizacion(Ruta ruta, List lsParadasSequencia) throws BusinessException; + + public List obtenerTodos(); + + public Ruta obtenerID(Integer id); + + public Ruta suscribir(Ruta entidad, List lsParadasSequencia) throws BusinessException; + + public void generarCombinacion(Ruta ruta) throws BusinessException; + + public List buscaRuta(String palavraPesquisaRuta); + + public List buscaRutasFromOrgao(OrgaoConcedente orgao); + + public List buscarTodosEstos(Integer[] idRutas); + + public List buscarRutasPorEmpresas(List lsEmp); + + public Integer getNumSecuenciaOrigen(Integer rutaId, Integer origenId); + public Integer getNumSecuenciaDestino(Integer rutaId, Integer destinoId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SecretariaEmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SecretariaEmpresaService.java new file mode 100644 index 000000000..20c06c157 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SecretariaEmpresaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; + +public interface SecretariaEmpresaService extends GenericService { + + public List buscarPorSecretaria(Secretaria secretaria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SecretariaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SecretariaService.java new file mode 100644 index 000000000..bc39156ef --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SecretariaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface SecretariaService extends GenericService { + + public List buscar(String descsecretaria, String cvesecretaria); + + public List buscar(String descsecretaria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SegVKMService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SegVKMService.java new file mode 100644 index 000000000..21ab0ca5a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SegVKMService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.SegVKM; + +/** + * + * @author RJ + */ +public interface SegVKMService extends GenericService { + + public List buscar(String serie); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguradoraEmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguradoraEmpresaService.java new file mode 100644 index 000000000..21522ece5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguradoraEmpresaService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; + +public interface SeguradoraEmpresaService extends GenericService{ + public boolean existe(Empresa empresa, String serie); + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguroKmService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguroKmService.java new file mode 100644 index 000000000..efb922fa9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguroKmService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; +import java.util.List; + + +public interface SeguroKmService extends GenericService{ + + public List buscarPorOrgao(OrgaoConcedente orgao); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguroTarifaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguroTarifaService.java new file mode 100644 index 000000000..eba6ecc50 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SeguroTarifaService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; + + +public interface SeguroTarifaService extends GenericService{ + + public List buscarPorOrgao(OrgaoConcedente orgao); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SisdapService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SisdapService.java new file mode 100644 index 000000000..c481936ce --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SisdapService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +public interface SisdapService { + + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId); + + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/SistemaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/SistemaService.java new file mode 100644 index 000000000..14f1fa372 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/SistemaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Sistema; + +/** + * + * @author rodrigo + */ +public interface SistemaService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaCategoriaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaCategoriaService.java new file mode 100644 index 000000000..94f2f2350 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaCategoriaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface TarifaCategoriaService extends GenericService { + + public List buscar(Categoria categoria); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaHistService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaHistService.java new file mode 100644 index 000000000..d3bae2964 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaHistService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarifaHist; + +/** + * + * @author rodrigo + */ +public interface TarifaHistService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaKmService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaKmService.java new file mode 100644 index 000000000..15a9772c5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaKmService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; + +public interface TarifaKmService extends GenericService{ + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java new file mode 100644 index 000000000..e838e9496 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; + +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface TarifaMinimaService extends GenericService { + + public List pesquisarEspecifico(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda); + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda); + + public List buscarPorPlaza(Plaza plaza); + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda); + + public List pesquisar(BigDecimal valor, Moneda moneda, Plaza plaza, + Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio); + + public List pesquisar(Moneda moneda, Plaza plaza, + Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio, OrgaoConcedente orgaoConcedente); + + public List pesquisarOrigemDestinoTodos(Marca marca,Parada origem, Parada destino,ClaseServicio claseServicio, Moneda moneda); + + public List buscarPorMarca(Marca marca, Moneda moneda); + + public List buscarPorClaseServico(ClaseServicio claseServicio, Moneda moneda); + + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java new file mode 100644 index 000000000..5400ec9bc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java @@ -0,0 +1,140 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + + +public interface TarifaOficialService { + + /** + * Gera as tarifas de acordo o cálculo do coeficiente tarifário.
+ * + * Fórmula: (KM * Coeficiente Tarifório) + * + * Se o parametro ruta não for informado, será gerado tarifas para todas as + * rutas.
+ * + * Se o parametro orgaoConcedenteId não for informado, será gerado tarifas para todos os + * órgãos.
+ * + * Obs.: Essa operação apenas gera tarifas que ainda não esão geradas
+ * + * @param rutaId + * @param orgaoConcedenteId + * @return A quantidade de registros afetadas + */ + public Integer gerarTarifaPorCoeficiente(Integer rutaId, Integer orgaoConcedenteId, List idsEmpresas); + + + /** + * Atualiza as tarifas de acordo o cálculo do coeficiente tarifário.
+ * + * Fórmula: (KM * Coeficiente Tarifário) + * + * Se o parametro ruta não for informado, seró atualizado as tarifas para + * todas as rutas.
+ * + * + * Se o parametro orgaoConcedenteId não for informado, seró atualizado as tarifas para + * todos as órgãos.
+ * + * @param rutaId + * @param orgaoConcedenteId + * @return - Quantidade de tarifas atualizadas + */ + public Integer atualizarTarifaPorCoeficiente(Integer rutaId, Integer orgaoConcedenteId); + + + /** + * Gera o calculo de preço utilizando calculo por coeficiente ou pela kilometragem da ARTESP + * + * + * @param rudaId + * @param orgaoConcedenteId + * @param empresaId + * @throws BusinessException + */ + public void gerarAtualizarTarifa(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException ; + + /** + * Copia a tarifa oficial para a tabela de tarifa de acordo com a vigencia especificada.
+ * + * Se a tarifa não existe, ela é inserida. Se existe, a tarifa e os componentes do preços são atualizados
+ * + * @param vigenciaTarifa + */ + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro); + + /** + * Atualiza a taxa de embarque da entidade TarifaOficial.
+ * + * Para o cálculo, é usado a seguinte lógica:
+ * - Atualiza de acordo a tabela TAXA_EMBARQUE_PARADA por kilometragem
+ * - Atualiza de acordo a tabela TAXA_EMBARQUE por kilometragem
+ * - Atualiza de acordo a tabela TAXA_EMBARQUE_PARADA por valor fixo
+ * + * A sequencia acima indica a ordem de atualização da taxa de embarque.
+ * + * A taxa de embarque mais restritiva fica por último (TAXA_EMBARQUE_PARADA por valor fixo) + * + * @param rutaId - Se informado, será atualizado apenas a taxa de embarque da ruta informada + * @param orgaoConcedenteId - Se informado, será atualizado apenas a taxa de embarque do órgão informado + * @param gerarTabelaZerada - Indica se uma tabela zerada será gerada. Isso para a possibilidade de gerar apenas a taxa de embarque sem preço + * @param empresaId - Empresa para ser filtrada + * @throws BusinessException + */ + public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected) throws BusinessException; + + + /** + * Atualiza o seguro de acordo a kilometragem do trecho + * + * @param rutaId - Se informado, será filtrado pela ruta + * @param orgaoId -Se informado, será filtrado pelo orgão + */ + public void atualizarSeguroPorKm(Integer rutaId,Integer orgaoId) throws BusinessException; + + /** + * Atualiza o seguro de acordo o valor da tarifa + * + * @param rutaId - Se informado, seró filtrado pela ruta + * @param orgaoId -Se informado, será filtrado pelo orgão + * + */ + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException; + + + /** + * Executa tanto o {@link #atualizarSeguroPorKm(Integer, Integer)} quanto {@link #atualizarSeguroPorTarifa(Integer, Integer)} + * + * @param rutaId- Se informado, seró filtrado pela ruta + * @param orgaoId-Se informado, será filtrado pelo orgão + * @throws BusinessException + */ + public void atualizarSeguro(List lsRuta, Integer orgaoId) throws BusinessException; + + /** + * See {@link TarifaOficialDAO#aplicarArredondamentoTarifa(Integer, Integer)} + * @param orgaoConcedenteId -Se informado, será filtrado pelo orgão + */ + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Boolean taxaEmbarque) ; + + public void actualizacion(TarifaOficial tarifaOficial); + + public TarifaOficial obtenerID(Integer tarifaOficialId); + + public void borrar(TarifaOficial tarifaOficial); + + public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException ; + + public void atualizarPedagio(); + + public long obtenerCount(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaService.java new file mode 100644 index 000000000..d32280d63 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaService.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author rodrigo + */ +public interface TarifaService extends GenericService { + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda,ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, + Categoria categoria, TipoPuntoVenta tipoPuntoVenta); + + /** + * Método usado para checar se uma tarifa já está cadastrada no sistema. + * + * Uma tarifa é considerada única de acordo a marca, tramo, moneda, claseServicio, vigenciaTarifa, ruta e orgaoConcedente + * + * @param marca + * @param tramo + * @param moneda + * @param claseServicio + * @param vigenciaTarifa + * @param ruta + * @param orgaoConcedente + * @return + */ + public boolean existe(Marca marca, Tramo tramo, Moneda moneda,ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente); + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta); + + public List buscarPorVigencia(VigenciaTarifa vigencia,Empresa empresa); + + public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem,Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda); + + public List buscarExisteVigencia(VigenciaTarifa vigenciaTarifa); + + public Boolean generarTarifas(VigenciaTarifa vigencia, Marca marca); + + public boolean buscarTarifaExisteTramo(Tramo tramo); + + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; + + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaTipoptovtaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaTipoptovtaService.java new file mode 100644 index 000000000..8d6b28213 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarifaTipoptovtaService.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; + +/** + * + * @author rodrigo + */ +public interface TarifaTipoptovtaService + extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaCreditoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaCreditoService.java new file mode 100644 index 000000000..fadd79633 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaCreditoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; + +public interface TarjetaCreditoService extends GenericService { + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaFidelidadService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaFidelidadService.java new file mode 100644 index 000000000..d51daf1b1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaFidelidadService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; + +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TarjetaFidelidadService extends GenericService{ + + public List obtenerCantDesc(); + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaRecaudacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaRecaudacionService.java new file mode 100644 index 000000000..c634eb91e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaRecaudacionService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; + +/** + * + * @author Administrador + */ +public interface TarjetaRecaudacionService + extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaViajeService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaViajeService.java new file mode 100644 index 000000000..1e41f9c65 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TarjetaViajeService.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import org.zkoss.zul.Comboitem; + +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; + +public interface TarjetaViajeService extends GenericService { + + public void grabarTarjetaViaje(List lsCorridaTramo); + + public void verificaCorridaDuplicada(List lsTarjetaViaje, boolean todasTarjetas); + + public List buscarTarjetaPorFiltros(Integer autoIni, Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa); + + public List generarArchivoNomina(Date fecIni, Date fecFin); + + public void actulizarTarjetasEnviadas(List lsTarjetas); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbLevanteCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbLevanteCtrlService.java new file mode 100644 index 000000000..451c6a179 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbLevanteCtrlService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; + +public interface TaxaEmbLevanteCtrlService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueKmService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueKmService.java new file mode 100644 index 000000000..8533169ef --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueKmService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueKmService extends GenericService{ + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueParadaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueParadaService.java new file mode 100644 index 000000000..0c1bd73f3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueParadaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueParadaService extends GenericService { + + public List buscarPorLocalidade(Parada parada); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCambioCiudadService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCambioCiudadService.java new file mode 100644 index 000000000..eddbfe023 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCambioCiudadService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; + +/** + * + * @author Administrador + */ +public interface TipoCambioCiudadService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCambioCtrlService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCambioCtrlService.java new file mode 100644 index 000000000..9fcb5867f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCambioCtrlService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; + +/** + * + * @author Administrador + */ +public interface TipoCambioCtrlService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoConvenioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoConvenioService.java new file mode 100644 index 000000000..d88521326 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoConvenioService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; + +/** + * + * @author Shiro + */ +public interface TipoConvenioService extends GenericService{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCorteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCorteService.java new file mode 100644 index 000000000..3afd5ddde --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCorteService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoCorteService extends GenericService { + + public List buscar(String desctipo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCortesiaDescuentoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCortesiaDescuentoService.java new file mode 100644 index 000000000..0d548a4c4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCortesiaDescuentoService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaDescuentoService extends + GenericService { + + public List pesquisar(TipoCortesia tipoCortesia); + + public List Onchangue(TipoCortesia tp); + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia); + + public List obtenerTipoCortesia(int i); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCortesiaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCortesiaService.java new file mode 100644 index 000000000..a0fbe7acc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoCortesiaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaService extends GenericService { + + public List buscar(String descTipo); + + public List obtenerGrupoCortesia(int i); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java new file mode 100644 index 000000000..ccd9a3819 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +public interface TipoDocAutobusService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoDomicilioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoDomicilioService.java new file mode 100644 index 000000000..46834d8b7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoDomicilioService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoDomicilioService extends GenericService { + + public List buscar(String desctipo, String cvetipodomicilio); + + public List buscarClave(String cvetipodomicilio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEmpleadoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEmpleadoService.java new file mode 100644 index 000000000..001dbf4df --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEmpleadoService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; + +/** + * + * @author Shiro + */ +public interface TipoEmpleadoService extends GenericService{ + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraEmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraEmpresaService.java new file mode 100644 index 000000000..ee7a66209 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraEmpresaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; + +public interface TipoEventoExtraEmpresaService extends GenericService { + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra); + public TipoEventoExtraEmpresa suscribir(TipoEventoExtraEmpresa entidad); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java new file mode 100644 index 000000000..5328d56fe --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; + +public interface TipoEventoExtraService { + + public List buscar(String descingreso); + + public List obtenerTodos(); + + public TipoEventoExtra obtenerID(Integer id); + + public TipoEventoExtra suscribir(TipoEventoExtra entidad) throws ValidacionCampoException; + + public TipoEventoExtra actualizacion(TipoEventoExtra entidad) throws ValidacionCampoException; + + public void borrar(TipoEventoExtra entidad) throws BusinessException; +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoIdentificacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoIdentificacionService.java new file mode 100644 index 000000000..79f1f4f6c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoIdentificacionService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; + +public interface TipoIdentificacionService { + + public List obtenerTodos(); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoMovimientoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoMovimientoService.java new file mode 100644 index 000000000..b232d3238 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoMovimientoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoMovimientoService extends GenericService { + + public List buscar(String descmovimiento); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java new file mode 100644 index 000000000..62392e7b9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoOcupacionService extends GenericService { + + public List buscar(String desctipo, String cvetipoocupacion); + + public List buscarClave(String cvetipoocupacion); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoParadaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoParadaService.java new file mode 100644 index 000000000..9f231194e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoParadaService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Administrador + */ +public interface TipoParadaService { + + public List obtenerTodos(); + + public TipoParada obtenerID(Integer id); + + public TipoParada suscribir(TipoParada entidad); + + public TipoParada actualizacion(TipoParada entidad); + + public void borrar(TipoParada entidad) throws RegistroConDependenciaException; + + public List buscar(String desctipo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoPuntoVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoPuntoVentaService.java new file mode 100644 index 000000000..803c232a2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoPuntoVentaService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoPuntoVentaService { + + public List obtenerTodos(); + + public List obtenerTodosExceto(Short ... id); + + public TipoPuntoVenta obtenerID(Short id); + + public TipoPuntoVenta suscribir(TipoPuntoVenta entidad); + + public TipoPuntoVenta actualizacion(TipoPuntoVenta entidad); + + public void borrar(TipoPuntoVenta entidad); + + public List buscar(String desctipo); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoServicioService.java new file mode 100644 index 000000000..eea312b61 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoServicioService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoServicioService extends GenericService { + + public List buscar(String descservicio); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoTarifaPacoteService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoTarifaPacoteService.java new file mode 100644 index 000000000..fec103b14 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoTarifaPacoteService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface TipoTarifaPacoteService extends GenericService { + + public List buscaTipoTarifaPacote(Pacote pacote); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoVentaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoVentaService.java new file mode 100644 index 000000000..1ca70ba1a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TipoVentaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoVentaService extends GenericService{ + + public List buscar(String desctipoventa); + + public TipoVenta obtenerID(Short tipoventaId); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoKmServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoKmServicioService.java new file mode 100644 index 000000000..7494b3776 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoKmServicioService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TramoKmServicioService extends GenericService { + + public List buscar(TramoKmServicio tramoKmServicio); + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoRutaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoRutaService.java new file mode 100644 index 000000000..558b9a70f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoRutaService.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.RutaTramoVO; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoCoeficienteVO; + + +/** + * + * @author Administrador + */ +public interface TramoRutaService { + /** + * Grava la nueva configuración de la ruta con los tramos. + * + * Si no existen los tramos, ellos son generados. + * + * + * @param rutaTramoVO + * @throws BusinessException - Si hay algun valor no valido; Si la ruta ya existe + */ + public Ruta generarTramosRutas(RutaTramoVO rutaTramoVO) throws BusinessException; + + /** + * Genera la combinacion de la ruta. + * + * @param rutaTramoVO + * @return + */ + public List generarCombinacion(RutaTramoVO rutaTramoVO); + + /** + * Renera los datos de regreso para la ruta informada + * @param rutaTramoVO + * @return + */ + public RutaTramoVO generarRutaRegreso(RutaTramoVO rutaTramoVO); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoService.java new file mode 100644 index 000000000..42d9fd4a4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoService.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Administrador + */ +public interface TramoService { + + public Tramo obtenerID(Integer id); + + public void borrar(Tramo entidad) throws BusinessException; + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino); + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino); + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via v); + + /** + * Hace la búsqueda del tramo que tiene origen - destino - via - clase servicio. + * + * @param origem + * @param destino + * @param via + * @param claseServicio + * @return + */ + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, ClaseServicio claseServicio); + + public Tramo buscar(Parada origem, Parada destino, Via via); + + /** + * Regreso los tramos con las paradas en secuencia. Ej.: Paradas A,B,C. Tramos A-B; B-C + */ + public List buscar(List lsParadas, Via via); + + public List buscarCveParada(String origen, String destino, String via); + + /** + * Grava los tramos en la lista con los km real y km del conductor en la via especificada. + * + * Se el tramo ya existie, cambia los valores, sino, graba un nuebo + * @param lsTramos + * @param via + */ + public void guardarTramosKm(List lsTramos,Via via); + + public List obtenerViasOrigemDestino(Parada origem, Parada destino); + + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) ; + + public Tramo suscribirActualizar(Tramo tramo) throws BusinessException ; + + /** + * Gerar a descrição automática do tramo + * + * @param origen + * @param destino + * @param via + * @return + */ + public String gerarDescripcionTramo(Parada origen, Parada destino, Via via); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoServicioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoServicioService.java new file mode 100644 index 000000000..1da68c4de --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoServicioService.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +/** + * + * @author Rafius + */ +public interface TramoServicioService extends GenericService { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramoServico(Tramo tramo, ClaseServicio clase); + + /** + * Hace la búsqueda del tramo servicio activo de acuerdo los parametros. + * + * @param origen + * @param destino + * @param via + * @param clase + * @return + */ + public TramoServicio buscar(Parada origen, Parada destino, Via via, ClaseServicio clase); + + /** + * Genera un nuevo registro de tramo y tramo servicio sino ya existen. + * + * Si el tramo y tramo tiempo existen, es retornado false. + * + * @param origen + * @param destino + * @param via + * @param kmsReal + * @param kmsConductor + * @param tiempoRecorrido + * @param claseServicio + * TODO + * @return - Si el tramo existe, return FALSE. Sino, retorna TRUE + */ + public boolean generarTramoTiempo(Parada origen, Parada destino, Via via, BigDecimal kmsReal, Date tiempoRecorrido, ClaseServicio claseServicio); + + /** + * {@link TramoServicioDAO#existenTiemposTramosEsquema(Integer)} + * + * @param esquemaCorridaId + * @return + */ + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoTiempoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoTiempoService.java new file mode 100644 index 000000000..6a0142b5f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TramoTiempoService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; + +/** + * + * @author Administrador + */ +public interface TramoTiempoService extends GenericService { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramo(Tramo tramo,ClaseServicio clase); + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/TurnoService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/TurnoService.java new file mode 100644 index 000000000..43d37a581 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/TurnoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Turno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TurnoService extends GenericService { + + public List buscar(String descturno); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioBancarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioBancarioService.java new file mode 100644 index 000000000..c1e7cb9b9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioBancarioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; + +/** + * + * @author Rafius + */ +public interface UsuarioBancarioService extends GenericService { +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java new file mode 100644 index 000000000..b8b979b62 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; + +public interface UsuarioEmpresaService extends GenericService { + + public List obtenerPorUsuario(Usuario usuario); + public List obtenerEmpresa(Usuario usuario) ; + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioPerfilService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioPerfilService.java new file mode 100644 index 000000000..9b91a737b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioPerfilService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface UsuarioPerfilService extends GenericService { + + public List obtenerPorUsuario(Usuario usuario); + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioService.java new file mode 100644 index 000000000..380c05dbc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioService.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author gleimar + */ +public interface UsuarioService { + + public List obtenerTodos(); + + public Usuario obtenerID(Integer id); + + public void borrar(Usuario entidad); + + public List buscarPeloNome(String nome); + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha); + + public List buscarPorEmpleado(Empleado get); + + public List buscarPelaCveUsuario(String claveUsuario); + + public Usuario suscribirActualizar(Usuario entidad, String senha, Perfil perfil) throws BusinessException; + + public Usuario cambiarContrasena(Usuario entidad, String senha) throws BusinessException; + + public List buscarPeloNomeLike(String nome); +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioSesionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioSesionService.java new file mode 100644 index 000000000..e7d19054e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioSesionService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; + +/** + * + * @author RJ Consultores + */ +public interface UsuarioSesionService { + + public UsuarioSesion actualizacion(UsuarioSesion entidad); + + public void borrar(UsuarioSesion entidad); + + public List buscar(Usuario usuario); + + public void liberarUsuario(Usuario usuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioUbicacionService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioUbicacionService.java new file mode 100644 index 000000000..f70ec436c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/UsuarioUbicacionService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface UsuarioUbicacionService extends GenericService { + + public List buscarPorUsuario(Usuario usuario); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/VendaEmbarcadaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/VendaEmbarcadaService.java new file mode 100644 index 000000000..cf76608ab --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/VendaEmbarcadaService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; + +public interface VendaEmbarcadaService { + + public int gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws BusinessException; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/ViaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/ViaService.java new file mode 100644 index 000000000..84579ccf6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/ViaService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Administrador + */ +public interface ViaService { + + public List obtenerTodos(); + + public Via obtenerID(Integer id); + + public Via suscribir(Via entidad); + + public Via actualizacion(Via entidad); + + public void borrar(Via entidad) throws RegistroConDependenciaException; + + public List buscar(String nombvia); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/VigenciaTarifaService.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/VigenciaTarifaService.java new file mode 100644 index 000000000..082f32590 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/VigenciaTarifaService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import java.util.Date; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface VigenciaTarifaService extends GenericService { + + public List pesquisar(Date inicio, Date fim); + + /** + * Regresa las vigencia que traslapa + * @param vigenciaTarifa + * @return + */ + public List buscarVigenciasIntervalo(VigenciaTarifa vigenciaTarifa); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoBoletoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoBoletoServiceImpl.java new file mode 100644 index 000000000..366174c20 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoBoletoServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.service.AbastoBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("abastoBoletoService") +public class AbastoBoletoServiceImpl implements AbastoBoletoService { + + @Autowired + private AbastoBoletoDAO abastoBoletoDAO; + + @Override + public List obtenerTodos() { + return abastoBoletoDAO.obtenerTodos(); + } + + @Override + public AbastoBoleto obtenerID(Integer id) { + return abastoBoletoDAO.obtenerID(id); + } + + @Transactional + public AbastoBoleto suscribir(AbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return abastoBoletoDAO.suscribir(entidad); + } + + @Transactional + public AbastoBoleto actualizacion(AbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return abastoBoletoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + abastoBoletoDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java new file mode 100644 index 000000000..7881fe1d6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.service.AbastoCentralService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("abastoCentralService") +public class AbastoCentralServiceImpl implements AbastoCentralService { + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + public List obtenerTodos() { + return abastoCentralDAO.obtenerTodos(); + } + + public AbastoCentral obtenerID(Long id) { + return abastoCentralDAO.obtenerID(id); + } + + public AbastoCentral suscribir(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + return abastoCentralDAO.suscribir(entidad); + } + + public AbastoCentral actualizacion(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + return abastoCentralDAO.actualizacion(entidad); + } + + public void borrar(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + entidad.setActivo(Boolean.FALSE); + abastoCentralDAO.borrar(entidad); + } + + private void setUsuarioFecmodifActivo(AbastoCentral entidad){ + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + public List buscaBilhetesPorAidf(Aidf aidf) { + List bilhetes = abastoCentralDAO.buscaBilhetesPorAidf(aidf); + return bilhetes; + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf) { + abastoCentralDAO.borrarLosQueTienenAIDF(aidf); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java new file mode 100644 index 000000000..91c2a43c3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.service.AbastoHistoService; + +@Service("abastoHistoService") +public class AbastoHistoServiceImpl implements AbastoHistoService { + + + @Autowired + private AbastoHistoDAO abastoHistoDAO; + + @Override + public List obtenerTodos() { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto obtenerID(Long id) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto suscribir(AbastoHisto entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto actualizacion(AbastoHisto entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void borrar(AbastoHisto entidad) { + // TODO Auto-generated method stub + + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf) { + abastoHistoDAO.borrarLosQueTienenAIDF(aidf); + } + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java new file mode 100644 index 000000000..7ea9a84a3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java @@ -0,0 +1,132 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.sql.Connection; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.dao.AidfEspecieDAO; +import com.rjconsultores.ventaboletos.dao.AidfTipoDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.service.AidfService; +import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +@Service("aidfService") +public class AidfServiceImpl implements AidfService { + + private static final Integer TIPO_FORMULARIO_CONTINUO = 1; + private static final Integer TIPO_VENDA_MANUAL = 2; + + @Autowired + private AidfDAO aidfDAO; + + @Autowired + private AidfEspecieDAO aidfEspecieDAO; + + @Autowired + private AidfTipoDAO aidfTipoDAO; + + @Autowired + private MovimentacionBilhetesService movimentacionBilhetesService; + + public List obtenerTodos() { + return aidfDAO.obtenerTodos(); + } + + @Transactional + public Aidf obtenerID(Long id) { + return aidfDAO.obtenerID(id); + } + + @Transactional + public Aidf suscribir(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + + Aidf aidf = aidfDAO.suscribir(entidad); + + if(aidf != null) + movimentacionBilhetesService.realizaAdquisicionBilhetes(aidf); + + return aidf; + } + + @Transactional + public Aidf actualizacion(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + return aidfDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + entidad.setActivo(Boolean.FALSE); + aidfDAO.borrar(entidad); + } + + private void setUsuarioFecmodifActivo(Aidf entidad){ + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + public List obtenerTodosAdifEspecie() { + return aidfEspecieDAO.obtenerTodos(); + } + + public List obtenerTodosAdifTipo() { + return aidfTipoDAO.obtenerTodos(); + } + + public List buscaAidfsPorEmpresas(List empresas) { + List aidfs = aidfDAO.buscaAidfsPorEmpresas(empresas); + return aidfs; + } + + public List obtenerAidfFromSerieDocfiscal(String serie,String docfiscal, Connection conn){ + return aidfDAO.obtenerAidfFromSerieDocfiscal( serie, docfiscal, conn ); + } + + public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn){ + + List list = obtenerAidfFromSerieDocfiscal(entidad.getSerie() , entidad.getDocfiscal().replaceAll("[^a-zA-Z0-9]+","") , conn); + + for (AidfVo aidf : list) { + // desconsiderar o próprio ID, caso contrário o erro de validação sempre acontece qdo o registro é editado. + if (aidf.getAidfId().compareTo(entidad.getAidfId()) != 0) { + if (aidf.getDocfiscal().trim().equals(entidad.getDocfiscal().replaceAll("[^a-zA-Z0-9]+", "").trim())) { + if (aidf.getSerie().trim().equals(entidad.getSerie().trim())) { + if ((Long.parseLong(entidad.getForminicial()) >= Long.parseLong(aidf.getForminicial()) && Long.parseLong(entidad.getForminicial()) <= Long.parseLong(aidf.getFormfinal())) + || (Long.parseLong(entidad.getFormfinal()) >= Long.parseLong(aidf.getForminicial()) && Long.parseLong(entidad.getFormfinal()) <= Long.parseLong(aidf.getFormfinal()))) { + return aidf.getAidfId(); + } + } + } + } + } + return -1l; + } + + public Boolean validarDocFiscalPorEstado(Long idAidf, String docFiscal, Estado estado){ + return aidfDAO.existeAidfComCodFiscalEEstado(idAidf, docFiscal, estado); + } + + public Boolean validarTipoVenda(String tipoVenda, String serie, Integer idTipo) { + return !("M".equals(tipoVenda) + && ("UNIC".equals(serie) || TIPO_FORMULARIO_CONTINUO.equals(idTipo))); + } + + public Boolean validarVendaManual(Integer idTipo, String serie){ + return !(TIPO_VENDA_MANUAL.equals(idTipo) && "UNIC".equals(serie)); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AjusteEventoExtraServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AjusteEventoExtraServiceImpl.java new file mode 100644 index 000000000..8159e3318 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AjusteEventoExtraServiceImpl.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AjusteEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; +import com.rjconsultores.ventaboletos.service.AjusteEventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("ajusteEventoExtraService") +public class AjusteEventoExtraServiceImpl implements AjusteEventoExtraService { + + @Autowired + private AjusteEventoExtraDAO ajusteEventoExtraDAO; + + public List obtenerTodos() { + return ajusteEventoExtraDAO.obtenerTodos(); + } + + public AjusteEventoExtra obtenerID(Integer id) { + return ajusteEventoExtraDAO.obtenerID(id); + } + + @Transactional + public AjusteEventoExtra suscribir(AjusteEventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ajusteEventoExtraDAO.suscribir(entidad); + } + + @Transactional + public AjusteEventoExtra actualizacion(AjusteEventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ajusteEventoExtraDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AjusteEventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ajusteEventoExtraDAO.actualizacion(entidad); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AlertaCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AlertaCtrlServiceImpl.java new file mode 100644 index 000000000..3e6fe8cb0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AlertaCtrlServiceImpl.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AlertaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AlertaCtrlService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("alertaCtrlService") +public class AlertaCtrlServiceImpl implements AlertaCtrlService { + + @Autowired + private AlertaCtrlDAO alertaCtrlDAO; + + @Autowired + private RutaService rutaService; + + public List obtenerTodos() { + return alertaCtrlDAO.obtenerTodos(); + } + + public AlertaCtrl obtenerID(Integer id) { + return alertaCtrlDAO.obtenerID(id); + } + + @Transactional(rollbackFor=BusinessException.class) + public AlertaCtrl suscribirActualizar(AlertaCtrl entidad) throws BusinessException { + if (entidad.getRuta() != null) { + if (!rutaService.paradaExisteEnLaRuta(entidad.getOrigem(), entidad.getRuta())) { + throw new BusinessException("editarAlertaCtrlController.MSG.origenNoExisteRuta"); + } + if (!rutaService.paradaExisteEnLaRuta(entidad.getDestino(), entidad.getRuta())) { + throw new BusinessException("editarAlertaCtrlController.MSG.destinoNoExisteRuta"); + } + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getAlertactrlId() == null) { + return alertaCtrlDAO.suscribir(entidad); + } else { + return alertaCtrlDAO.actualizacion(entidad); + } + } + @Transactional + public void borrar(AlertaCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + alertaCtrlDAO.actualizacion(entidad); + } + + public List buscar(Parada origem, Parada destino, Ruta ruta, ClaseServicio claseServicio, Integer tiempoAlta, Integer tiempoBaja, BigDecimal percAlta, + BigDecimal percBaja) { + return alertaCtrlDAO.buscar(origem, destino, ruta, claseServicio, tiempoAlta, tiempoBaja, percAlta, percBaja); + } + + public List buscarCorrida(Corrida corrida) { + return alertaCtrlDAO.buscarCorrida(corrida); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AliasServicoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AliasServicoServiceImpl.java new file mode 100644 index 000000000..4c503e3f4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AliasServicoServiceImpl.java @@ -0,0 +1,97 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AliasServicoDAO; +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AliasServicoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("aliasServicoService") +public class AliasServicoServiceImpl implements AliasServicoService { + + @Autowired + private AliasServicoDAO aliasServicoDAO; + + public List obtenerTodos() { + return aliasServicoDAO.obtenerTodos(); + } + + public AliasServico obtenerID(Integer id) { + return aliasServicoDAO.obtenerID(id); + } + + @Transactional + public AliasServico suscribirActualizar(AliasServico entidad) throws BusinessException { + + if ( (entidad.getOrigen() == null) || (entidad.getDestino() == null) || (entidad.getAliasDestino()== null) || (entidad.getAliasOrigen()== null) || (entidad.getRuta()== null)){ + throw new BusinessException("editarAliasServicoController.MSG.camposObrigatorios"); + } + + List lsBusca = Collections.emptyList(); + + if (entidad.getCorridaId() != null){ + lsBusca = aliasServicoDAO.buscar(entidad.getOrigen().getParadaId(), entidad.getDestino().getParadaId(), entidad.getRuta().getRutaId(), entidad.getCorridaId()); + }else{ + lsBusca = aliasServicoDAO.buscarAliasSemCorrida(entidad.getOrigen().getParadaId(), entidad.getDestino().getParadaId(), entidad.getRuta().getRutaId()); + } + + if (!lsBusca.isEmpty()){ + boolean existe = false; + + for(AliasServico as : lsBusca){ + if (as.equals(entidad)){ + existe = true; + } + } + + if (!existe){ + throw new BusinessException("editarAliasServicoController.MSG.registroYaExiste"); + } + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getAliasServicoId() == null){ + return aliasServicoDAO.suscribir(entidad); + }else{ + return aliasServicoDAO.actualizacion(entidad); + } + } + + @Transactional + public void borrar(AliasServico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + aliasServicoDAO.actualizacion(entidad); + } + + @Override + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo) { + return aliasServicoDAO.buscarPorLinhaEmpresa(linhas, empresas, tiposClasses, orgaos, prefixo); + } + + @Override + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida) { + return aliasServicoDAO.existe(origem, destino, linha, idCorrida); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ArticuloServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ArticuloServiceImpl.java new file mode 100644 index 000000000..1f537cc74 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ArticuloServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.Articulo; +import com.rjconsultores.ventaboletos.service.ArticuloService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("articuloService") +public class ArticuloServiceImpl implements ArticuloService { + + @Autowired + private ArticuloDAO articuloDAO; + + public List obtenerTodos() { + return articuloDAO.obtenerTodos(); + } + + public Articulo obtenerID(Integer id) { + return articuloDAO.obtenerID(id); + } + + @Transactional + public Articulo suscribir(Articulo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return articuloDAO.suscribir(entidad); + } + + @Transactional + public Articulo actualizacion(Articulo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return articuloDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Articulo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + articuloDAO.actualizacion(entidad); + } + + public List buscar(String descarticulo) { + return articuloDAO.buscar(descarticulo); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java new file mode 100644 index 000000000..08fb0e71b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AsientoExclusivoDAO; +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; +import com.rjconsultores.ventaboletos.service.AsientoExclusivoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("asientoExclusivoService") +public class AsientoExclusivoServiceImpl implements AsientoExclusivoService { + + @Autowired + private AsientoExclusivoDAO asientoExclusivoDAO; + + public List obtenerTodos() { + return asientoExclusivoDAO.obtenerTodos(); + } + + public AsientoExclusivo obtenerID(Integer id) { + return asientoExclusivoDAO.obtenerID(id); + } + + @Transactional + public AsientoExclusivo suscribir(AsientoExclusivo entidad) { + Integer usuarioId = 1; + if (UsuarioLogado.getUsuarioLogado() != null){ + usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + } + entidad.setUsuarioId(usuarioId); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return asientoExclusivoDAO.suscribir(entidad); + } + + @Transactional + public AsientoExclusivo actualizacion(AsientoExclusivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return asientoExclusivoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AsientoExclusivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + asientoExclusivoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java new file mode 100644 index 000000000..91092089b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AutobusDocDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; +import com.rjconsultores.ventaboletos.service.AutobusDocService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("autobusDocService") +public class AutobusDocServiceImpl implements AutobusDocService { + + @Autowired + private AutobusDocDAO autobusDocDAO; + + public List obtenerTodos() { + return autobusDocDAO.obtenerTodos(); + } + + public AutobusDoc obtenerID(Integer id) { + return autobusDocDAO.obtenerID(id); + } + + public List obtenerPorAutobus(Autobus autobus){ + return autobusDocDAO.obtenerPorAutobus(autobus); + } + + @Transactional + public AutobusDoc suscribir(AutobusDoc entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDocDAO.suscribir(entidad); + } + + @Transactional + public AutobusDoc actualizacion(AutobusDoc entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDocDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AutobusDoc entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autobusDocDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutobusServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutobusServiceImpl.java new file mode 100644 index 000000000..d8b066fdc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutobusServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AutobusDAO; +import com.rjconsultores.ventaboletos.dao.DiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.service.AutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("autobusService") +public class AutobusServiceImpl implements AutobusService { + + @Autowired + private AutobusDAO autobusDAO; + @Autowired + private DiagramaAutobusDAO diagramaAutobusDAO; + + public List obtenerTodos() { + return autobusDAO.obtenerTodos(); + } + + public Autobus obtenerID(Integer id) { + return autobusDAO.obtenerID(id); + } + + @Transactional + public Autobus suscribir(Autobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDAO.suscribir(entidad); + } + + @Transactional + public Autobus actualizacion(Autobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Autobus entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autobusDAO.actualizacion(entidad); + } + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus) { + return autobusDAO.buscar(numautobus, diagramaAutobus); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizaFolioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizaFolioServiceImpl.java new file mode 100644 index 000000000..caa016976 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizaFolioServiceImpl.java @@ -0,0 +1,286 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Articulo; +import com.rjconsultores.ventaboletos.entidad.Clasificacion; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.service.AbastoBoletoService; +import com.rjconsultores.ventaboletos.service.ArticuloService; +import com.rjconsultores.ventaboletos.service.AutorizaFolioService; +import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService; +import com.rjconsultores.ventaboletos.service.FolioPreimpresoService; +import com.rjconsultores.ventaboletos.service.RequisicionBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("autorizaFolioService") +public class AutorizaFolioServiceImpl implements AutorizaFolioService { + // Numero max de folios por estacion + public static final Integer MAX_CANT_FOLIOS = Integer.MAX_VALUE; + public static final Integer INICIO_FOLIO = 1; + + @Autowired + private ArticuloService articuloService; + @Autowired + private RequisicionBoletoService requisicionBoletoService; + @Autowired + private AbastoBoletoService abastoBoletoService; + @Autowired + private DetAbastoBoletoService detAbastoBoletoService; + @Autowired + private FolioPreimpresoService folioPreimpresoService; + + @Override + public void devolverFoliosAutomaticosImpressoraFiscal(final EstacionImpresora ei) { + + Empresa empresa = ei.getEmpresa(); + FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(ei.getEstacion(), empresa); + + if (folio != null) { + List lsDetAbasto = detAbastoBoletoService.buscabDetAbastoBoletoAutomatico(ei.getEstacion(), folio.getNumeserie()); + if (!lsDetAbasto.isEmpty()) { + + DetAbastoBoleto dab = lsDetAbasto.get(0); + + abastoBoletoService.borrar(dab.getAbastoBoleto()); + detAbastoBoletoService.borrar(dab); + folioPreimpresoService.borrar(folio); + } + } + } + + @Override + public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa, + Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion) { + + if (TipoMovimentacion.TIPO_ENVIO == tipoMovimentacion.getTipomovimentacionId() || + TipoMovimentacion.TIPO_TRANSFERENCIA == tipoMovimentacion.getTipomovimentacionId()) { + + FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(destino, empresaUsuario); + + RequisicionBoleto requisicionBoleto = geraRequisicionBoleto(aidf, destino, empresaUsuario); + AbastoBoleto abastoBoleto = geraAbastoBoleto(requisicionBoleto); + DetAbastoBoleto detAbastoBoleto = geraDetAbastoBoleto(abastoBoleto, numfolioinicial, numfoliofinal, numseriepreimpresa); + actualizaStatusRequisicion(requisicionBoleto); + + if (folio == null) { + FolioPreimpreso folioPreimpreso = geraFolioPreimpreso(detAbastoBoleto, numfolioinicial); + + if (folioPreimpreso.getFoliopreimpresoId() == null) + return Boolean.FALSE; + + } else { + actualizaFolioPreimpreso(folio, numseriepreimpresa, numfolioinicial); + } + } + + if (TipoMovimentacion.TIPO_TRANSFERENCIA == tipoMovimentacion.getTipomovimentacionId() || + TipoMovimentacion.TIPO_VOLVER == tipoMovimentacion.getTipomovimentacionId() || + TipoMovimentacion.TIPO_PERDIDO == tipoMovimentacion.getTipomovimentacionId()) + + detAbastoBoletoService.desabilitaDetAbastos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa); + + return Boolean.TRUE; + + } + + private RequisicionBoleto geraRequisicionBoleto(Aidf aidf, Estacion estacion, Empresa empresa) { + + Articulo articulo = articuloService.obtenerID(aidf.getAidfTipo().getAidftipoId()); + Clasificacion clasificacion = articulo.getClasificacion(); + + PuntoVenta puntoVenta = estacion.getPuntoVenta(); + + RequisicionBoleto requisicionBoleto = new RequisicionBoleto(); + requisicionBoleto.setArticulo(articulo); + requisicionBoleto.setCantfajilla(1L); + requisicionBoleto.setClasificacion(clasificacion); + requisicionBoleto.setEstacion(estacion); + requisicionBoleto.setPuntoVenta(puntoVenta); + requisicionBoleto.setStatusenvio(Boolean.TRUE); + requisicionBoleto.setEmpresa(empresa); + + return requisicionBoletoService.suscribir(requisicionBoleto); + } + + private DetAbastoBoleto geraDetAbastoBoleto(AbastoBoleto abastoBoleto, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) { + + Integer statusoperacion = 1; + Long nummovimiento = detAbastoBoletoService.getSecuencia(); + + DetAbastoBoleto detAbastoBoleto = new DetAbastoBoleto(); + detAbastoBoleto.setAbastoBoleto(abastoBoleto); + detAbastoBoleto.setNummovimiento(nummovimiento); + detAbastoBoleto.setNumseriepreimpresa(numseriepreimpresa.trim()); + detAbastoBoleto.setNumfolioinicial(numfolioinicial.trim()); + detAbastoBoleto.setNumfoliofinal(numfoliofinal.trim()); + detAbastoBoleto.setStatusfirma(Boolean.TRUE); + detAbastoBoleto.setStatusoperacion(statusoperacion); + detAbastoBoleto.setStatusenvio(Boolean.TRUE); + + return detAbastoBoletoService.suscribir(detAbastoBoleto); + } + + private void actualizaStatusRequisicion(RequisicionBoleto requisicionBoleto) { + requisicionBoleto.setStatusenvio(Boolean.FALSE); + requisicionBoletoService.actualizacion(requisicionBoleto); + } + + private FolioPreimpreso geraFolioPreimpreso(DetAbastoBoleto detAbastoBoleto, String numfoliopreimpreso) { + + AbastoBoleto abastoBoleto = detAbastoBoleto.getAbastoBoleto(); + + FolioPreimpreso folioPreimpreso = new FolioPreimpreso(); + folioPreimpreso.setEmpresa(abastoBoleto.getEmpresa()); + folioPreimpreso.setEstacion(abastoBoleto.getEstacion()); + folioPreimpreso.setFoliopreimpreso(numfoliopreimpreso); + folioPreimpreso.setNodoId(1); + folioPreimpreso.setNumeserie(detAbastoBoleto.getNumseriepreimpresa()); + folioPreimpreso.setPuntoVenta(abastoBoleto.getPuntoventa()); + folioPreimpreso.setIndreplica(NumberUtils.LONG_ZERO); + + return folioPreimpresoService.suscribir(folioPreimpreso); + } + + private FolioPreimpreso actualizaFolioPreimpreso(FolioPreimpreso folioPreimpreso, String serieFoliopreimpreso, String numfoliopreimpreso) { + + folioPreimpreso.setFoliopreimpreso(numfoliopreimpreso); + folioPreimpreso.setNumeserie(serieFoliopreimpreso); + + return folioPreimpresoService.actualizacion(folioPreimpreso); + } + + @Override + public String noChequeFolioPreimpresos(EstacionImpresora estacionImpresora, boolean isImpressoraFiscal) { + + Empresa empresa = estacionImpresora.getEmpresa(); + FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(estacionImpresora.getEstacion(), empresa); + + // condição para qd o folio foi gerado indevidamente pelo cliente de venda. + // antes de a rotina abaixo ter sido executada se o numserie é 0, é um folio inválido + if ((folio != null) && (folio.getNumeserie().equals("0"))) { + folioPreimpresoService.borrar(folio); + folio = null; + } + + if ((folio != null) && isImpressoraFiscal) { + return "estacionServiceImpl.msg.noChequeFolioPreimpresos"; + } + + if (folio == null) { + RequisicionBoleto requisicionBoleto = geraRequisicionBoleto(estacionImpresora.getEstacion(), empresa); + AbastoBoleto abastoBoleto = geraAbastoBoleto(requisicionBoleto); + DetAbastoBoleto detAbastoBoleto = geraDetAbastoBoleto(abastoBoleto); + actualizaStatusRequisicion(requisicionBoleto); + + FolioPreimpreso folioPreimpreso = geraFolioPreimpreso(detAbastoBoleto); + if (folioPreimpreso.getFoliopreimpresoId() == null) { + return "MSG.Error"; + } + } + + return StringUtils.EMPTY; + } + + private RequisicionBoleto geraRequisicionBoleto(Estacion estacion, Empresa empresa) { + + Articulo articulo = articuloService.obtenerID(Articulo.TIPO_VENDA); + Clasificacion clasificacion = articulo.getClasificacion(); + + PuntoVenta puntoVenta = estacion.getPuntoVenta(); + + RequisicionBoleto requisicionBoleto = new RequisicionBoleto(); + requisicionBoleto.setArticulo(articulo); + requisicionBoleto.setCantfajilla(1L); + requisicionBoleto.setClasificacion(clasificacion); + requisicionBoleto.setEstacion(estacion); + requisicionBoleto.setPuntoVenta(puntoVenta); + requisicionBoleto.setStatusenvio(Boolean.TRUE); + requisicionBoleto.setEmpresa(empresa); + + return requisicionBoletoService.suscribir(requisicionBoleto); + } + + private AbastoBoleto geraAbastoBoleto(RequisicionBoleto requisicionBoleto) { + + Date fechaHrReq = requisicionBoleto.getFecmodif(); + + Date now = Calendar.getInstance().getTime(); + + Long numRequisicion = Long.parseLong(requisicionBoleto.getRequisicionboletoId().toString()); + + AbastoBoleto abastoboleto = new AbastoBoleto(); + abastoboleto.setNumservidor(1); + abastoboleto.setNumrequisicion(numRequisicion); + abastoboleto.setCantfajilla(requisicionBoleto.getCantfajilla()); + abastoboleto.setEstacion(requisicionBoleto.getEstacion()); + abastoboleto.setArticulo(requisicionBoleto.getArticulo()); + abastoboleto.setClasificacion(requisicionBoleto.getClasificacion()); + abastoboleto.setPuntoventa(requisicionBoleto.getPuntoVenta()); + abastoboleto.setPuntoventacentral(requisicionBoleto.getPuntoVenta()); + abastoboleto.setEmpresa(requisicionBoleto.getEmpresa()); + abastoboleto.setFechorreq(fechaHrReq); + abastoboleto.setStatusfirma(2); + abastoboleto.setStatusEnvio(1); + abastoboleto.setUsuarioreqId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + abastoboleto.setFechorfirma(now); + abastoboleto.setFechorgeneracion(now); + abastoboleto.setUsuariogeneracionId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return abastoBoletoService.suscribir(abastoboleto); + } + + private DetAbastoBoleto geraDetAbastoBoleto(AbastoBoleto abastoBoleto) { + + Long nummovimiento = detAbastoBoletoService.getSecuencia(); + + Integer statusoperacion = 1; + String numseriepreimpresa = nummovimiento.toString() + abastoBoleto.getEmpresa().getEmpresaId().toString(); + String numfolioinicial = INICIO_FOLIO.toString(); + String numfoliofinal = MAX_CANT_FOLIOS.toString(); + + DetAbastoBoleto detAbastoBoleto = new DetAbastoBoleto(); + detAbastoBoleto.setAbastoBoleto(abastoBoleto); + detAbastoBoleto.setNummovimiento(nummovimiento); + detAbastoBoleto.setNumseriepreimpresa(numseriepreimpresa.trim()); + detAbastoBoleto.setNumfolioinicial(numfolioinicial.trim()); + detAbastoBoleto.setNumfoliofinal(numfoliofinal.trim()); + detAbastoBoleto.setStatusfirma(Boolean.TRUE); + detAbastoBoleto.setStatusoperacion(statusoperacion); + detAbastoBoleto.setStatusenvio(Boolean.TRUE); + + return detAbastoBoletoService.suscribir(detAbastoBoleto); + } + + private FolioPreimpreso geraFolioPreimpreso(DetAbastoBoleto detAbastoBoleto) { + + AbastoBoleto abastoBoleto = detAbastoBoleto.getAbastoBoleto(); + + FolioPreimpreso folioPreimpreso = new FolioPreimpreso(); + folioPreimpreso.setEmpresa(abastoBoleto.getEmpresa()); + folioPreimpreso.setEstacion(abastoBoleto.getEstacion()); + folioPreimpreso.setFoliopreimpreso(INICIO_FOLIO.toString()); + folioPreimpreso.setNodoId(1); + folioPreimpreso.setNumeserie(detAbastoBoleto.getNumseriepreimpresa()); + folioPreimpreso.setPuntoVenta(abastoBoleto.getPuntoventa()); + folioPreimpreso.setIndreplica(NumberUtils.LONG_ZERO); + + return folioPreimpresoService.suscribir(folioPreimpreso); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionPerfilServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionPerfilServiceImpl.java new file mode 100644 index 000000000..3cf2b3431 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionPerfilServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AutorizacionPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.service.AutorizacionPerfilService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("autorizacionPerfilService") +public class AutorizacionPerfilServiceImpl implements AutorizacionPerfilService { + + @Autowired + private AutorizacionPerfilDAO autorizacionPerfilDAO; + + public List obtenerTodos() { + return autorizacionPerfilDAO.obtenerTodos(); + } + + public AutorizacionPerfil obtenerID(Integer id) { + return autorizacionPerfilDAO.obtenerID(id); + } + + @Transactional + public AutorizacionPerfil suscribir(AutorizacionPerfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionPerfilDAO.suscribir(entidad); + } + + @Transactional + public AutorizacionPerfil actualizacion(AutorizacionPerfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionPerfilDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AutorizacionPerfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autorizacionPerfilDAO.actualizacion(entidad); + } + + public List buscar(Autorizacion autorizacion, Perfil perfil) { + return autorizacionPerfilDAO.buscar(autorizacion, perfil); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionServiceImpl.java new file mode 100644 index 000000000..feed90bdb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AutorizacionDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.service.AutorizacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("autorizacionService") +public class AutorizacionServiceImpl implements AutorizacionService { + + @Autowired + private AutorizacionDAO autorizacionDAO; + + public List obtenerTodos() { + return autorizacionDAO.obtenerTodos(); + } + + public Autorizacion obtenerID(Integer id) { + return autorizacionDAO.obtenerID(id); + } + + @Transactional + public Autorizacion suscribir(Autorizacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionDAO.suscribir(entidad); + } + + @Transactional + public Autorizacion actualizacion(Autorizacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Autorizacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autorizacionDAO.actualizacion(entidad); + } + + public List buscar(String nombautorizacion, String descautorizacion) { + return autorizacionDAO.buscar(nombautorizacion, descautorizacion); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/BancoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/BancoServiceImpl.java new file mode 100644 index 000000000..cc972dd03 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/BancoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.BancoDAO; +import com.rjconsultores.ventaboletos.entidad.Banco; +import com.rjconsultores.ventaboletos.service.BancoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("bancoService") +public class BancoServiceImpl implements BancoService { + + @Autowired + private BancoDAO bancoDAO; + + public List obtenerTodos() { + return bancoDAO.obtenerTodos(); + } + + public Banco obtenerID(Integer id) { + return bancoDAO.obtenerID(id); + } + + @Transactional + public Banco suscribir(Banco entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return bancoDAO.suscribir(entidad); + } + + @Transactional + public Banco actualizacion(Banco entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return bancoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Banco entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + bancoDAO.actualizacion(entidad); + } + + public List buscar(Banco banco) { + return bancoDAO.buscar(banco); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java new file mode 100644 index 000000000..0361c9f7b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.CalcularPeajeService; + +@Service("calcularPeajeService") +public class CalcularPeajeServiceImpl implements CalcularPeajeService{ + + @Autowired + private CalcularPeajeDAO calcularPeajeDAO; + + @Override + public List buscarCasetasPeajeWithinTramo(Ruta ruta){ + return calcularPeajeDAO.buscarCasetasPeajeWithinTramo(ruta); + } + + @Override + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc){ + return calcularPeajeDAO.buscarRutaWithCasetaPeajeFromOrgao(oc); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao){ + return calcularPeajeDAO.gerarSQLInserirPeajes(lsRuta, orgao); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CalculoComissaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CalculoComissaoServiceImpl.java new file mode 100644 index 000000000..16c3ef7ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CalculoComissaoServiceImpl.java @@ -0,0 +1,776 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayOutputStream; +import java.math.BigDecimal; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.ComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao.Receita; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.MimeType; +import com.rjconsultores.ventaboletos.exception.ComissaoException; +import com.rjconsultores.ventaboletos.service.CalculoComissaoService; +import com.rjconsultores.ventaboletos.service.ComissaoService; +import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.DescontoComissaoService; +import com.rjconsultores.ventaboletos.service.EmpresaImpostoService; +import com.rjconsultores.ventaboletos.service.PtovtaComissaoService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.SendMail; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoDesconto; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoDesconto.TipoDesconto; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo; + +@Service("calculoComissaoService") +public class CalculoComissaoServiceImpl implements CalculoComissaoService { + + private static final Logger log = LoggerFactory.getLogger(CalculoComissaoServiceImpl.class); + private static final BigDecimal CEM = BigDecimal.TEN.multiply(BigDecimal.TEN); + + @Autowired + private PtovtaComissaoService ptovtaComissaoService; + + @Autowired + private EmpresaImpostoService empresaImpostoService; + + @Autowired + private ComissaoService comissaoService; + + @Autowired + private ComissaoDAO comissaoDAO; + + @Autowired + private ConferenciaComissaoService conferenciaComissaoService; + + @Autowired + private DescontoComissaoService descontoComissaoService; + + @Autowired + private ConstanteService constanteService; + + public boolean validaCompetencia(Date periodo) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(periodo); + + int mes = calendario.get(Calendar.MONTH) + 1; + int ano = calendario.get(Calendar.YEAR); + + Calendar now = Calendar.getInstance(); + int mesNow = now.get(Calendar.MONTH) + 1; + int anoNow = now.get(Calendar.YEAR); + + if (anoNow == ano) { + if (mesNow > mes) { + return true; + } + + } else if (anoNow > ano) { + return true; + } + + return false; + } + + @Override + public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException { + + try { + + if (validaCompetencia(periodo)) { + + String competencia = DateUtil.getStringDate(periodo, "MM/yyyy"); + + if(conferenciaComissaoService.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta)) { + Comissao comissaoCadastrada = comissaoDAO.buscaComissaoVigencia(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), competencia); + if (comissaoCadastrada == null) { + + RegistroCalculo rc = realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), periodo); + + Comissao comissao = new Comissao(); + comissao.setCompetencia(competencia); + comissao.setEmpresaId(empresa.getEmpresaId()); + comissao.setPuntoVenta(puntoVenta); + comissao.setBonificacaoMetas(rc.getComissaoBonificaoMetas()); + comissao.setComissaoBpr(rc.getComissaoBPR()); + comissao.setEntregasPassagem(rc.getComissaoEntregaPassagem()); + comissao.setReceitaExcessobagagem(rc.getComissaoExcessoBagagem()); + comissao.setReceitaSeguroopcional(rc.getComissaoSegOpcional()); + comissao.setReceitaOutros(rc.getComissaoOutros()); + comissao.setRoyaties(rc.getRoyaties()); + comissao.setIssRetido(rc.getRetidoISS()); + + comissao.setIndPago(false); + comissao.setUsuarioPagamentoId(null); + comissao.setDataPagamento(null); + comissao.setDescontosEventuais(BigDecimal.ZERO); + comissao.setDescontosFixos(BigDecimal.ZERO); + + for (ComissaoDesconto cd : rc.getLsDescontos()) { + if (cd.getTipo().equals(TipoDesconto.EVENTUAL)) { + comissao.setDescontosEventuais(cd.getValorDesconto()); + } else if (cd.getTipo().equals(TipoDesconto.FIXO)) { + comissao.setDescontosFixos(cd.getValorDesconto()); + } + } + + comissao = comissaoService.suscribir(comissao); + } else if(!ignorarComissaoGerada){ + throw new ComissaoException("busquedaCalculoComissaoController.registro.exception", null, comissaoCadastrada.getPuntoVenta().getNombpuntoventa()); + } + } else { + throw new ComissaoException("busquedaCalculoComissaoController.conferenciaNaoEncerrada.exception", null, puntoVenta.getNombpuntoventa()); + } + } else { + throw new ComissaoException("busquedaCalculoComissaoController.competencia.exception"); + } + + } catch (ComissaoException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ComissaoException(e.getMessage(), e); + } + } + + @Override + public void cancelarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException { + + String competencia = DateUtil.getStringDate(periodo, "MM/yyyy"); + Comissao comissao = comissaoDAO.buscaComissaoVigencia(puntoVentaId, empresaId, competencia); + if (comissao != null) { + comissaoService.borrar(comissao); + + } else { + throw new ComissaoException("busquedaCalculoComissaoController.comissao.exception"); + } + } + + @Override + public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException { + return realizarCalculoComissao(puntoVentaId, empresaId, periodo); + } + + private BigDecimal calculoComisssaoBPR(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal bpr, BigDecimal gap) { + + // Comissão BPR = Receita Comissão * (% Com BPR) + BigDecimal recbpr = BigDecimal.ZERO; + BigDecimal receitaBPR = bpr.add(gap); + if (isAltaTemporada) { + recbpr = receitaBPR.multiply(ptovtaComissao.getPassagemAlta() != null ? ptovtaComissao.getPassagemAlta().divide(CEM) : BigDecimal.ZERO); + } else { + recbpr = receitaBPR.multiply(ptovtaComissao.getPassagemBaixa() != null ? ptovtaComissao.getPassagemBaixa().divide(CEM) : BigDecimal.ZERO); + } + + return recbpr; + } + + private BigDecimal calculoEntregaPassagem(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal gapImpressa, BigDecimal internet, int contImpressa) { + + // EntregaPassagem (Internet/Venda Impressão Posterior/Outros) + BigDecimal entregaPassagem = BigDecimal.ZERO; + BigDecimal receitaEntrega = gapImpressa.add(internet); + if(ptovtaComissao.getValorImpressaoGap() != null) { + if (BooleanUtils.toBoolean(ptovtaComissao.getIndimpressaogapporc())) { + entregaPassagem = receitaEntrega.multiply(ptovtaComissao.getValorImpressaoGap() != null ? ptovtaComissao.getValorImpressaoGap().divide(CEM) : BigDecimal.ZERO); + } else { + entregaPassagem = ptovtaComissao.getValorImpressaoGap() != null ? ptovtaComissao.getValorImpressaoGap().multiply(new BigDecimal(contImpressa)) : BigDecimal.ZERO; + } + } + + return entregaPassagem; + } + + private BigDecimal calculoExcessoBagagem(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal excBag) { + + // Comissão Excesso = Receita Excesso Bagagem * (% Com. Exc. Bag) + BigDecimal excessoBagagem = BigDecimal.ZERO; + if (isAltaTemporada) { + excessoBagagem = excBag.multiply(ptovtaComissao.getExcessoAlta() != null ? ptovtaComissao.getExcessoAlta().divide(CEM) : BigDecimal.ZERO); + } else { + excessoBagagem = excBag.multiply(ptovtaComissao.getExcessoBaixa() != null ? ptovtaComissao.getExcessoBaixa().divide(CEM) : BigDecimal.ZERO); + } + + return excessoBagagem; + } + + private BigDecimal calculoSeguroOpcional(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal segOpcional) { + + // Comissão Seg. Opcional = Receita Seguro Opcional * (% Com. Seg. Pol) + BigDecimal recsegOpcional = BigDecimal.ZERO; + if (isAltaTemporada) { + recsegOpcional = segOpcional.multiply(ptovtaComissao.getSeguroAlta() != null ? ptovtaComissao.getSeguroAlta().divide(CEM) : BigDecimal.ZERO); + } else { + recsegOpcional = segOpcional.multiply(ptovtaComissao.getSeguroBaixa() != null ? ptovtaComissao.getSeguroBaixa().divide(CEM) : BigDecimal.ZERO); + } + return recsegOpcional; + } + + private BigDecimal calculoOutros(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal outros) { + + // Comissão Seg. Opcional = Receita Seguro Opcional * (% Com. Seg. Pol) + BigDecimal recoutros = BigDecimal.ZERO; + if (isAltaTemporada) { + recoutros = outros.multiply(ptovtaComissao.getOutrosAlta() != null ? ptovtaComissao.getOutrosAlta().divide(CEM) : BigDecimal.ZERO); + } else { + recoutros = outros.multiply(ptovtaComissao.getOutrosBaixa() != null ? ptovtaComissao.getOutrosBaixa().divide(CEM) : BigDecimal.ZERO); + } + return recoutros; + } + + private Map calculoDescontos(Integer puntoVentaId, Integer empresaId, Date periodo, PtovtaComissao ptovtaComissao) { + + List lsDescontos = new ArrayList(); + BigDecimal valorDescontoTotal = BigDecimal.ZERO; + + Date inicioPeriodo = DateUtil.inicioFechaPeriodoMeses(periodo); + Date fimPeriodo = DateUtil.fimFechaPeriodoMeses(periodo); + List itensDescontos = descontoComissaoService.buscaDescontoComissaoPeriodo(puntoVentaId, empresaId, inicioPeriodo, fimPeriodo); + + for (DescontoComissao dc : itensDescontos) { + + BigDecimal valorDesconto = dc.getPreco(); + valorDescontoTotal = valorDescontoTotal.add(valorDesconto); + + ComissaoDesconto desconto = new ComissaoDesconto(); + if (dc.getDatafinal() == null) { + desconto.setTipo(TipoDesconto.FIXO); + } else { + desconto.setTipo(TipoDesconto.EVENTUAL); + } + desconto.setNomeDesconto(dc.getItemDesconto().getNomitemdesconto()); + desconto.setValorDesconto(valorDesconto); + + lsDescontos.add(desconto); + } + + Map respDescontos = new HashMap(); + respDescontos.put("LISTA_DESCONTOS", lsDescontos); + respDescontos.put("VALOR_DESCONTOS", valorDescontoTotal); + + return respDescontos; + } + + @SuppressWarnings("unchecked") + public RegistroCalculo realizarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException { + + PtovtaComissao ptovtaComissao = ptovtaComissaoService.buscarPuntaVentaEmpresa(puntoVentaId, empresaId); + if (ptovtaComissao != null) { + + List receitasBoleto = comissaoDAO.buscarReceitasComissoes(puntoVentaId, empresaId, periodo); + + Calendar calendario = Calendar.getInstance(); + calendario.setTime(periodo); + + int ultimodia = calendario.getActualMaximum(Calendar.DAY_OF_MONTH); + int mes = calendario.get(Calendar.MONTH) + 1; + int ano = calendario.get(Calendar.YEAR); + + List receitas = calculaReceitaComissao(empresaId, ptovtaComissao, receitasBoleto, ultimodia, mes, ano); + + RegistroCalculo rc = new RegistroCalculo(); + rc.setNombpuntoventa(ptovtaComissao.getPuntoventaId().getNombpuntoventa()); + rc.setNumPuntoVenta(ptovtaComissao.getPuntoventaId().getNumPuntoVenta()); + + BigDecimal comissaoBPR = BigDecimal.ZERO; + BigDecimal comissaoExcessoBagagem = BigDecimal.ZERO; + BigDecimal comissaoSegOpcional = BigDecimal.ZERO; + BigDecimal comissaoEntregaPassagem = BigDecimal.ZERO; + BigDecimal comissaoOutros = BigDecimal.ZERO; + BigDecimal receitaTotal = BigDecimal.ZERO; + + for (ComissaoReceita cr : receitas) { + receitaTotal = receitaTotal.add(cr.getReceitaComissao()); + comissaoBPR = comissaoBPR.add(cr.getComissaoBPRDiaria()); + comissaoEntregaPassagem = comissaoEntregaPassagem.add(cr.getComissaoEntregaPassagemDiaria()); + comissaoExcessoBagagem = comissaoExcessoBagagem.add(cr.getComissaoExcessoBagagemDiaria()); + comissaoSegOpcional = comissaoSegOpcional.add(cr.getComissaoSegOpcionalDiaria()); + comissaoOutros = comissaoOutros.add(cr.getComissaoOutrosDiaria()); + } + + rc.setLsReceitas(receitas); + + rc.setComissaoBPR(comissaoBPR); + rc.setComissaoExcessoBagagem(comissaoExcessoBagagem); + rc.setComissaoSegOpcional(comissaoSegOpcional); + rc.setComissaoEntregaPassagem(comissaoEntregaPassagem); + rc.setComissaoOutros(comissaoOutros); + + // Descontos (Fixos e Eventuais) + Map respDescontos = calculoDescontos(puntoVentaId, empresaId, periodo, ptovtaComissao); + rc.setDescontos((BigDecimal) respDescontos.get("VALOR_DESCONTOS")); + rc.setLsDescontos((List) respDescontos.get("LISTA_DESCONTOS")); + + /** + * Bonificação Metas - Meta = Eh o valor estipulado de receita dentro do periodo que a agencia deve alcançar. - Bonificação = Eh uma porcentagem paga encima da comissao, por alcançar a meta. + */ + BigDecimal comissaoBonificaoMetas = BigDecimal.ZERO; + rc.setComissaoBonificaoMetas(comissaoBonificaoMetas); + + // Royaties + BigDecimal royaties = BigDecimal.ZERO; + if(ptovtaComissao.getRoyalties() != null) { + royaties = receitaTotal.multiply(ptovtaComissao.getRoyalties().divide(CEM)); + } + rc.setRoyaties(royaties); + + // ISS retido + BigDecimal issRetido = BigDecimal.ZERO; + if(ptovtaComissao.getIssretido() != null) { + issRetido = receitaTotal.multiply(ptovtaComissao.getIssretido().divide(CEM)); + } + rc.setRetidoISS(issRetido); + + // Comissão à pagar = Comissão BPR + Comissão Excesso Bagagem + Comissão Seg. Opcional + Bonificação Metas + Internet(EntregaPassagem) + BigDecimal comissaoPagar = BigDecimal.ZERO; + comissaoPagar = comissaoPagar.add(comissaoBPR).add(comissaoExcessoBagagem).add(comissaoSegOpcional); + comissaoPagar = comissaoPagar.add(comissaoEntregaPassagem).add(comissaoOutros); + comissaoPagar = comissaoPagar.add(comissaoBonificaoMetas); + + // - Descontos (Fixos e Eventuais) - Royaties - ISS retido + comissaoPagar = comissaoPagar.subtract(rc.getDescontos()).subtract(royaties).subtract(issRetido); + rc.setComissaoPagar(comissaoPagar); + + return rc; + } else { + throw new ComissaoException("busquedaCalculoComissaoController.PtovtaComissao.exception"); + } + + } + + private boolean validaAltaTemporada(List impostos, int mes, int estadoId) { + + for (EmpresaImposto ei : impostos) { + if (ei.getEstado().getEstadoId().equals(estadoId)) { + switch (mes - 1) { + case Calendar.JANUARY: + return ei.getIndJaneiro() == null ? false : ei.getIndJaneiro(); + case Calendar.FEBRUARY: + return ei.getIndFevereiro() == null ? false : ei.getIndFevereiro(); + case Calendar.MARCH: + return ei.getIndMarco() == null ? false : ei.getIndMarco(); + case Calendar.APRIL: + return ei.getIndAbril() == null ? false : ei.getIndAbril(); + case Calendar.MAY: + return ei.getIndMaio() == null ? false : ei.getIndMaio(); + case Calendar.JUNE: + return ei.getIndJunho() == null ? false : ei.getIndJunho(); + case Calendar.JULY: + return ei.getIndJulho() == null ? false : ei.getIndJulho(); + case Calendar.AUGUST: + return ei.getIndAgosto() == null ? false : ei.getIndAgosto(); + case Calendar.SEPTEMBER: + return ei.getIndSetembro() == null ? false : ei.getIndSetembro(); + case Calendar.OCTOBER: + return ei.getIndOutubro() == null ? false : ei.getIndOutubro(); + case Calendar.NOVEMBER: + return ei.getIndNovembro() == null ? false : ei.getIndNovembro(); + case Calendar.DECEMBER: + return ei.getIndDezembro() == null ? false : ei.getIndDezembro(); + default: + break; + } + } + } + + return false; + } + + private List calculaReceitaComissao(Integer empresaId, PtovtaComissao ptovtaComissao, List receitasBoleto, Integer ultimodia, Integer mes, Integer ano) { + + List impostos = empresaImpostoService.buscarEmpresaImposto(empresaId); + + List receitas = new ArrayList(); + for (int dia = 1; dia <= ultimodia; dia++) { + + List list = verificaCalculoComissaoProDia(receitasBoleto, dia, mes); + + Calendar dataRegistro = Calendar.getInstance(); + dataRegistro.set(Calendar.DAY_OF_MONTH, dia); + dataRegistro.set(Calendar.MONTH, mes - 1); + dataRegistro.set(Calendar.YEAR, ano); + + ComissaoReceita cr = new ComissaoReceita(); + cr.setData(dataRegistro.getTime()); + + BigDecimal receitaComissao = BigDecimal.ZERO; + + BigDecimal receitaBPR = BigDecimal.ZERO; + BigDecimal receitaGAP = BigDecimal.ZERO; + BigDecimal internet = BigDecimal.ZERO; + BigDecimal receitaExcessoBagagem = BigDecimal.ZERO; + BigDecimal receitaSeguroOpcional = BigDecimal.ZERO; + BigDecimal receitaSeguroOutros = BigDecimal.ZERO; + + BigDecimal cancelados = BigDecimal.ZERO; + BigDecimal devolvidos = BigDecimal.ZERO; + BigDecimal devolvidosOrigem = BigDecimal.ZERO; + BigDecimal canceladosGAP = BigDecimal.ZERO; + BigDecimal devolvidosGAP = BigDecimal.ZERO; + BigDecimal devolvidosGAPOrigem = BigDecimal.ZERO; + + BigDecimal gapImpressa = BigDecimal.ZERO; + int contImpressa = 0; + + BigDecimal comissaoBPR = BigDecimal.ZERO; + BigDecimal comissaoExcessoBagagem = BigDecimal.ZERO; + BigDecimal comissaoSegOpcional = BigDecimal.ZERO; + BigDecimal comissaoEntregaPassagem = BigDecimal.ZERO; + BigDecimal comissaoOutros = BigDecimal.ZERO; + + // Receita Total -- bruta/liquida - abatimento do valor do icms + boolean isReceitaLiquida = false; + Receita receita = Receita.getByValor(ptovtaComissao.getReceita()); + if (receita.equals(Receita.RECEITALIQUIDA)) { + isReceitaLiquida = true; + } + + for (BoletoComissao rcc : list) { + + boolean isAltaTemporada = validaAltaTemporada(impostos, mes, rcc.getEstadoId()); + + IndStatusBoleto statusBoleto = IndStatusBoleto.valueOf(rcc.getIndstatusboleto()); + + BigDecimal receitaItem = BigDecimal.ZERO; + BigDecimal receitaDevItem = BigDecimal.ZERO; + + // Totais + if (BooleanUtils.toBoolean(ptovtaComissao.getTarifaReceita())) { + receitaItem = receitaItem.add(rcc.getValorpagado()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getTaxaReceita())) { + receitaItem = receitaItem.add(rcc.getEmbarque()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getSeguroReceita())) { + receitaItem = receitaItem.add(rcc.getSeguro()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getPedagioReceita())) { + receitaItem = receitaItem.add(rcc.getPedagio()); + } + + // Totais de Devolução / Cancelamento + if (BooleanUtils.toBoolean(ptovtaComissao.getTarifaDev())) { + receitaDevItem = receitaDevItem.add(rcc.getValorpagado()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getTaxaDev())) { + receitaDevItem = receitaDevItem.add(rcc.getEmbarque()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getSeguroDev())) { + receitaDevItem = receitaDevItem.add(rcc.getSeguro()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getPedagioDev())) { + receitaDevItem = receitaDevItem.add(rcc.getPedagio()); + } + + // Calculo de ICMS sobre o valor do bilhete + if (isReceitaLiquida) { + BigDecimal icsm = BigDecimal.ZERO; + icsm = receitaItem.multiply(rcc.getIcmsBase().divide(CEM)); + receitaItem = receitaItem.subtract(icsm); + + BigDecimal icsmDev = BigDecimal.ZERO; + icsmDev = receitaDevItem.multiply(rcc.getIcmsBase().divide(CEM)); + receitaDevItem = receitaDevItem.subtract(icsmDev); + + } + + // Boletos impressos no punto venta + if (statusBoleto.equals(IndStatusBoleto.E)) { + contImpressa++; + gapImpressa = gapImpressa.add(receitaItem); + + BigDecimal entregaPassagem = calculoEntregaPassagem(isAltaTemporada, ptovtaComissao, receitaItem, BigDecimal.ZERO, contImpressa); + comissaoEntregaPassagem = comissaoEntregaPassagem.add(entregaPassagem); + + } else { + + // Receitas calculadas sempre + receitaExcessoBagagem = receitaExcessoBagagem.add(rcc.getExcessoBagagem()); + BigDecimal excessoBagagem = calculoExcessoBagagem(isAltaTemporada, ptovtaComissao, rcc.getExcessoBagagem()); + comissaoExcessoBagagem = comissaoExcessoBagagem.add(excessoBagagem); + + receitaSeguroOpcional = receitaSeguroOpcional.add(rcc.getSeguroOpcional()); + BigDecimal segOpcional = calculoSeguroOpcional(isAltaTemporada, ptovtaComissao, rcc.getSeguroOpcional()); + comissaoSegOpcional = comissaoSegOpcional.add(segOpcional); + + receitaSeguroOutros = receitaSeguroOutros.add(rcc.getSeguroOutros()); + BigDecimal outros = calculoOutros(isAltaTemporada, ptovtaComissao, rcc.getSeguroOutros()); + comissaoOutros = comissaoOutros.add(outros); + + // Receita GAP + if (rcc.getTipoVenta().equals(Constantes.TPV_BOLETO_REMOTO.intValue())) { + receitaGAP = receitaGAP.add(receitaItem); + + BigDecimal bpr = calculoComisssaoBPR(isAltaTemporada, ptovtaComissao, BigDecimal.ZERO, receitaItem); + comissaoBPR = comissaoBPR.add(bpr); + } + // Internet + else if (rcc.getTipoVenta().equals(Constantes.TPV_POR_INTERNET.intValue())) { + internet = internet.add(receitaItem); + + BigDecimal entregaPassagem = calculoEntregaPassagem(isAltaTemporada, ptovtaComissao, BigDecimal.ZERO, receitaItem, contImpressa); + comissaoEntregaPassagem = comissaoEntregaPassagem.add(entregaPassagem); + } + + // Receita BPR + else { + receitaBPR = receitaBPR.add(receitaItem); + + BigDecimal bpr = calculoComisssaoBPR(isAltaTemporada, ptovtaComissao, receitaItem, BigDecimal.ZERO); + comissaoBPR = comissaoBPR.add(bpr); + } + } + + if (statusBoleto.equals(IndStatusBoleto.C)) { + // Devolução Receita + if (rcc.getMotivoCancelacionId().equals(Constantes.MVO_CANCEL_DEVOLUCAO)) { + + // Devolução Receita GAP + if (rcc.getTipoVenta().equals(Constantes.TPV_BOLETO_REMOTO.intValue())) { + + // Impresso Venta de otro punto venta + if (rcc.isPtoVtaOrigem()) { + devolvidosGAPOrigem = devolvidosGAPOrigem.add(receitaDevItem); + } + devolvidosGAP = devolvidosGAP.add(receitaDevItem); + + } else { + // Impresso Venta de otro punto venta + if (rcc.isPtoVtaOrigem()) { + devolvidosOrigem = devolvidosOrigem.add(receitaDevItem); + } + + devolvidos = devolvidos.add(receitaDevItem); + } + + } + + // Cancelamento Receita + else { + // Cancelamento Receita GAP + if (rcc.getTipoVenta().equals(Constantes.TPV_BOLETO_REMOTO.intValue())) { + canceladosGAP = canceladosGAP.add(receitaDevItem); + } else { + cancelados = cancelados.add(receitaDevItem); + } + } + } + } + + cr.setCancelados(cancelados); + cr.setCanceladosGAP(canceladosGAP); + cr.setDevolvidos(devolvidos); + cr.setDevolvidosGAP(devolvidosGAP); + cr.setDevolucoesOrigem(devolvidosOrigem); + cr.setDevolucoesOrigemGAP(devolvidosGAPOrigem); + + cr.setReceitaBPR(receitaBPR); + cr.setReceitaExcessoBagagem(receitaExcessoBagagem); + cr.setReceitaGAP(receitaGAP); + cr.setReceitaSeguroOpcional(receitaSeguroOpcional); + cr.setReceitaSeguroOutros(receitaSeguroOutros); + cr.setInternet(internet); + + cr.setGapImpressa(gapImpressa); + cr.setContImpressa(contImpressa); + + // Receita Comissão = Receita BPR + Receita GAP - GapImpressa - Internet + // - Cancelados - Devoluções Origem - Cancelados GAP - Devoluções GAP Origem - Devoluções - Devoluções GAP + receitaComissao = receitaComissao.add(receitaBPR).add(receitaGAP); + + receitaComissao = receitaComissao.subtract(gapImpressa).subtract(internet).subtract(cancelados); + receitaComissao = receitaComissao.subtract(devolvidosOrigem).subtract(devolvidos).subtract(canceladosGAP); + receitaComissao = receitaComissao.subtract(devolvidosGAPOrigem).subtract(devolvidosGAP); + cr.setReceitaComissao(receitaComissao); + + cr.setComissaoBPRDiaria(comissaoBPR); + cr.setComissaoEntregaPassagemDiaria(comissaoEntregaPassagem); + cr.setComissaoExcessoBagagemDiaria(comissaoExcessoBagagem); + cr.setComissaoSegOpcionalDiaria(comissaoSegOpcional); + cr.setComissaoOutrosDiaria(comissaoOutros); + + receitas.add(cr); + } + + return receitas; + + } + + private List verificaCalculoComissaoProDia(List list, Integer dia, Integer mes) { + + List aux = new ArrayList(); + for (BoletoComissao rcc : list) { + try { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(DateUtil.getDateFromString(rcc.getDatavenda(), "dd-MM-yyyy")); + + int diaItem = calendario.get(Calendar.DAY_OF_MONTH); + int mesItem = calendario.get(Calendar.MONTH) + 1; + + if (dia.equals(diaItem) && mes.equals(mesItem)) { + aux.add(rcc); + } + + } catch (ParseException e) { + log.error("ERRO - ao converter data", e); + } + } + + return aux; + } + + @Override + public List relatorioCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException { + List registrosCalculo = new ArrayList(); + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId); + for (PuntoVenta puntoVenta : puntoventas) { + RegistroCalculo registroCalculo = relatorioCalculoComissao(puntoVenta.getPuntoventaId(), empresaId, periodo); + totalizarRegistroCalculo(registroCalculo); + registrosCalculo.add(registroCalculo); + } + Collections.sort(registrosCalculo, new Comparator() { + @Override + public int compare(RegistroCalculo o1, RegistroCalculo o2) { + return o1.getNombpuntoventa().compareToIgnoreCase(o2.getNombpuntoventa()); + } + }); + return registrosCalculo; + } + + private void totalizarRegistroCalculo(RegistroCalculo registroCalculo) { + ComissaoReceita comissaoReceitaTotal = new ComissaoReceita(); + for (ComissaoReceita comissaoReceita : registroCalculo.getLsReceitas()) { + comissaoReceitaTotal.setReceitaComissao(comissaoReceitaTotal.getReceitaComissao().add(comissaoReceita.getReceitaComissao())); + comissaoReceitaTotal.setReceitaBPR(comissaoReceitaTotal.getReceitaBPR().add(comissaoReceita.getReceitaBPR())); + comissaoReceitaTotal.setReceitaGAP(comissaoReceitaTotal.getReceitaGAP().add(comissaoReceita.getReceitaGAP())); + comissaoReceitaTotal.setGapImpressa(comissaoReceitaTotal.getGapImpressa().add(comissaoReceita.getGapImpressa())); + comissaoReceitaTotal.setInternet(comissaoReceitaTotal.getInternet().add(comissaoReceita.getInternet())); + comissaoReceitaTotal.setCancelados(comissaoReceitaTotal.getReceitaGAP().add(comissaoReceita.getCancelados())); + comissaoReceitaTotal.setCanceladosGAP(comissaoReceitaTotal.getCanceladosGAP().add(comissaoReceita.getCanceladosGAP())); + comissaoReceitaTotal.setDevolvidos(comissaoReceitaTotal.getDevolvidosGAP().add(comissaoReceita.getDevolvidos())); + comissaoReceitaTotal.setDevolvidosGAP(comissaoReceitaTotal.getDevolvidosGAP().add(comissaoReceita.getDevolvidosGAP())); + comissaoReceitaTotal.setDevolucoesOrigem(comissaoReceitaTotal.getDevolucoesOrigem().add(comissaoReceita.getDevolucoesOrigem())); + comissaoReceitaTotal.setDevolucoesOrigemGAP(comissaoReceitaTotal.getDevolucoesOrigemGAP().add(comissaoReceita.getDevolucoesOrigemGAP())); + comissaoReceitaTotal.setReceitaExcessoBagagem(comissaoReceitaTotal.getReceitaExcessoBagagem().add(comissaoReceita.getReceitaExcessoBagagem())); + comissaoReceitaTotal.setReceitaSeguroOpcional(comissaoReceitaTotal.getReceitaSeguroOpcional().add(comissaoReceita.getReceitaSeguroOpcional())); + comissaoReceitaTotal.setReceitaSeguroOutros(comissaoReceitaTotal.getReceitaSeguroOutros().add(comissaoReceita.getReceitaSeguroOutros())); + comissaoReceitaTotal.setContImpressa(comissaoReceitaTotal.getContImpressa() + comissaoReceita.getContImpressa()); + comissaoReceitaTotal.setComissaoBPRDiaria(comissaoReceitaTotal.getComissaoBPRDiaria().add(comissaoReceita.getComissaoBPRDiaria())); + comissaoReceitaTotal.setComissaoExcessoBagagemDiaria(comissaoReceitaTotal.getComissaoExcessoBagagemDiaria().add(comissaoReceita.getComissaoExcessoBagagemDiaria())); + comissaoReceitaTotal.setComissaoSegOpcionalDiaria(comissaoReceitaTotal.getComissaoSegOpcionalDiaria().add(comissaoReceita.getComissaoSegOpcionalDiaria())); + comissaoReceitaTotal.setComissaoEntregaPassagemDiaria(comissaoReceitaTotal.getComissaoEntregaPassagemDiaria().add(comissaoReceita.getComissaoEntregaPassagemDiaria())); + comissaoReceitaTotal.setComissaoOutrosDiaria(comissaoReceitaTotal.getComissaoOutrosDiaria().add(comissaoReceita.getComissaoOutrosDiaria())); + } + registroCalculo.getLsReceitas().clear(); + registroCalculo.getLsReceitas().add(comissaoReceitaTotal); + } + + @Override + public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException { + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresa.getEmpresaId()); + for (PuntoVenta puntoVenta : puntoventas) { + registrarCalculoComissao(puntoVenta, empresa, periodo, ignorarComissaoGerada); + } + } + + @Override + public void cancelarCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException { + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId); + for (PuntoVenta puntoVenta : puntoventas) { + cancelarCalculoComissao(puntoVenta.getPuntoventaId(), empresaId, periodo); + } + } + + @Override + public List relatorioReciboComissao(Integer puntoVentaId, Integer empresaId, String competencia) throws ComissaoException { + try { + return comissaoDAO.buscaHistoricoComissao(puntoVentaId, empresaId, DateUtil.getDateFromString(competencia, "MM/yyyy"), DateUtil.getDateFromString(competencia, "MM/yyyy")); + } catch (Exception e) { + throw new ComissaoException(e.getMessage(), e); + } + } + + @Override + public void enviarEmailReciboComissao(HistoricoComissao historicoComissao, byte[] recibo) { + try { + if(StringUtils.isNotBlank(historicoComissao.getDescCorreo())) { + SendMail mail = new SendMail(); + mail.setEmailToCO(historicoComissao.getDescCorreo()); + + Constante constante = constanteService.buscarPorNomeConstante("SMTP_COMISSAO_EMAIL"); + if(constante != null) { + mail.setEmailFrom(constante.getValorconstante()); + } + + constante = constanteService.buscarPorNomeConstante("SMTP_COMISSAO_HOST"); + if(constante != null) { + mail.setSmtpHost(constante.getValorconstante()); + } + + constante = constanteService.buscarPorNomeConstante("SMTP_COMISSAO_PASS"); + if(constante != null) { + mail.setSmtpPassword(constante.getValorconstante()); + } + + constante = constanteService.buscarPorNomeConstante("SMTP_COMISSAO_PORT"); + if(constante != null) { + mail.setSmtpPort(constante.getValorconstante()); + } + + constante = constanteService.buscarPorNomeConstante("SMTP_COMISSAO_USER"); + if(constante != null) { + mail.setSmtpUser(constante.getValorconstante()); + } + + String assunto = Labels.getLabel("busquedaCalculoComissaoController.recibo.email.assunto", new String[] {historicoComissao.getCompetencia()}); + mail.setSubject(assunto); + + String texto = Labels.getLabel("busquedaCalculoComissaoController.recibo.email.texto", new String[] {historicoComissao.getCompetencia()}); + mail.setText(texto); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(recibo.length); + baos.write(recibo, 0, recibo.length); + mail.addAnexo(Labels.getLabel("busquedaCalculoComissaoController.recibo.email.nomeAnexo", new String[] {historicoComissao.getCompetencia()}).concat(".pdf"), baos, MimeType.PDF); + + mail.send(); + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCargoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCargoServiceImpl.java new file mode 100644 index 000000000..661c644c9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCargoServiceImpl.java @@ -0,0 +1,57 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CancelacionCargoDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; +import com.rjconsultores.ventaboletos.service.CancelacionCargoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + * @author Rafius + */ +@Service("cancelacionCargoService") +public class CancelacionCargoServiceImpl implements CancelacionCargoService { + + @Autowired + private CancelacionCargoDAO cancelacionCargoDAO; + + public List obtenerTodos() { + return cancelacionCargoDAO.obtenerTodos(); + } + + public CancelacionCargo obtenerID(Integer id) { + return cancelacionCargoDAO.obtenerID(id); + } + + public CancelacionCargo suscribir(CancelacionCargo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCargoDAO.suscribir(entidad); + } + + public CancelacionCargo actualizacion(CancelacionCargo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCargoDAO.actualizacion(entidad); + } + + public void borrar(CancelacionCargo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cancelacionCargoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCtrlServiceImpl.java new file mode 100644 index 000000000..ebac25784 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCtrlServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CancelacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.CancelacionCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("cancelacionCtrlService") +public class CancelacionCtrlServiceImpl implements CancelacionCtrlService { + + @Autowired + private CancelacionCtrlDAO cancelacionCtrlDAO; + + public List obtenerTodos() { + return cancelacionCtrlDAO.obtenerTodos(); + } + + public CancelacionCtrl obtenerID(Integer id) { + return cancelacionCtrlDAO.obtenerID(id); + } + + @Transactional + public CancelacionCtrl suscribir(CancelacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCtrlDAO.suscribir(entidad); + } + + @Transactional + public CancelacionCtrl actualizacion(CancelacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CancelacionCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cancelacionCtrlDAO.actualizacion(entidad); + } + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, Parada paradaDestino, Marca marca) { + return cancelacionCtrlDAO.buscar(tiempoprevsalida,puntoVenta,paradaOrigem,paradaDestino,marca); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeServiceImpl.java new file mode 100644 index 000000000..9e769d135 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeServiceImpl.java @@ -0,0 +1,83 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.service.CasetaPeajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("casetaPeajeService") +public class CasetaPeajeServiceImpl implements CasetaPeajeService { + + @Autowired + private CasetaPeajeDAO casetaPeajeDAO; + + @Override + public List obtenerTodos() { + return casetaPeajeDAO.obtenerTodos(); + } + + @Override + public List buscarTodosOrdenadoPorDescricao() { + return casetaPeajeDAO.buscarTodosOrdenadoPorDescricao(); + } + + @Transactional + public CasetaPeaje obtenerID(Integer id) { + return casetaPeajeDAO.obtenerID(id); + } + + @Transactional + public CasetaPeaje suscribir(CasetaPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return casetaPeajeDAO.suscribir(entidad); + } + + @Transactional + public CasetaPeaje actualizacion(CasetaPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return casetaPeajeDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CasetaPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + casetaPeajeDAO.actualizacion(entidad); + } + + @Override + public List buscar(String descricaoCasetaPeaje) { + return casetaPeajeDAO.buscar(descricaoCasetaPeaje); + } + + @Override + public Boolean validarDescricaoCasetaPeaje(CasetaPeaje casetaPeaje) { + List pracas = buscar(casetaPeaje.getDesccaseta()); + + if(casetaPeaje.getCasetaPeajeId() == null) { + if(pracas.isEmpty()){ + return Boolean.TRUE; + } + } else { + if(pracas.isEmpty() || pracas.get(0).getCasetaPeajeId().equals(casetaPeaje.getCasetaPeajeId())) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + return Boolean.FALSE; + } +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaClaseServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaClaseServiceImpl.java new file mode 100644 index 000000000..58f8a6f8a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaClaseServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaClaseDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.service.CategoriaClaseService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaClaseService") +public class CategoriaClaseServiceImpl implements CategoriaClaseService { + + @Autowired + private CategoriaClaseDAO categoriaClaseDAO; + + public List obtenerTodos() { + return categoriaClaseDAO.obtenerTodos(); + } + + public CategoriaClase obtenerID(Integer id) { + return categoriaClaseDAO.obtenerID(id); + } + + @Transactional + public CategoriaClase suscribir(CategoriaClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaClaseDAO.suscribir(entidad); + } + + @Transactional + public CategoriaClase actualizacion(CategoriaClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaClaseDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + + categoriaClaseDAO.actualizacion(entidad); + } + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaClaseDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCorridaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCorridaServiceImpl.java new file mode 100644 index 000000000..d9f5e822c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCorridaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.service.CategoriaCorridaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaCorridaService") +public class CategoriaCorridaServiceImpl implements CategoriaCorridaService { + + @Autowired + private CategoriaCorridaDAO categoriaCorridaDAO; + + public List obtenerTodos() { + return categoriaCorridaDAO.obtenerTodos(); + } + + public CategoriaCorrida obtenerID(Integer id) { + return categoriaCorridaDAO.obtenerID(id); + } + + @Transactional + public CategoriaCorrida suscribir(CategoriaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaCorridaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaCorrida actualizacion(CategoriaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaCorridaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + + categoriaCorridaDAO.actualizacion(entidad); + } + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaCorridaDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java new file mode 100644 index 000000000..d085c4c51 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java @@ -0,0 +1,162 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaCtrlDAO; +import com.rjconsultores.ventaboletos.dao.CategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import com.rjconsultores.ventaboletos.service.CategoriaCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaCtrlService") +public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { + + public static final int CATEGORIA_ADULTO = 1; + private static final int CANT_MAX_CATEGORIA_ADULTO = 100; + @Autowired + private CategoriaCtrlDAO categoriaCtrlDAO; + @Autowired + private CategoriaDAO categoriaDAO; + + public CategoriaCtrl obtenerID(Integer id) { + return categoriaCtrlDAO.obtenerID(id); + } + + @Transactional + public CategoriaCtrl suscribir(CategoriaCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + checarCategoriaAdulto(entidad); + + return categoriaCtrlDAO.suscribir(entidad); + } + + /** + * Verifica se existe la categoria adulto. Sino existe, la adicciona. + * + * @param categoriaCtrl + */ + private void checarCategoriaAdulto(CategoriaCtrl categoriaCtrl) { + boolean existeAdulto = false; + List lsCategorias = new ArrayList(); + lsCategorias.addAll(categoriaCtrl.getCategoriaDescuentoList()); + + for (CategoriaDescuento cd : categoriaCtrl.getCategoriaDescuentoList()) { + if (cd.getCategoria().getCategoriaId().equals(CATEGORIA_ADULTO)) { + existeAdulto = true; + } + } + if (!existeAdulto) { + CategoriaDescuento categoriaDescuentoAdulto = this.getCategoriaDescuentoAdulto(categoriaCtrl); + lsCategorias.add(categoriaDescuentoAdulto); + } + categoriaCtrl.setCategoriaDescuentoList(lsCategorias); + } + + @Transactional + public CategoriaCtrl actualizacion(CategoriaCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaCtrl entidad) { + + for (CategoriaClase cc : entidad.getCategoriaClaseList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaCorrida cc : entidad.getCategoriaCorridaList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaDescuento cc : entidad.getCategoriaDescuentoList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaMarca cc : entidad.getCategoriaMarcaList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaMercado cc : entidad.getCategoriaMercadoList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaCtrlDAO.actualizacion(entidad); + } + + private CategoriaDescuento getCategoriaDescuentoAdulto(CategoriaCtrl categoriaCtrl) { + CategoriaDescuento cd = new CategoriaDescuento(); + cd.setActivo(Boolean.TRUE); + cd.setCantautorizada(CANT_MAX_CATEGORIA_ADULTO); + cd.setCategoria(categoriaDAO.obtenerID(CATEGORIA_ADULTO)); + cd.setDescuentoimporte(BigDecimal.ZERO); + cd.setDescuentoporc(BigDecimal.ZERO); + + CategoriaPeriodo cp = new CategoriaPeriodo(); + cp.setActivo(Boolean.TRUE); + cp.setCategoriaDescuento(cd); + + Calendar datFin = Calendar.getInstance(); + datFin.set(2300, 11, 31); + + Calendar datInicio = Calendar.getInstance(); + datInicio.set(2000, 11, 31); + + cp.setFecfin(datFin.getTime()); + cp.setFecinicio(datInicio.getTime()); + + cp.setFecmodif(new java.util.Date()); + cp.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + List lsCatPeriodo = new ArrayList(); + lsCatPeriodo.add(cp); + + cd.setCategoriaPeriodoList(lsCatPeriodo); + cd.setCategoriaCtrl(categoriaCtrl); + cd.setFecmodif(new java.util.Date()); + cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + cd.setIndAplicaFeriado(CategoriaDescuento.DisponibilidadeFeriado.GERARSEMPRE.valor()); + cd.setIndImporteOutros(true); + cd.setIndImportePedagio(true); + cd.setIndImporteSeguro(true); + cd.setIndImporteTxEmbarque(true); + + return cd; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaDescuentoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaDescuentoServiceImpl.java new file mode 100644 index 000000000..2fba5f7f1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaDescuentoServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.service.CategoriaDescuentoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaDescuentoService") +public class CategoriaDescuentoServiceImpl implements CategoriaDescuentoService { + + @Autowired + private CategoriaDescuentoDAO categoriaDescuentoDAO; + + public List obtenerTodos() { + return categoriaDescuentoDAO.obtenerTodos(); + } + + public CategoriaDescuento obtenerID(Integer id) { + return categoriaDescuentoDAO.obtenerID(id); + } + + @Transactional + public CategoriaDescuento suscribir(CategoriaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDescuentoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaDescuento actualizacion(CategoriaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDescuentoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaDescuentoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMarcaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMarcaServiceImpl.java new file mode 100644 index 000000000..9831bc3cf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMarcaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; +import com.rjconsultores.ventaboletos.service.CategoriaMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaMarcaService") +public class CategoriaMarcaServiceImpl implements CategoriaMarcaService { + + @Autowired + private CategoriaMarcaDAO categoriaMarcaDAO; + + public List obtenerTodos() { + return categoriaMarcaDAO.obtenerTodos(); + } + + public CategoriaMarca obtenerID(Integer id) { + return categoriaMarcaDAO.obtenerID(id); + } + + @Transactional + public CategoriaMarca suscribir(CategoriaMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMarcaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaMarca actualizacion(CategoriaMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaMarcaDAO.actualizacion(entidad); + } + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaMarcaDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMercadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMercadoServiceImpl.java new file mode 100644 index 000000000..b25b42bbc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMercadoServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; +import com.rjconsultores.ventaboletos.service.CategoriaMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaMercadoService") +public class CategoriaMercadoServiceImpl implements CategoriaMercadoService { + + @Autowired + private CategoriaMercadoDAO categoriaMercadoDAO; + + public List obtenerTodos() { + return categoriaMercadoDAO.obtenerTodos(); + } + + public CategoriaMercado obtenerID(Integer id) { + return categoriaMercadoDAO.obtenerID(id); + } + + @Transactional + public CategoriaMercado suscribir(CategoriaMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMercadoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaMercado actualizacion(CategoriaMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaMercadoDAO.actualizacion(entidad); + } + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaMercadoDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaOrgaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaOrgaoServiceImpl.java new file mode 100644 index 000000000..dae788e6a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaOrgaoServiceImpl.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaOrgaoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; +import com.rjconsultores.ventaboletos.service.CategoriaOrgaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +@Service("categoriaOrgaoService") +public class CategoriaOrgaoServiceImpl implements CategoriaOrgaoService { + + @Autowired + private CategoriaOrgaoDAO categoriaOrgaoDAO; + + public List obtenerTodos() { + return categoriaOrgaoDAO.obtenerTodos(); + } + + public CategoriaOrgao obtenerID(Integer id) { + return categoriaOrgaoDAO.obtenerID(id); + } + + @Transactional + public CategoriaOrgao suscribir(CategoriaOrgao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaOrgaoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaOrgao actualizacion(CategoriaOrgao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaOrgaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaOrgao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaOrgaoDAO.actualizacion(entidad); + } + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaOrgaoDAO.busquedaPorCategoriaCtrl(categoriaCtrl); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaPeriodoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaPeriodoServiceImpl.java new file mode 100644 index 000000000..a788fa353 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaPeriodoServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaPeriodoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import com.rjconsultores.ventaboletos.service.CategoriaPeriodoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaPeriodoService") +public class CategoriaPeriodoServiceImpl implements CategoriaPeriodoService { + + @Autowired + private CategoriaPeriodoDAO categoriaPeriodoDAO; + + public List obtenerTodos() { + return categoriaPeriodoDAO.obtenerTodos(); + } + + public CategoriaPeriodo obtenerID(Integer id) { + return categoriaPeriodoDAO.obtenerID(id); + } + + @Transactional + public CategoriaPeriodo suscribir(CategoriaPeriodo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaPeriodoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaPeriodo actualizacion(CategoriaPeriodo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaPeriodoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaPeriodo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaPeriodoDAO.actualizacion(entidad); + } + + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo) { + return categoriaPeriodoDAO.buscarPeriodoIntervalo(cPeriodo); + } + + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento) { + return categoriaPeriodoDAO.obtenerPorCategoriaDescuento(categoriaDescuento); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaServiceImpl.java new file mode 100644 index 000000000..e293e1da9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaServiceImpl.java @@ -0,0 +1,86 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.service.CategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaService") +public class CategoriaServiceImpl implements CategoriaService { + + @Autowired + private CategoriaDAO categoriaDAO; + + public List obtenerTodos() { + return categoriaDAO.obtenerTodos(); + } + + public Categoria obtenerID(Integer id) { + return categoriaDAO.obtenerID(id); + } + + @Transactional + public Categoria suscribir(Categoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDAO.suscribir(entidad); + } + + @Transactional + public Categoria actualizacion(Categoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Categoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaDAO.actualizacion(entidad); + } + + public List buscar(String desccategoria) { + return categoriaDAO.buscar(desccategoria); + } + + public List obtenerTodasCategoriasVisibles() { + List listCategoriasVisibles = new ArrayList(); + List lsCategorias = obtenerTodos(); + + for (Categoria c : lsCategorias) { + boolean esVisible = true; + for (Integer id : CategoriaCtrl.idsCategoriasNoVisible) { + if (id.equals(c.getCategoriaId())) { + esVisible = false; + } + } + if (esVisible) { + listCategoriasVisibles.add(c); + } + + } + return listCategoriasVisibles; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaTipoPtoVtaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaTipoPtoVtaServiceImpl.java new file mode 100644 index 000000000..f7369c555 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CategoriaTipoPtoVtaServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.service.CategoriaTipoPtoVtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("categoriaTipoPtoVtaService") +public class CategoriaTipoPtoVtaServiceImpl implements CategoriaTipoPtoVtaService { + + @Autowired + private CategoriaTipoPtoVtaDAO categoriaTipoPtoVtaDAO; + + public List obtenerTodos() { + return categoriaTipoPtoVtaDAO.obtenerTodos(); + } + + public CategoriaTipoPtoVta obtenerID(Integer id) { + return categoriaTipoPtoVtaDAO.obtenerID(id); + } + + @Transactional + public CategoriaTipoPtoVta suscribir(CategoriaTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaTipoPtoVtaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaTipoPtoVta actualizacion(CategoriaTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaTipoPtoVtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaTipoPtoVtaDAO.actualizacion(entidad); + } + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + return categoriaTipoPtoVtaDAO.buscarPorPuntoVenta(tipoPuntoVenta); + } + + public void borrarFisico(CategoriaTipoPtoVta cd) { + categoriaTipoPtoVtaDAO.borrarFisico(cd); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CiudadServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CiudadServiceImpl.java new file mode 100644 index 000000000..44fd7d0a8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CiudadServiceImpl.java @@ -0,0 +1,103 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CiudadDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.service.CiudadService; +import com.rjconsultores.ventaboletos.service.PlazaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author MCosso + */ +@Service("ciudadService") +public class CiudadServiceImpl implements CiudadService { + + private static Logger log = Logger.getLogger(CiudadServiceImpl.class); + + @Autowired + private CiudadDAO ciudadDAO; + @Autowired + private PlazaService plazaService; + + public List obtenerTodos() { + return ciudadDAO.obtenerTodos(); + } + + public Ciudad obtenerID(Integer id) { + return ciudadDAO.obtenerID(id); + } + + @Transactional + public Ciudad suscribir(Ciudad entidad) { + + if (entidad.getPlaza() == null) { + entidad.setPlaza(getPlazaCiudad()); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ciudadDAO.suscribir(entidad); + } + + @Transactional + public Ciudad actualizacion(Ciudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ciudadDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Ciudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ciudadDAO.actualizacion(entidad); + } + + private Plaza getPlazaCiudad() { + try { + return plazaService.obtenerTodos().iterator().next(); + } catch (Exception e) { + log.error("", e); + } + return null; + } + + public List buscar(String nombciudad, Estado estado, Plaza plaza) { + return ciudadDAO.buscar(nombciudad, estado, plaza); + } + + public List buscaLike(String strCiudad) { + return ciudadDAO.buscaLike(strCiudad); + } + + @Override + public List buscarPorEstado(Estado estado) { + return ciudadDAO.buscarPorEstado(estado); + } + + @Override + public List buscaCodMun(Integer codMun, Estado estado) { + return ciudadDAO.buscaCodMun(codMun, estado); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClaseServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClaseServicioServiceImpl.java new file mode 100644 index 000000000..f3179830e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClaseServicioServiceImpl.java @@ -0,0 +1,92 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ClasseServicoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.service.ClaseServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("claseServicioService") +public class ClaseServicioServiceImpl implements ClaseServicioService { + + @Autowired + private ClasseServicoDAO claseServicoDAO; + + public List obtenerTodos() { + return claseServicoDAO.obtenerTodos(); + } + + public ClaseServicio obtenerID(Integer id) { + return claseServicoDAO.obtenerID(id); + } + + @Transactional + public ClaseServicio suscribir(ClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseServicoDAO.suscribir(entidad); + } + + @Transactional + public ClaseServicio actualizacion(ClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseServicoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + claseServicoDAO.actualizacion(entidad); + } + + public List buscarPorNome(String nomeClaseServicio) { + return claseServicoDAO.buscarPorNome(nomeClaseServicio); + } + + public List buscarTodosExceto(Integer ... idClase){ + return claseServicoDAO.buscarTodosExceto(idClase); + } + + public List buscarPorEmpresasDoUsuario (List empresasUsuario) { + + if(empresasUsuario == null || empresasUsuario.isEmpty()) { + return null; + } + + StringBuilder idEmpresasBuilder = new StringBuilder(); + String idEmpresas = ""; + + for (Empresa empresa : empresasUsuario) { + idEmpresasBuilder.append(empresa.getEmpresaId().toString()).append(","); + } + + idEmpresasBuilder = idEmpresasBuilder.deleteCharAt(idEmpresasBuilder.length() -1); + idEmpresas = idEmpresasBuilder.toString(); + + List result = (List) claseServicoDAO.buscarPorEmpresasDoUsuario(idEmpresas); + return result; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClaseservicioEquivalenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClaseservicioEquivalenciaServiceImpl.java new file mode 100644 index 000000000..f048a6e28 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClaseservicioEquivalenciaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ClaseservicioEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.service.ClaseservicioEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("claseservicioEquivalenciaService") +public class ClaseservicioEquivalenciaServiceImpl + implements ClaseservicioEquivalenciaService { + + @Autowired + private ClaseservicioEquivalenciaDAO claseservicioEquivalenciaDAO; + + public List obtenerTodos() { + return claseservicioEquivalenciaDAO.obtenerTodos(); + } + + public ClaseservicioEquivalencia obtenerID(Integer id) { + return claseservicioEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public ClaseservicioEquivalencia suscribir(ClaseservicioEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseservicioEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public ClaseservicioEquivalencia actualizacion(ClaseservicioEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseservicioEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ClaseservicioEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + claseservicioEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(ClaseServicio claseServicio, ComisionistaExterno comisionistaExterno) { + return claseservicioEquivalenciaDAO.buscar(claseServicio, comisionistaExterno); + } + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia) { + return claseservicioEquivalenciaDAO.buscarEquivalencia(claseServicioEquivalencia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteCursoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteCursoServiceImpl.java new file mode 100644 index 000000000..96fd3e367 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteCursoServiceImpl.java @@ -0,0 +1,71 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteCursoDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; +import com.rjconsultores.ventaboletos.service.ClienteCursoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("clienteCursoService") +public class ClienteCursoServiceImpl implements ClienteCursoService { + + @Autowired + private ClienteCursoDAO clienteCursoDAO; + + @Override + public List obtenerTodos() { + return clienteCursoDAO.obtenerTodos(); + } + + @Override + public ClienteCurso obtenerID(Integer id) { + return clienteCursoDAO.obtenerID(id); + } + + @Transactional + @Override + public ClienteCurso suscribir(ClienteCurso entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteCursoDAO.suscribir(entidad); + } + + @Transactional + @Override + public ClienteCurso actualizacion(ClienteCurso entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteCursoDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ClienteCurso entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + clienteCursoDAO.actualizacion(entidad); + } + + @Override + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso) { + return clienteCursoDAO.buscarClienteCurso(cliente, curso); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteDescuentoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteDescuentoServiceImpl.java new file mode 100644 index 000000000..64733b5ca --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteDescuentoServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; +import com.rjconsultores.ventaboletos.service.ClienteDescuentoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("clienteDescuentoService") +public class ClienteDescuentoServiceImpl implements ClienteDescuentoService { + + @Autowired + private ClienteDescuentoDAO clienteDescuentoDAO; + + @Transactional + public ClienteDescuento suscribir(ClienteDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(0); + + return clienteDescuentoDAO.suscribir(entidad); + } + + public ClienteDescuento obtenerID(Integer id) { + return clienteDescuentoDAO.obtenerID(id); + } + + + public List obtenerTodos() { + return clienteDescuentoDAO.obtenerTodos(); + } + + @Transactional + public void borrar(ClienteDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(0); + + clienteDescuentoDAO.borrar(entidad); + } + + @Transactional + public ClienteDescuento actualizacion(ClienteDescuento entidad) { + return clienteDescuentoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteDireccionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteDireccionServiceImpl.java new file mode 100644 index 000000000..695d41fc0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteDireccionServiceImpl.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; +import com.rjconsultores.ventaboletos.service.ClienteDireccionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Desenvolvimento + */ +@Service("clienteDireccionService") +public class ClienteDireccionServiceImpl implements ClienteDireccionService { + + @Autowired + private ClienteDireccionDAO clienteDAO; + + public List obtenerTodos() { + return clienteDAO.obtenerTodos(); + } + + public ClienteDireccion obtenerID(Integer id) { + return clienteDAO.obtenerID(id); + } + + @Transactional + public ClienteDireccion suscribir(ClienteDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.suscribir(entidad); + } + + @Transactional + public ClienteDireccion actualizacion(ClienteDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ClienteDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + clienteDAO.actualizacion(entidad); + } + + public List buscar(Integer clienteId) { + return clienteDAO.buscar(clienteId); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteServiceImpl.java new file mode 100644 index 000000000..f73e53fc7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ClienteServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.service.ClienteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Desenvolvimento + */ +@Service("clienteService") +public class ClienteServiceImpl implements ClienteService { + + @Autowired + private ClienteDAO clienteDAO; + + public List obtenerTodos() { + return clienteDAO.obtenerTodos(); + } + + public Cliente obtenerID(Integer id) { + return clienteDAO.obtenerID(id); + } + + @Transactional + public Cliente suscribir(Cliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.suscribir(entidad); + } + + @Transactional + public Cliente actualizacion(Cliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Cliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + clienteDAO.actualizacion(entidad); + } + + public List buscar(String numbCliente) { + return clienteDAO.buscar(numbCliente); + } + + @Override + public Cliente buscarPorNumeroFidelidade(Integer numeroFidelidade, Empresa empresa) { + return clienteDAO.buscarPorNumeroFidelidade(numeroFidelidade, empresa); + } + + @Override + public List buscarPorDocumento(String documento) { + return clienteDAO.buscarPorDocumento(documento); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java new file mode 100644 index 000000000..1eab69bd2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CoeficienteTarifaDAO; +import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("coeficienteTarifaService") +public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { + + @Autowired + private CoeficienteTarifaDAO coeficienteTarifaDAO; + @Autowired + private OrgaoTramoDAO orgaoTramoDAO; + + public List obtenerTodos() { + return coeficienteTarifaDAO.obtenerTodos(); + } + + public CoeficienteTarifa obtenerID(Integer id) { + return coeficienteTarifaDAO.obtenerID(id); + } + + @Transactional + public CoeficienteTarifa suscribir(CoeficienteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coeficienteTarifaDAO.suscribir(entidad); + } + + @Transactional + public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coeficienteTarifaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CoeficienteTarifa entidad) throws RegistroConDependenciaException { + long count =0; + count +=orgaoTramoDAO.count("coeficienteTarifa1", entidad); + count +=orgaoTramoDAO.count("coeficienteTarifa2", entidad); + count +=orgaoTramoDAO.count("coeficienteTarifa3", entidad); + + if (count >0 ){ + throw new RegistroConDependenciaException(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + coeficienteTarifaDAO.actualizacion(entidad); + } + + public List buscar(String nomb) { + return coeficienteTarifaDAO.buscar(nomb); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java new file mode 100644 index 000000000..b4ce8beba --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ColoniaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; +import com.rjconsultores.ventaboletos.service.ColoniaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import org.springframework.stereotype.Service; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("coloniaService") +public class ColoniaServiceImpl implements ColoniaService { + + @Autowired + private ColoniaDAO coloniaDAO; + + public List obtenerTodos() { + return coloniaDAO.obtenerTodos(); + } + + public Colonia obtenerID(Integer id) { + return coloniaDAO.obtenerID(id); + } + + @Transactional + public Colonia suscribir(Colonia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coloniaDAO.suscribir(entidad); + } + + @Transactional + public Colonia actualizacion(Colonia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coloniaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Colonia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + coloniaDAO.actualizacion(entidad); + } + + public List buscar(String desccolonia) { + return coloniaDAO.buscar(desccolonia); + } + + public List buscarPorCiudad(Ciudad ciudad) { + return coloniaDAO.buscarPorCiudad(ciudad); + } + + @Override + public List buscaLike(String desccolonia) { + return coloniaDAO.buscaLike(desccolonia); + } + + @Override + public List buscarPorCodMun(Ciudad ciudad, String desccolonia) { + return coloniaDAO.buscarPorCodMun(ciudad, desccolonia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ComisionistaExternoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ComisionistaExternoServiceImpl.java new file mode 100644 index 000000000..c35b29986 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ComisionistaExternoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ComisionistaExternoDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.service.ComisionistaExternoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("comisionistaExternoService") +public class ComisionistaExternoServiceImpl implements ComisionistaExternoService { + + @Autowired + private ComisionistaExternoDAO comisionistaExternoDAO; + + public List obtenerTodos() { + return comisionistaExternoDAO.obtenerTodos(); + } + + public ComisionistaExterno obtenerID(Integer id) { + return comisionistaExternoDAO.obtenerID(id); + } + + @Transactional + public ComisionistaExterno suscribir(ComisionistaExterno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return comisionistaExternoDAO.suscribir(entidad); + } + + @Transactional + public ComisionistaExterno actualizacion(ComisionistaExterno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return comisionistaExternoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ComisionistaExterno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + comisionistaExternoDAO.actualizacion(entidad); + } + + public List buscar(String desccomisionista) { + return comisionistaExternoDAO.buscar(desccomisionista); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ComissaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ComissaoServiceImpl.java new file mode 100644 index 000000000..9f3bbf027 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ComissaoServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.service.ComissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +@Service("comissaoService") +public class ComissaoServiceImpl implements ComissaoService { + + @Autowired + private ComissaoDAO comissaoDAO; + + @Override + public List obtenerTodos() { + return comissaoDAO.obtenerTodos(); + } + + @Override + public Comissao obtenerID(Integer id) { + return comissaoDAO.obtenerID(id); + } + + @Override + @Transactional + public Comissao suscribir(Comissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return comissaoDAO.suscribir(entidad); + } + + @Override + @Transactional + public Comissao actualizacion(Comissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return comissaoDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(Comissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + comissaoDAO.actualizacion(entidad); + } + + @Override + public List buscaHistoricoComissao(Integer puntoVentaId, Integer empresaId, Date periodoInicio, Date periodoFim) { + return comissaoDAO.buscaHistoricoComissao(puntoVentaId, empresaId, periodoInicio, periodoFim); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CompaniaBancariaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CompaniaBancariaServiceImpl.java new file mode 100644 index 000000000..9858e6d6e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CompaniaBancariaServiceImpl.java @@ -0,0 +1,81 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CompaniaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; +import com.rjconsultores.ventaboletos.service.CompaniaBancariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("companiaBancariaService") +public class CompaniaBancariaServiceImpl implements CompaniaBancariaService { + + @Autowired + private CompaniaBancariaDAO companiaBancariaDAO; + + public List obtenerTodos() { + return companiaBancariaDAO.obtenerTodos(); + } + + public CompaniaBancaria obtenerID(Integer id) { + return companiaBancariaDAO.obtenerID(id); + } + + @Transactional + public CompaniaBancaria suscribir(CompaniaBancaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return companiaBancariaDAO.suscribir(entidad); + } + + @Transactional + public CompaniaBancaria actualizacion(CompaniaBancaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return companiaBancariaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CompaniaBancaria entidad) { + entidad = this.obtenerID(entidad.getCompaniabancariaId()); + + for (UsuarioBancario u : entidad.getUsuarioBancarioList()) { + u.setActivo(Boolean.FALSE); + u.setFecmodif(Calendar.getInstance().getTime()); + u.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + for (MerchantBancario m : entidad.getMerchantBancarioList()) { + m.setActivo(Boolean.FALSE); + m.setFecmodif(Calendar.getInstance().getTime()); + m.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + companiaBancariaDAO.actualizacion(entidad); + } + + public List buscar(CompaniaBancaria companiaBancaria) { + return companiaBancariaDAO.buscar(companiaBancaria); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConductorServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConductorServiceImpl.java new file mode 100644 index 000000000..9e8dcb04c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConductorServiceImpl.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConductorDAO; +import com.rjconsultores.ventaboletos.entidad.Conductor; +import com.rjconsultores.ventaboletos.service.ConductorService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("conductorService") +public class ConductorServiceImpl implements ConductorService { + + @Autowired + private ConductorDAO conductorDAO; + + public List obtenerTodos() { + return conductorDAO.obtenerTodos(); + } + + public Conductor obtenerID(Integer id) { + return conductorDAO.obtenerID(id); + } + + @Transactional + public Conductor suscribir(Conductor entidad) { + return conductorDAO.suscribir(entidad); + } + + @Transactional + public Conductor actualizacion(Conductor entidad) { + return conductorDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Conductor entidad) { + conductorDAO.borrar(entidad); + } + + public Conductor buscar(String claveConductor, String contraSenha) { + return conductorDAO.buscar(claveConductor, contraSenha); + } + + public Conductor buscarPorEmpleado(int empleadoId){ + return conductorDAO.buscarPorEmpleado(empleadoId); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionConfServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionConfServiceImpl.java new file mode 100644 index 000000000..6aa26bba3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionConfServiceImpl.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionConfDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.service.ConexionConfService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionConfService") +public class ConexionConfServiceImpl implements ConexionConfService { + @Autowired + private ConexionConfDAO conexionConfDAO; + + public List obtenerTodos() { + return conexionConfDAO.obtenerTodos(); + } + + public ConexionConf obtenerID(Long id) { + return conexionConfDAO.obtenerID(id); + } + + @Transactional + public ConexionConf suscribir(ConexionConf entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionConfDAO.suscribir(entidad); + } + + @Transactional + public ConexionConf actualizacion(ConexionConf entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionConfDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConexionConf entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + conexionConfDAO.actualizacion(entidad); + } + + @Override + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo) { + return conexionConfDAO.buscar(conexionCtrlId, numgrupo); + } + + @Override + public List buscarPorConexionCtrl(ConexionCtrl entidad) { + return conexionConfDAO.buscarPorConexionCtrl(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java new file mode 100644 index 000000000..f044e0cb6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java @@ -0,0 +1,77 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.service.ConexionConfService; +import com.rjconsultores.ventaboletos.service.ConexionCtrlService; +import com.rjconsultores.ventaboletos.service.ConexionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionCtrlService") +public class ConexionCtrlServiceImpl implements ConexionCtrlService { + @Autowired + private ConexionCtrlDAO conexionCtrlDAO; + @Autowired + private ConexionService conexionService; + @Autowired + private ConexionConfService conexionConfDAO; + + public List obtenerTodos() { + return conexionCtrlDAO.obtenerTodos(); + } + + public ConexionCtrl obtenerID(Long id) { + return conexionCtrlDAO.obtenerID(id); + } + + @Transactional + public ConexionCtrl suscribir(ConexionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionCtrlDAO.suscribir(entidad); + } + + @Transactional + public ConexionCtrl actualizacion(ConexionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConexionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + List lsConexion = conexionService.buscarPorConexionCtrl(entidad.getConexionctrlId()); + for (Conexion conexion : lsConexion) { + conexionService.borrar(conexion); + } + + List lsConexionConf = conexionConfDAO.buscarPorConexionCtrl(entidad); + for (ConexionConf conexionConf : lsConexionConf) { + conexionConfDAO.borrar(conexionConf); + } + + conexionCtrlDAO.actualizacion(entidad); + } + + @Override + public List buscarConexionesCtrl(Integer origenId, Integer destinoId) { + return conexionCtrlDAO.buscarConexionesCtrl(origenId, destinoId); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionRutaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionRutaServiceImpl.java new file mode 100644 index 000000000..dce11144d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionRutaServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; +import com.rjconsultores.ventaboletos.service.ConexionExcepcionRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionExcepcionRutaService") +public class ConexionExcepcionRutaServiceImpl implements ConexionExcepcionRutaService { + + @Autowired + private ConexionExcepcionRutaDAO conexionExcepcionRutaDAO; + + @Override + public List obtenerTodos() { + return conexionExcepcionRutaDAO.obtenerTodos(); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + return conexionExcepcionRutaDAO.obtenerConexionExcepcionsActivo(conexionctrlId); + } + + @Override + public ConexionExcepcionRuta obtenerID(Long id) { + return conexionExcepcionRutaDAO.obtenerID(id); + } + + @Override + @Transactional + public ConexionExcepcionRuta suscribir(ConexionExcepcionRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionRutaDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConexionExcepcionRuta actualizacion(ConexionExcepcionRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionRutaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConexionExcepcionRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + conexionExcepcionRutaDAO.actualizacion(entidad); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionServiceImpl.java new file mode 100644 index 000000000..013b0f01f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionServiceImpl.java @@ -0,0 +1,67 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; +import com.rjconsultores.ventaboletos.service.ConexionExcepcionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionExcepcionService") +public class ConexionExcepcionServiceImpl implements ConexionExcepcionService { + + @Autowired + private ConexionExcepcionDAO conexionExcepcionDAO; + + @Override + public List obtenerTodos() { + return conexionExcepcionDAO.obtenerTodos(); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + return conexionExcepcionDAO.obtenerConexionExcepcionsActivo(conexionctrlId); + } + + @Override + public ConexionExcepcion obtenerID(Long id) { + return conexionExcepcionDAO.obtenerID(id); + } + + @Override + @Transactional + public ConexionExcepcion suscribir(ConexionExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConexionExcepcion actualizacion(ConexionExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConexionExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + conexionExcepcionDAO.actualizacion(entidad); + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java new file mode 100644 index 000000000..de41fda84 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.service.ConexionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +@Service("conexionService") +public class ConexionServiceImpl implements ConexionService { + + @Autowired + private ConexionDAO conexionDAO; + + @Override + @Transactional + public void gerarConexiones() { + conexionDAO.generarConexiones(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + @Override + public List buscarConexionesValidas() { + return conexionDAO.buscarConexionesValidas(); + } + + @Override + public List buscarConexiones(Integer origenId, Integer destinoId) { + return conexionDAO.buscarConexiones(origenId, destinoId); + } + + @Override + @Transactional + public Conexion suscribir(Conexion conexion) { + conexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexion.setFecmodif(Calendar.getInstance().getTime()); + conexion.setActivo(Boolean.TRUE); + + return conexionDAO.suscribir(conexion); + } + + @Override + @Transactional + public Conexion actualizacion(Conexion conexion) { + conexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexion.setFecmodif(Calendar.getInstance().getTime()); + conexion.setActivo(Boolean.TRUE); + + return conexionDAO.actualizacion(conexion); + } + + @Override + public List buscarPorConexionCtrl(Long conexcionCtrlId) { + return conexionDAO.buscarPorConexionCtrl(conexcionCtrlId); + } + + @Override + @Transactional + public void borrar(Conexion conexion) { + conexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexion.setFecmodif(Calendar.getInstance().getTime()); + conexion.setActivo(Boolean.FALSE); + + conexionDAO.actualizacion(conexion); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java new file mode 100644 index 000000000..d5f67edf3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java @@ -0,0 +1,234 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoCanalVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ConfRestricaoCanalVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoCanalVentaService") +public class ConfRestricaoCanalVentaServiceImpl implements ConfRestricaoCanalVentaService { + @Autowired + private ConfRestricaoCanalVentaDAO confRestricaoCanalVentaDAO; + + + public ConfRestricaoCanalVenta obtenerID(Integer id) { + return confRestricaoCanalVentaDAO.obtenerID(id); + } + + @Transactional + @Override + public ConfRestricaoCanalVenta suscribirActualizar(ConfRestricaoCanalVenta entidad) throws BusinessException { + + if (StringUtils.isBlank(entidad.getDescConfRestricaoCanalVenta() )){ + throw new BusinessException("confRestricaoCanalVentaService.MSG.descripcionObliga"); + } + + if (entidad.getTipoPuntoVenta() == null){ + throw new BusinessException("confRestricaoCanalVentaService.MSG.canalObliga"); + } + + //se a ruta não é informada, é obrigatório informar a origem e destino + if ( (entidad.getRuta() == null) && ( (entidad.getOrigem() == null) || (entidad.getDestino() == null)) ){ + throw new BusinessException("confRestricaoCanalVentaService.MSG.oriDestObliga"); + } + + if ( ((entidad.getOrigem() != null) && (entidad.getDestino() == null)) || ((entidad.getOrigem() == null) && (entidad.getDestino() != null)) ){ + throw new BusinessException("confRestricaoCanalVentaService.MSG.oriDestObliga"); + } + +// lsConfRestricaoCanalVenta = obtenerTodos(); +// +// if(isBloqueoExistente(entidad, lsConfRestricaoCanalVenta)){ +// throw new BusinessException("editarConfRestricaoCanalVentaController.MSG.bloqueoExistente"); +// } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getConfRestricaoCanalVentaId() == null){ + return confRestricaoCanalVentaDAO.suscribir(entidad); + }else{ + return confRestricaoCanalVentaDAO.actualizacion(entidad); + } + } + @Transactional + public void borrar(ConfRestricaoCanalVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoCanalVentaDAO.actualizacion(entidad); + } + + private boolean isBloqueoExistente(ConfRestricaoCanalVenta c , List confRestricaoCanalVentaList){ + + List ls = new ArrayList() ; + + for (int i = 0; i < confRestricaoCanalVentaList.size(); i++){ + ConfRestricaoCanalVenta elementList = (ConfRestricaoCanalVenta)confRestricaoCanalVentaList.get(i); + if(c.getConfRestricaoCanalVentaId() == null){ + if(isConfRestricaoCanalVentasEquivalentes(c , elementList)){ + return true; + } + }else{ + if(!c.getConfRestricaoCanalVentaId().equals(elementList.getConfRestricaoCanalVentaId())){ + isConfRestricaoCanalVentasEquivalentes(c , elementList); + }else{ + continue; + } + } + } + return false; + } + + private boolean isConfRestricaoCanalVentasEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(isRutasTipoPvCorridaIdOrigemDestinoEquivalentes(a,b) + && (((a.getFecCorrida() != null) != (b.getFecCorrida() != null)) ? false : true) + && ((a.getFecCorrida() != null ) && (b.getFecCorrida() != null) ? true : false ) + && ((((a.getFecCorrida().compareTo(b.getFecCorrida())) == 0)) ? true : false ) + && isIntercessaoDiasSemana(a,b) + ){ + return true; + }else if(isRutasTipoPvCorridaIdOrigemDestinoEquivalentes(a,b) + && ((a.getFecCorrida() == null) ) && ( (b.getFecCorrida() == null) ) + && isIntercessaoDiasSemana(a,b) + ){ + return true; + } + return false; + } + + private boolean isRutasTipoPvCorridaIdOrigemDestinoEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(isRutasEquivalentes(a,b) + && isTipoPVEquivalentes(a,b) + && isCorridaIdEquivalentes(a,b) + && isOrigemEquivalentes(a,b) + && isDestinoEquivalentes(a,b)){ + return true; + }else{ + return false; + } + } + + private boolean isRutasEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getRuta() == null && b.getRuta() == null ){ + return true; + } + if(a.getRuta() == null && b.getRuta() != null ){ + return false; + } + if(a.getRuta() != null && b.getRuta() == null ){ + return false; + } + if(a.getRuta() != null && b.getRuta() != null ){ + return a.getRuta().equals(b.getRuta()); + } + return false; + } + + private boolean isTipoPVEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getTipoPuntoVenta() == null && b.getTipoPuntoVenta() == null ){ + return true; + } + if(a.getTipoPuntoVenta() == null && b.getTipoPuntoVenta() != null ){ + return false; + } + if(a.getTipoPuntoVenta() != null && b.getTipoPuntoVenta() == null ){ + return false; + } + if(a.getTipoPuntoVenta() != null && b.getTipoPuntoVenta() != null ){ + return a.getTipoPuntoVenta().equals(b.getTipoPuntoVenta()); + } + return false; + } + + private boolean isCorridaIdEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getCorridaId() == null && b.getCorridaId() == null ){ + return true; + } + if(a.getCorridaId() == null && b.getCorridaId() != null ){ + return false; + } + if(a.getCorridaId() != null && b.getCorridaId() == null ){ + return false; + } + if(a.getCorridaId() != null && b.getCorridaId() != null ){ + return a.getCorridaId().equals(b.getCorridaId()); + } + return false; + } + + private boolean isOrigemEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getOrigem() == null && b.getOrigem() == null ){ + return true; + } + if(a.getOrigem() == null && b.getOrigem() != null ){ + return false; + } + if(a.getOrigem() != null && b.getOrigem() == null ){ + return false; + } + if(a.getOrigem() != null && b.getOrigem() != null ){ + return a.getOrigem().equals(b.getOrigem()); + } + return false; + } + + private boolean isDestinoEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getDestino() == null && b.getDestino() == null ){ + return true; + } + if(a.getDestino() == null && b.getDestino() != null ){ + return false; + } + if(a.getDestino() != null && b.getDestino() == null ){ + return false; + } + if(a.getDestino() != null && b.getDestino() != null ){ + return a.getDestino().equals(b.getDestino()); + } + return false; + } + + private boolean isIntercessaoDiasSemana(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if( ((a.getDomingo() != null ? a.getDomingo() : false) && (b.getDomingo() != null ? b.getDomingo() : false )) + || (a.getSegunda()!= null ? a.getSegunda() : false) && (b.getSegunda() != null ? b.getSegunda() : false) + || (a.getTerca() != null ? a.getTerca() : false ) && (b.getTerca() != null ? b.getTerca() : false) + || (a.getQuarta()!= null ? a.getQuarta() : false ) && (b.getQuarta() != null ? b.getQuarta() : false) + || (a.getQuinta() != null ? a.getQuinta() : false) && (b.getQuinta() != null ? b.getQuinta() : false) + || (a.getSexta() != null ? a.getSexta() : false) && (b.getSexta() != null ? b.getSexta() : false ) + || (a.getSabado() != null ? a.getSabado() : false ) && (b.getSabado() != null ? b.getSabado() : false) ){ + return true; + } + if(null == a.getSegunda() + && null == b.getSegunda() + && null == a.getTerca() + && null == b.getTerca() + && null == a.getQuarta() + && null == b.getQuarta() + && null == a.getQuinta() + && null == b.getQuinta() + && null == a.getSexta() + && null == b.getSexta() + && null == a.getSabado() + && null == b.getSabado() + && null == a.getDomingo() + && null == b.getDomingo()){ + return true; + } + + return false; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoExcecaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoExcecaoServiceImpl.java new file mode 100644 index 000000000..ae169d9a7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoExcecaoServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoExcecaoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; +import com.rjconsultores.ventaboletos.service.ConfRestricaoExcecaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoExcecaoService") +public class ConfRestricaoExcecaoServiceImpl implements ConfRestricaoExcecaoService { + + @Autowired + private ConfRestricaoExcecaoDAO confRestricaoExcecaoDAO; + + public List obtenerTodos() { + return confRestricaoExcecaoDAO.obtenerTodos(); + } + + public ConfRestricaoExcecao obtenerID(Integer id) { + return confRestricaoExcecaoDAO.obtenerID(id); + } + + @Transactional + public ConfRestricaoExcecao suscribir(ConfRestricaoExcecao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoExcecaoDAO.suscribir(entidad); + } + + @Transactional + public ConfRestricaoExcecao actualizacion(ConfRestricaoExcecao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoExcecaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConfRestricaoExcecao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoExcecaoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoPtovtaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoPtovtaServiceImpl.java new file mode 100644 index 000000000..5cd020692 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoPtovtaServiceImpl.java @@ -0,0 +1,79 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoPtovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.ConfRestricaoPtovtaService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoPtovtaService") +public class ConfRestricaoPtovtaServiceImpl implements ConfRestricaoPtovtaService { + + @Autowired + ConfRestricaoPtovtaDAO confRestricaoPtovtaDAO; + @Autowired + private PuntoVentaService puntoVentaService; + + @Override + public List obtenerTodos() { + return confRestricaoPtovtaDAO.obtenerTodos(); + } + + @Override + public ConfRestricaoPtovta obtenerID(Integer id) { + return confRestricaoPtovtaDAO.obtenerID(id); + } + + @Override + public ConfRestricaoPtovta obtenerPtovtaTodos() { + + ConfRestricaoPtovta entidad = new ConfRestricaoPtovta(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + PuntoVenta puntoVenta = puntoVentaService.obtenerID(-1); + entidad.setPuntoVenta(puntoVenta); + + return entidad; + } + + @Override + @Transactional + public ConfRestricaoPtovta suscribir(ConfRestricaoPtovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoPtovtaDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConfRestricaoPtovta actualizacion(ConfRestricaoPtovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoPtovtaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConfRestricaoPtovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoPtovtaDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java new file mode 100644 index 000000000..47831b0c5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java @@ -0,0 +1,583 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO; +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EtiquetaMalote; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; +import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao; + +@Service("conferenciaComissaoService") +public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoService { + + private static Logger log = Logger.getLogger(ConferenciaComissaoService.class); + + @Autowired + private ConferenciaComissaoDAO conferenciaComissaoDAO; + + @Autowired + private EmpresaDAO empresaDAO; + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + + @Override + public List obtenerTodos() { + return conferenciaComissaoDAO.obtenerTodos(); + } + + @Override + public Conferencia obtenerID(Long id) { + return conferenciaComissaoDAO.obtenerID(id); + } + + @Override + public Conferencia suscribir(Conferencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return conferenciaComissaoDAO.suscribir(entidad); + } + + @Override + public Conferencia actualizacion(Conferencia entidad) { + return conferenciaComissaoDAO.actualizacion(entidad); + } + + @Override + public void borrar(Conferencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + conferenciaComissaoDAO.borrar(entidad); + } + + @Override + public List carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + return conferenciaComissaoDAO.carregarConferenciaComissao(competencia, empresa, puntoVenta); + } + + @Override + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException { + conferencia.setDatamalote(new Date()); + conferencia.setUsuarioMaloteId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return conferenciaComissaoDAO.confirmarChegadaMalote(conferencia); + } + + @Override + public Conferencia suscribirOrActualizacion(Conferencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return conferenciaComissaoDAO.suscribirOrActualizacion(entidad); + } + + @Override + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException { + conferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conferencia.setFecmodif(Calendar.getInstance().getTime()); + return conferenciaComissaoDAO.encerrarMovimentoDiario(conferencia); + } + + @Override + public List carregarEventosFinanceiros(Conferencia conferencia) throws BusinessException { + return conferenciaComissaoDAO.carregarEventosFinanceiros(conferencia); + } + + @Override + public List carregarLogConferencia(Conferencia conferencia) throws BusinessException { + return conferenciaComissaoDAO.carregarLogConferencia(conferencia); + } + + @Override + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) throws BusinessException { + logConferencia.setActivo(Boolean.TRUE); + logConferencia.setUsuario(UsuarioLogado.getUsuarioLogado()); + logConferencia.setFecmodif(new Date()); + return conferenciaComissaoDAO.suscribirLogConferencia(logConferencia); + } + + @Override + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException { + logConferencia.setActivo(Boolean.FALSE); + logConferencia.setUsuario(UsuarioLogado.getUsuarioLogado()); + logConferencia.setFecmodif(new Date()); + conferenciaComissaoDAO.borrarLogConferencia(logConferencia); + } + + @Override + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId) { + return conferenciaComissaoDAO.obtenerLogConferenciaID(logconferenciaId); + } + + @Override + public List carregarBilhetesComissao(List boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao) throws BusinessException { + if(boletoComissaos == null) { + boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia); + } + + if(boletoStatusComissao == null) { + return boletoComissaos; + } + + Empresa empresa = empresaDAO.obtenerID(conferencia.getEmpresa().getEmpresaId()); + ComEmpConferencia comEmpConferencia = null; + if(empresa.getComEmpConferencias() != null && !empresa.getComEmpConferencias().isEmpty()) { + comEmpConferencia = empresa.getComEmpConferencias().iterator().next(); + } + + List retorno = new ArrayList(); + switch (boletoStatusComissao) { + case BOLETOS_VENDIDOS: + retorno.addAll(carregarBilhetesVendidos(boletoComissaos, comEmpConferencia)); + break; + case BOLETO_MANUAL: + retorno.addAll(carregarBilhetesManuais(boletoComissaos, comEmpConferencia)); + break; + case BOLETO_CANCELADO: + retorno.addAll(carregarBilhetesCancelados(boletoComissaos, comEmpConferencia)); + break; + case BOLETO_DEVOLVIDO: + retorno.addAll(carregarBilhetesDevolvidos(boletoComissaos, StringUtils.isNotBlank(conferencia.getNumfoliosistema()), comEmpConferencia)); + break; + case GAP_VENDIDOS: + retorno.addAll(carregarBilhetesGapsVendidos(boletoComissaos, comEmpConferencia)); + break; + case GAP_CANCELADO: + retorno.addAll(carregarBilhetesGapCancelados(boletoComissaos, comEmpConferencia)); + break; + case GAP_DEVOLVIDO: + retorno.addAll(carregarBilhetesGapDevolvidos(boletoComissaos, comEmpConferencia)); + break; + default: + break; + } + return retorno; + } + + private Set carregarBilhetesManuais(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilhetesManualVendido()) { + + if(comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetemanual()); + } + + boletos.add(boletoComissao); + } + } + return boletos; + } + + private Set carregarBilhetesVendidos(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteNormalVendido() || + boletoComissao.isBilheteEntregaGap() || + boletoComissao.isBilheteNormalChekin() || + boletoComissao.isBilheteAberto() || + boletoComissao.isBilheteEntregaAberto()) { + + if(comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetevendido()); + } + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesCancelados(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteNormalCancelado() || + boletoComissao.isBilheteNormalTrocadoCancelado() || + boletoComissao.isBilheteAbertoCancelado() || + boletoComissao.isBilheteEntregaGapCancelado()) { + + if(comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetecancelado()); + } + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesDevolvidos(List boletoComissaos, boolean pesquisa, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteNormalDevolvido() || + boletoComissao.isBilheteNormalTrocado() || + boletoComissao.isBilheteNormalTrocadoDevolvido() || + boletoComissao.isBilheteNormalTransferidoDevolvido() || + boletoComissao.isBilheteAbertoDevolvido() || + boletoComissao.isBilheteEntregaGapDevolvido() || + boletoComissao.isBilheteEntregaGapTrocado()) { + + boletoComissao.setExigeConferenciaDevolvido(boletoComissao.getIndcarboletosdevolvidosconf() != null && !boletoComissao.getIndcarboletosdevolvidosconf()); + + if(comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetedevolvido()); + } + + if(pesquisa || + ((boletoComissao.getIndcarboletosdevolvidosconf() != null && boletoComissao.getIndcarboletosdevolvidosconf()) || boletoComissao.getLogconferenciaId() != null)) { + boletos.add(boletoComissao); + } + + } + } + return boletos; + } + + private Set carregarBilhetesGapsVendidos(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteGapVendido()) { + + if(comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapvendido()); + } + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesGapCancelados(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteGapCancelado()) { + + if(comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapcancelado()); + } + + boletos.add(boletoComissao); + } + } + return boletos; + } + + private Set carregarBilhetesGapDevolvidos(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteGapDevolvido() || + boletoComissao.isBilheteGapTrocado()) { + + if(comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapdevolvido()); + } + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + @Override + public List carregarOcds(Conferencia conferencia) throws BusinessException { + return conferenciaComissaoDAO.carregarOcds(conferencia); + } + + @Override + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException { + conferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conferencia.setFecmodif(Calendar.getInstance().getTime()); + return conferenciaComissaoDAO.reabrirMovimentoDiario(conferencia); + } + + @Override + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException { + return conferenciaComissaoDAO.obtenerConferenciaDataMovimento(datamovimento, puntoventaId, empresaId); + } + + @Override + public boolean isBilhetesSemConferencia(List lsBoletoComissao) throws BusinessException { + for (BoletoComissao boletoComissao : lsBoletoComissao) { + if((boletoComissao.isExigeConferencia() || boletoComissao.isExigeConferenciaAba() || boletoComissao.isExigeConferenciaBoletoDevolvido()) && + (!boletoComissao.isConferido() && boletoComissao.getLogconferenciaId() == null)) { + return true; + } + } + return false; + } + + @Override + public boolean isEventosFinanceirosSemConferencia(List lsEventosFinanceiros) throws BusinessException { + for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { + if((eventosFinanceiros.isExigeConferencia() || (eventosFinanceiros.getExigeConferenciaAba() != null && eventosFinanceiros.getExigeConferenciaAba())) && + (!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) { + return true; + } + } + return false; + } + + @Override + public BigDecimal totalizarBoletoComissao(List lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException { + List lStatusBilhete = null; + if(statusBilhete != null && statusBilhete.length > 0) { + lStatusBilhete = Arrays.asList(statusBilhete); + } + + BigDecimal total = BigDecimal.ZERO; + if(lsBoletoComissao != null) { + for (BoletoComissao boletoComissao : lsBoletoComissao) { + if(lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) { + total = total.add(boletoComissao.getTotal()); + } + } + } + return total; + } + + @Override + public Map totalizarBoletoComissaoDevolvidosTrocaOcd(List lsBoletoComissao) throws BusinessException { + BigDecimal totalDevolvidos = BigDecimal.ZERO; + BigDecimal totalTroca = BigDecimal.ZERO; + BigDecimal totalOcd = BigDecimal.ZERO; + if(lsBoletoComissao != null) { + for (BoletoComissao boletoComissao : lsBoletoComissao) { + if(boletoComissao.isOcd()) { + totalOcd = totalOcd.add(boletoComissao.getTotal()); + } else if(boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionDevolvido()) { + totalDevolvidos = totalDevolvidos.add(boletoComissao.getTotal()); + } else if(boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionTrocado()) { + totalTroca = totalTroca.add(boletoComissao.getTotal()); + } + } + } + Map maps = new HashMap(); + maps.put(BoletoStatusComissao.BOLETO_DEVOLVIDO, totalDevolvidos); + maps.put(BoletoStatusComissao.BOLETO_DEVOLVIDO_OCD, totalOcd); + maps.put(BoletoStatusComissao.BOLETO_DEVOLVIDO_TROCADO, totalTroca); + return maps; + } + + @Override + public BigDecimal totalizarEventosFinanceiros(List lsEventosFinanceiros) throws BusinessException { + BigDecimal total = BigDecimal.ZERO; + if(lsEventosFinanceiros != null) { + for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { + total = total.add(eventosFinanceiros.getImpingreso()); + } + } + return total; + } + + @Override + public OcdVO totalizarOcd(List lsOcd) throws BusinessException { + OcdVO total = new OcdVO(); + total.setValorPagar(BigDecimal.ZERO); + total.setPenalizacion(BigDecimal.ZERO); + + if(lsOcd != null) { + for (OcdVO ocd : lsOcd) { + total.setValorPagar(total.getValorPagar().add(ocd.getValorPagar())); + } + } + return total; + } + + @Override + public ResumoComissao gerarResumo(Conferencia conferencia, List boletoComissaos, List lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos, + BigDecimal totalBilhetesCancelados, BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados, + BigDecimal totalBilhetesGapDevolvidos, BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd) throws BusinessException { + ResumoComissao resumoComissao = new ResumoComissao(); + resumoComissao.setTotalDevolvidos(totalBilhetesDevolvidos.add(totalBilhetesGapDevolvidos)); + resumoComissao.setTotalCancelados(totalBilhetesCancelados.add(totalBilhetesGapCancelados)); + resumoComissao.setTotalVendas(totalBilhetesVendidos.add(totalBilhetesManual).add(totalBilhetesGap)); + resumoComissao.setTotalReceitas(totalCreditosEventoFinanceiros); + resumoComissao.setTotalDespesas(totalDebitosEventoFinanceiros); + resumoComissao.setTotalOcd(totalOcd); + + carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros); + + resumoComissao.setValorDeposito(conferenciaComissaoDAO.carregarValorDepositoContaCorrente(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId(), conferencia.getDatamovimento())); + + return resumoComissao; + } + + private void carregarTotalFormapago(ResumoComissao resumoComissao, List boletoComissaos, List lsEventosFinanceiros) { + List totalFormapagos = new ArrayList(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isTotalizarFormapago()) { + + for (FormapagoVO formapagoBoleto : boletoComissao.getFormapagos()) { + FormapagoVO formapago; + if(totalFormapagos.contains(formapagoBoleto)) { + formapago = totalFormapagos.get(totalFormapagos.indexOf(formapagoBoleto)); + } else { + formapago = new FormapagoVO(formapagoBoleto.getFormapagoId(), formapagoBoleto.getDescpago(), null, BigDecimal.ZERO); + totalFormapagos.add(formapagoBoleto); + } + + if(boletoComissao.isStatusVendido() || boletoComissao.isStatusTroca()) { + formapago.add(formapagoBoleto.getImporte()); + } else if(boletoComissao.isStatusCancelado() && + (boletoComissao.isMotivocancelacionCancelado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionTrocado())) { + formapago.subtract(formapagoBoleto.getImporte()); + } + } + + } + } + + for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { + FormapagoVO formapagoEventoFinanceiro = new FormapagoVO(eventosFinanceiros.getFormapagoId(), eventosFinanceiros.getDescpago(), null, BigDecimal.ZERO); + if(totalFormapagos.contains(formapagoEventoFinanceiro)) { + formapagoEventoFinanceiro = totalFormapagos.get(totalFormapagos.indexOf(formapagoEventoFinanceiro)); + } else { + totalFormapagos.add(formapagoEventoFinanceiro); + } + + if(eventosFinanceiros.isCredito()) { + formapagoEventoFinanceiro.add(eventosFinanceiros.getImpingreso()); + } else if(eventosFinanceiros.isDebito()) { + formapagoEventoFinanceiro.subtract(eventosFinanceiros.getImpingreso()); + } + } + resumoComissao.setTotalFormapago(totalFormapagos); + } + + @Override + public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException { + try { + EtiquetaMalote etiquetaMalote = new EtiquetaMalote(); + log.debug("Empresa: " + codigoBarras.substring(0,4)); + etiquetaMalote.setEmpresaId(Integer.valueOf(codigoBarras.substring(0,4))); + log.debug("Punto Venta: " + codigoBarras.substring(4,9)); + etiquetaMalote.setPuntoventaId(Integer.valueOf(codigoBarras.substring(4,9))); + log.debug("Numero Malote: " + codigoBarras.substring(9,19)); + etiquetaMalote.setNumeroMalote(codigoBarras.substring(9,19)); + log.debug("Data inicial: " + codigoBarras.substring(19,27)); + etiquetaMalote.setDataInicial(DateUtil.getDateFromString(codigoBarras.substring(19,27), "ddMMyyyy")); + log.debug("Data final: " + codigoBarras.substring(27,35)); + etiquetaMalote.setDataFinal(DateUtil.getDateFromString(codigoBarras.substring(27,35), "ddMMyyyy")); + + Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId()); + if(empresa == null) { + throw new BusinessException("recebimentoMaloteController.msg.erro.empresaNaoLocalizada"); + } + etiquetaMalote.setNombempresa(empresa.getNombempresa()); + PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId()); + if(puntoVenta == null) { + throw new BusinessException("recebimentoMaloteController.msg.erro.puntoVentaNaoLocalizado"); + } + etiquetaMalote.setNombpuntoventa(puntoVenta.getNombpuntoventa()); + + return etiquetaMalote; + } catch (BusinessException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return null; + } + + @Override + public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote) throws BusinessException { + try { + Calendar cDataInicial = Calendar.getInstance(LocaleUtil.getLocale()); + cDataInicial.setTime(DateUtil.normalizar(etiquetaMalote.getDataInicial())); + + Calendar cDataFinal = Calendar.getInstance(LocaleUtil.getLocale()); + cDataFinal.setTime(DateUtil.normalizar(etiquetaMalote.getDataFinal())); + + Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId()); + PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId()); + + while (cDataInicial.compareTo(cDataFinal) <= 0) { + Conferencia conferencia = obtenerConferenciaDataMovimento(cDataInicial.getTime(), etiquetaMalote.getPuntoventaId(), etiquetaMalote.getEmpresaId()); + if(conferencia == null) { + conferencia = new Conferencia(); + conferencia.setDatamovimento(cDataInicial.getTime()); + conferencia.setEmpresa(empresa); + conferencia.setPuntoVenta(puntoVenta); + + conferencia = suscribirOrActualizacion(conferencia); + } + cDataInicial.add(Calendar.DAY_OF_MONTH, 1); + + if(conferencia != null && conferencia.getIndmaloterecebido()) { + continue; + } + confirmarChegadaMalote(conferencia); + + } + + } catch (BusinessException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + @Override + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + return conferenciaComissaoDAO.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta); + } + + @Override + public boolean isOcdSemConferencia(List lsOcd) throws BusinessException { + for (OcdVO ocd : lsOcd) { + if(ocd.isExigeConferenciaAba() && (!ocd.isConferido() && ocd.getLogconferenciaId() == null)) { + return true; + } + } + return false; + } + + @Override + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + return conferenciaComissaoDAO.carregarConferenciaRegistrada(datamovimento, empresa, puntoVenta); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfigRestriccionPagoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfigRestriccionPagoServiceImpl.java new file mode 100644 index 000000000..cc480a7fc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConfigRestriccionPagoServiceImpl.java @@ -0,0 +1,144 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConfigRestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import com.rjconsultores.ventaboletos.service.ConfigRestriccionPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("configRestriccionPagoService") +public class ConfigRestriccionPagoServiceImpl implements ConfigRestriccionPagoService { + + public static final Integer RESTRICCION_CANCELABLE = 1; + public static final Integer RESTRICCION_TRANSFERIBLE = 2; + public static final Integer RESTRICCION_RESERVABLE = 3; + public static final Integer RESTRICCION_NO_CANCELABLE = 4; + public static final Integer RESTRICCION_NO_TRANSFERIBLE = 5; + public static final Integer RESTRICCION_NO_RESERVABLE = 6; + @Autowired + private ConfigRestriccionPagoDAO configRestriccionPagoDAO; + + public List obtenerTodos() { + return configRestriccionPagoDAO.obtenerTodos(); + } + + public ConfigRestriccionPago obtenerID(Integer id) { + return configRestriccionPagoDAO.obtenerID(id); + } + + @Transactional + public ConfigRestriccionPago suscribir(ConfigRestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return configRestriccionPagoDAO.suscribir(entidad); + } + + @Transactional + public ConfigRestriccionPago actualizacion(ConfigRestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return configRestriccionPagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConfigRestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + configRestriccionPagoDAO.actualizacion(entidad); + } + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago) { + return configRestriccionPagoDAO.buscar(formaPago, restriccionPago); + } + + public boolean puedoDarDeAlta(ConfigRestriccionPago configRestriccionPago) { + if (configRestriccionPago == null) { + throw new IllegalArgumentException("Debe de informar la configuracion de restricción"); + } + if ((configRestriccionPago.getFormaPago() == null) || (configRestriccionPago.getRestriccion() == null)) { + throw new IllegalArgumentException("Debe de informar los atributos formaPago y Restriccion"); + } + Map mapConsulta = configRestriccionPagoDAO.buscar(configRestriccionPago.getFormaPago()); + + if (!mapConsulta.isEmpty()) { + + if (configRestriccionPago.getConfigrestriccionId() != null) { + Collection values = mapConsulta.values(); + Integer restriccionId = null; + for (ConfigRestriccionPago c : values) { + if ((c.equals(configRestriccionPago)) && (!c.getRestriccion().getRestriccionId().equals(configRestriccionPago.getRestriccion().getRestriccionId()))) { + restriccionId = c.getRestriccion().getRestriccionId().intValue(); + } + } + if (restriccionId != null) { + mapConsulta.remove(restriccionId); + } + } + + if ((configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_CANCELABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_NO_CANCELABLE) != null)) + || (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_NO_CANCELABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_CANCELABLE) != null))) { + + return false; + } + + if ((configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_TRANSFERIBLE.shortValue()) + && (mapConsulta.get(RESTRICCION_NO_TRANSFERIBLE) != null)) + || (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_NO_TRANSFERIBLE.shortValue()) + && (mapConsulta.get(RESTRICCION_TRANSFERIBLE) != null))) { + return false; + } + + if ((configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_RESERVABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_NO_RESERVABLE) != null)) + || (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_NO_RESERVABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_RESERVABLE) != null))) { + return false; + } + + + + if (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_RESERVABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_RESERVABLE) != null)) { + return false; + } + if (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_TRANSFERIBLE.shortValue()) + && (mapConsulta.get(RESTRICCION_TRANSFERIBLE) != null)) { + return false; + } + if (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_CANCELABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_CANCELABLE) != null)) { + return false; + } + + } + + return true; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java new file mode 100644 index 000000000..f25215f23 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("constanteService") +public class ConstanteServiceImpl implements ConstanteService { + + @Autowired + private ConstanteDAO constanteDAO; + + public List obtenerTodos() { + return constanteDAO.obtenerTodos(); + } + + public Constante obtenerID(Integer id) { + return constanteDAO.obtenerID(id); + } + + @Transactional + public Constante suscribir(Constante entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return constanteDAO.suscribir(entidad); + } + + @Transactional + public Constante actualizacion(Constante entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return constanteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Constante entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + constanteDAO.actualizacion(entidad); + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public Constante buscarPorNomeConstante(String nomeConstante) { + return constanteDAO.buscarPorNomeConstante(nomeConstante); + } + + public List buscar(String nombconstante) { + return constanteDAO.buscar(nombconstante); + } + + @Override + public String buscarNombreAmbiente(){ + Constante constante = constanteDAO.buscarPorNomeConstante("NOMBRE_AMBIENTE"); + if (constante == null){ + return ""; + } + + return constante.getValorconstante(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConvenioDetServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConvenioDetServiceImpl.java new file mode 100644 index 000000000..14ad2d573 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConvenioDetServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConvenioDetDAO; +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; +import com.rjconsultores.ventaboletos.service.ConvenioDetService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("convenioDetService") +public class ConvenioDetServiceImpl implements ConvenioDetService { + + @Autowired + private ConvenioDetDAO convenioDetDAO; + + public List obtenerTodos() { + return convenioDetDAO.obtenerTodos(); + } + + public ConvenioDet obtenerID(Integer id) { + return convenioDetDAO.obtenerID(id); + } + + @Transactional + public ConvenioDet suscribir(ConvenioDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDetDAO.suscribir(entidad); + } + + @Transactional + public ConvenioDet actualizacion(ConvenioDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDetDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConvenioDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + convenioDetDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConvenioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConvenioServiceImpl.java new file mode 100644 index 000000000..c612dd1b8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ConvenioServiceImpl.java @@ -0,0 +1,95 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.Convenio; +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; +import com.rjconsultores.ventaboletos.entidad.ConvenioPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.ConvenioTramo; +import com.rjconsultores.ventaboletos.entidad.ConvenioUsuario; +import com.rjconsultores.ventaboletos.service.ConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("convenioService") +public class ConvenioServiceImpl implements ConvenioService { + + @Autowired + private ConvenioDAO convenioDAO; + + public List obtenerTodos() { + return convenioDAO.obtenerTodos(); + } + + public Convenio obtenerID(Integer id) { + return convenioDAO.obtenerID(id); + } + + @Transactional + public Convenio suscribir(Convenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDAO.suscribir(entidad); + } + + @Transactional + public Convenio actualizacion(Convenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Convenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + for (ConvenioDet cd : entidad.getConvenioDetList()) { + cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cd.setFecmodif(Calendar.getInstance().getTime()); + cd.setActivo(Boolean.FALSE); + } + + for (ConvenioPuntoVenta cpv: entidad.getConvenioPuntoVentaList()) { + cpv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cpv.setFecmodif(Calendar.getInstance().getTime()); + cpv.setActivo(Boolean.FALSE); + } + + for (ConvenioUsuario cu : entidad.getConvenioUsuarioList()) { + cu.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cu.setFecmodif(Calendar.getInstance().getTime()); + cu.setActivo(Boolean.FALSE); + } + + for (ConvenioTramo ct : entidad.getConvenioTramoList()) { + ct.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ct.setFecmodif(Calendar.getInstance().getTime()); + ct.setActivo(Boolean.FALSE); + } + + convenioDAO.actualizacion(entidad); + } + + public List buscar(String descconvenio, String cveconvenio) { + return convenioDAO.buscar(descconvenio, cveconvenio); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaCtrlServiceImpl.java new file mode 100644 index 000000000..65ef4a1de --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaCtrlServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CorridaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.CorridaCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("corridaCtrlService") +public class CorridaCtrlServiceImpl implements CorridaCtrlService { + + @Autowired + private CorridaCtrlDAO corridaCtrlDAO; + + public CorridaCtrl obtenerID(Integer id) { + return corridaCtrlDAO.obtenerID(id); + } + + @Transactional + public CorridaCtrl suscribir(CorridaCtrl entidad) { + Integer usuarioId = null; + if (UsuarioLogado.getUsuarioLogado() != null) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + entidad.setUsuarioId(usuarioId); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return corridaCtrlDAO.suscribir(entidad); + } + + @Transactional + public CorridaCtrl actualizacion(CorridaCtrl entidad) { + Integer usuarioId = 1; + if (UsuarioLogado.getUsuarioLogado() != null) { + usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + } + entidad.setUsuarioId(usuarioId); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return corridaCtrlDAO.actualizacion(entidad); + } + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, Date horario, boolean pisoExtra) { + return corridaCtrlDAO.buscar(ruta, claseServicio, marca, horario, pisoExtra); + } + + @Override + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca) { + return corridaCtrlDAO.buscar(corridaId, origem, destino, claseServicio, marca); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java new file mode 100644 index 000000000..4be28daf1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java @@ -0,0 +1,1362 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; + +import javax.persistence.Transient; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.DefaultTransactionDefinition; + +import com.rjconsultores.ventaboletos.dao.CorridaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.TramoTiempoDAO; +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Corrida.Id; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AsientoExclusivoService; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.CorridaCtrlService; +import com.rjconsultores.ventaboletos.service.CorridaService; +import com.rjconsultores.ventaboletos.service.DetDiagramaAutobusService; +import com.rjconsultores.ventaboletos.service.EsquemaAsientoService; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; +import com.rjconsultores.ventaboletos.service.EsquemaTramoService; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TramoServicioService; +import com.rjconsultores.ventaboletos.utilerias.ActivoUtil; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.FeriadoCache; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; + +/** + * + * @author rodrigo + */ +@Service("corridaService") +public class CorridaServiceImpl implements CorridaService { + + private static Logger log = Logger.getLogger(CorridaServiceImpl.class); + private static int CANT_MAX_CORRIDA_GERA_MANUAL = 40; + private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + + @Autowired + private CorridaDAO corridaDAO; + @Autowired + private EsquemaAsientoService esquemaAsientoService; + @Autowired + private CorridaCtrlService corridaCtrlService; + @Autowired + private RutaService rutaService; + @Autowired + private TramoServicioService tramoServicioService; + @Autowired + private TramoTiempoDAO tramoTiempoDAO; + @Autowired + private AsientoExclusivoService asientoExclusivoService; + @Autowired + private EsquemaTramoService esquemaTramoService; + @Autowired + private EsquemaCorridaService esquemaCorridaService; + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private DetDiagramaAutobusService detDiagramaAutobusService; + @Autowired + private ConstanteService constanteService; + @Autowired + private RutaSecuenciaService rutaSecuenciaService; + private PlatformTransactionManager transactionManager; + @Transient + private int cantCorridaGenerada; + @Transient + private int cantCorridaCommit; + @Autowired + private FeriadoCache feriadoCache; + + @Autowired + public CorridaServiceImpl(@Qualifier("transactionManager") PlatformTransactionManager transactionManager) { + this.transactionManager = transactionManager; + } + + @Override + public List obtenerTodos() { + return corridaDAO.obtenerTodos(); + } + + @Override + public Corrida obtenerID(Corrida.Id id) { + return corridaDAO.obtenerID(id); + } + + @Override + public List buscarPorFecCorrida(Date value) { + return corridaDAO.buscarPorFecCorrida(value); + } + + @Override + public List buscarPorId(Integer idCorrida) { + return corridaDAO.buscarPorId(idCorrida); + } + + @Override + public List verificarCorridaId(Integer corridaId) { + return corridaDAO.verificarCorridaId(corridaId); + } + + @Override + public List buscarDistinct(Parada ori, Parada des, Date horaSalidaInicio, Date horaSalidaFin, ClaseServicio cs, Integer corridaId) { + return corridaDAO.buscarDistinct(ori, des, (horaSalidaInicio == null) ? null : DateUtil.getFecInicio(horaSalidaInicio).getTime(), (horaSalidaFin == null) ? null : DateUtil.getFecInicio(horaSalidaFin).getTime(), cs, corridaId); + } + + @Transactional + public Corrida suscribir(Corrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ActivoUtil.ATIVO); + + return corridaDAO.suscribir(entidad); + } + + @Transactional + public Corrida actualizacion(Corrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ActivoUtil.ATIVO); + + return corridaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Corrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ActivoUtil.ATIVO); + + corridaDAO.actualizacion(entidad); + } + + @Override + public List buscarPorAutobusCorridasFuturas(DiagramaAutobus diagramaAutobus) { + return corridaDAO.buscarPorAutobusCorridasFuturas(diagramaAutobus); + } + + @Override + public List buscarPorRolOperativoCorridasFuturas(DiagramaAutobus diagramaAutobus) { + return corridaDAO.buscarPorRolOperativoCorridasFuturas(diagramaAutobus); + } + + @Override + public List buscarFiltro(Parada ori, Parada des, Date hora, ClaseServicio cs) { + return corridaDAO.buscarFiltro(ori, des, hora, cs); + } + + private Boolean geraDiaSemana(Integer diaSemana, EsquemaCorrida esquemaCorrida) { + Boolean retorno = Boolean.FALSE; + switch (diaSemana) { + case 1: { + // diaSemana = "Domingo"; + if (esquemaCorrida.getInddomingo() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getInddomingo()) { + retorno = Boolean.TRUE; + } + break; + } + case 2: { + // diaSemana = "Segunda"; + if (esquemaCorrida.getIndlunes() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndlunes()) { + retorno = Boolean.TRUE; + } + break; + } + case 3: { + // diaSemana = "Terca"; + if (esquemaCorrida.getIndmartes() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndmartes()) { + retorno = Boolean.TRUE; + } + break; + } + case 4: { + // diaSemana = "Quarta"; + if (esquemaCorrida.getIndmiercoles() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndmiercoles()) { + retorno = Boolean.TRUE; + } + break; + } + case 5: { + // diaSemana = "Quinta"; + if (esquemaCorrida.getIndjueves() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndjueves()) { + + retorno = Boolean.TRUE; + } + break; + } + case 6: { + // diaSemana = "Sexta"; + if (esquemaCorrida.getIndviernes() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndviernes()) { + retorno = Boolean.TRUE; + } + break; + } + case 7: { + // diaSemana = "Sabado"; + if (esquemaCorrida.getIndsabado() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndsabado()) { + retorno = Boolean.TRUE; + } + break; + } + } + + return retorno; + } + + private boolean temCorridaDiaSemana(Integer diaSemana, EsquemaCorrida esquemaCorrida, Boolean isFeriado) { + Boolean retorno = Boolean.FALSE; + + if (esquemaCorrida.getIndGeneraFeriado() != null) { + if (esquemaCorrida.getIndGeneraFeriado().equals("S")) { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } else if (isFeriado) { + if (esquemaCorrida.getIndGeneraFeriado().equals("F")) { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } + } else if (esquemaCorrida.getIndGeneraFeriado().equals("N")) { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } + } else { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } + + return retorno; + } + + private Date calcularFechorllegada(EsquemaTramo esquemaTramo, ClaseServicio clase, Date dataGeracao, Date horaChegada) { + GregorianCalendar gHoraChegada = new GregorianCalendar(); + gHoraChegada.setTime(horaChegada); + HoraSistema hs = null; + + if (esquemaTramo.getExcepcionRecorrido() != null) { + hs = new HoraSistema(esquemaTramo.getExcepcionRecorrido()); + + gHoraChegada.add(Calendar.HOUR_OF_DAY, hs.getHora()); + gHoraChegada.add(Calendar.MINUTE, hs.getMinuto()); + } else { + Tramo tramo = esquemaTramo.getTramo(); + List lsTramoServicio = tramoServicioService.buscarPorTramoServico(tramo, clase); + + for (TramoServicio ts : lsTramoServicio) { + hs = new HoraSistema(ts.getTiemporecorrido()); + + gHoraChegada.add(Calendar.HOUR_OF_DAY, hs.getHora()); + gHoraChegada.add(Calendar.MINUTE, hs.getMinuto()); + } + } + + return gHoraChegada.getTime(); + } + + private Date calcularFechorsalida(EsquemaTramo esquemaTramo, Date dataGeracao, Date horaChegadaAnterior, java.util.Date tiempoEstanciaAnterior) { + Date horaSaida; + + if (horaChegadaAnterior == null) { + horaSaida = truncarDataHora(dataGeracao, esquemaTramo.getEsquemaCorrida().getHorasalida()); + } else { + GregorianCalendar gHoraSaidaProximo = new GregorianCalendar(); + gHoraSaidaProximo.setTime(horaChegadaAnterior); + + log.debug("Tempo Recorrido : " + sdf.format(gHoraSaidaProximo.getTime())); + + if (tiempoEstanciaAnterior != null) { + gHoraSaidaProximo.add(Calendar.MINUTE, tiempoEstanciaAnterior.getMinutes()); + gHoraSaidaProximo.add(Calendar.HOUR_OF_DAY, tiempoEstanciaAnterior.getHours()); + + log.debug("Tempo Recorrido + Estancia: " + sdf.format(gHoraSaidaProximo.getTime())); + } + + horaSaida = gHoraSaidaProximo.getTime(); + } + + GregorianCalendar gHoraSaida = new GregorianCalendar(); + gHoraSaida.setTime(horaSaida); + + return gHoraSaida.getTime(); + } + + /** + * Adiciciona as horas do parametro hora na data dataGeracao. + * + * Alem disso eh zerado os campos segundos e milisegundos. + * + * @param dataGeracao + * @param hora + * @return + */ + private Date truncarDataHora(Date dataGeracao, Date hora) { + Date dataCorreta = new Date(); + + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(hora); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(dataGeracao); + gcalendar.set(Calendar.HOUR_OF_DAY, gAux.get(Calendar.HOUR_OF_DAY)); + gcalendar.set(Calendar.MINUTE, gAux.get(Calendar.MINUTE)); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + + dataCorreta = gcalendar.getTime(); + + return dataCorreta; + } + + private boolean isFeriado(java.sql.Date data, EsquemaCorrida esquemaCorrida) { + Empresa empresa = esquemaCorrida.getEmpresa(); + + Estado estadoOrigem = null; + List lsRutaSequencia = rutaSecuenciaService.buscarSecuenciaOrdenado(esquemaCorrida.getRuta()); + if (!lsRutaSequencia.isEmpty()) { + Tramo tramoOrigem = lsRutaSequencia.get(0).getTramo(); + Parada origem = tramoOrigem.getOrigem(); + estadoOrigem = origem.getCiudad().getEstado(); + } + + return feriadoCache.ehFeriado(data, empresa, estadoOrigem); + } + + /** + * Indica si el esquemaCorrida informado tiene una vigencia válida para la data de generacion + * + * @param esquemaCorrida + * @param dataGeracao + * @return + */ + private boolean vigenciaValida(EsquemaCorrida esquemaCorrida, Date dataGeracao) { + if ((DateUtil.compareOnlyDate(dataGeracao, esquemaCorrida.getEsquemaOperacional().getFecfinvigencia()) <= 0) && + (DateUtil.compareOnlyDate(dataGeracao, esquemaCorrida.getEsquemaOperacional().getFecniciovigencia()) >= 0)) { + + return true; + } + return false; + } + + /** + * Genera una corrida para el esquemaCorrida informado en la fecha informada.
+ * + * Cuando la corrida no es generada :
+ * - corrida ya existe : eso es checado por el numCorrida e dataGeneracion
+ * - la fecha de generacion no tiene una vigencia válida
+ * - el status del esquema corrida no es autorizado ("A")
+ * + * + * @param esquemaCorrida + * @param diaSemana + * @param dataGeracao + * @return - La corrida generada o null si no fue generada. + */ + private Corrida generarCorrida(EsquemaCorrida esquemaCorrida, Date dataGeracao, boolean isPisoExtra, Boolean isFeriado) { + + GregorianCalendar calendario = new GregorianCalendar(); + calendario.setTime(dataGeracao); + + Integer diaSemana = calendario.get(Calendar.DAY_OF_WEEK); + Corrida corrida = null; + + if (!vigenciaValida(esquemaCorrida, dataGeracao)) { + log.info("vigencia invalida=" + dataGeracao); + + return null; + } + + if (!((esquemaCorrida.getStatusCorrida() != null) && (esquemaCorrida.getStatusCorrida().equals("A") || esquemaCorrida.getStatusCorrida().equals("L")))) { + log.info("status corrida invalido=" + esquemaCorrida.getStatusCorrida()); + + return null; + } + + if (esquemaCorrida.getIndDiaSimDiaNao() == null || esquemaCorrida.getIndDiaSimDiaNao() == Boolean.FALSE) { + if (!temCorridaDiaSemana(diaSemana, esquemaCorrida, isFeriado)) { + log.info("dia semana no valido=" + diaSemana); + return null; + } + } + + if (!tramoServicioService.existenTiemposTramosEsquema(esquemaCorrida.getEsquemacorridaId())) { + log.info("nao foi cadastrado o tempo de todos os trechos do esquema corrida=" + esquemaCorrida.getEsquemacorridaId()); + return null; + } + + try { + + Ruta ruta = esquemaCorrida.getRuta(); + ClaseServicio claseServicio = esquemaCorrida.getClaseServicio(); + Marca marca = esquemaCorrida.getMarca(); + Date horario = esquemaCorrida.getHorasalida(); + horario = DateUtil.normalizar(horario); + Integer numCorrida = (!isPisoExtra) ? esquemaCorrida.getNumCorrida() : esquemaCorrida.getNumCorridaPisoExtra(); + + Corrida.Id id = new Corrida.Id(); + + id.setCorridaId(numCorrida); + id.setFeccorrida(DateUtil.normalizarToFecha(dataGeracao)); + + if (esquemaCorrida.getIndDiaSimDiaNao() != null && esquemaCorrida.getIndDiaSimDiaNao()) { + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataGeracao); + calendarData.add(Calendar.DATE, -1); + + Corrida.Id corridaOntem = new Corrida.Id(); + + corridaOntem.setCorridaId(numCorrida); + corridaOntem.setFeccorrida(DateUtil.normalizarToFecha(calendarData.getTime())); + + if (corridaDAO.existe(corridaOntem)) { + log.info("Esquema configurado para gerar dia sim dia não e já possui corrida gerado no dia anterior, por isso não está data: " + DateUtil.getStringDate(dataGeracao)); + return null; + } + } + + if (corridaDAO.existe(id)) { + log.info("corrida existe = " + numCorrida + ";" + ruta.getDescruta() + ";" + DateUtil.getStringDate(dataGeracao) + ";" + DateUtil.getStringDate(horario, "HH:mm") + ";" + claseServicio.getDescclase() + ";" + marca.getDescmarca() + " Piso: " + isPisoExtra); + return null; + } + + // Como o numCorrida corresponde ao corrida_id do corridaCtrl, ou seja, à chave primaria, temos que buscar somente por esse campo + // Caso o registro já exista, atualizamos os dados dele. + // Sendo assim, o que vai indicar a "duplicidade" de uma corrida será apenas o número dela e não mais o conjunto : clase + marca + horario + ruta + + CorridaCtrl corridaCtrl = corridaCtrlService.obtenerID(numCorrida); + + boolean novoRegistro = false; + + if (corridaCtrl == null) { + corridaCtrl = new CorridaCtrl(); + novoRegistro = true; + } + + corridaCtrl.setCorridaId(numCorrida); + corridaCtrl.setMarca(marca); + corridaCtrl.setRuta(ruta); + corridaCtrl.setClaseServicio(claseServicio); + corridaCtrl.setHorario(horario); + + // parada origem + Parada origen = rutaService.getOrigem(ruta); + if (origen == null) { + log.info("origen nao encontrado para a ruta = " + ruta.getRutaId()); + } + corridaCtrl.setNodo((origen == null) ? null : origen.getNodo()); + + corridaCtrl.setActivo(Boolean.TRUE); + corridaCtrl.setFecmodif(Calendar.getInstance().getTime()); + + if (UsuarioLogado.getUsuarioLogado() != null) { + corridaCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + corridaCtrl.setPisoExtra(isPisoExtra); + if (novoRegistro) { + corridaCtrl = corridaCtrlService.suscribir(corridaCtrl); + } else { + corridaCtrl = corridaCtrlService.actualizacion(corridaCtrl); + } + + corrida = new Corrida(); + corrida.setId(id); + corrida.setEsquemaCorrida(esquemaCorrida); + corrida.setCorridaCtrl(corridaCtrl); + corrida.setAutobus(null); + corrida.setClaseServicio(esquemaCorrida.getClaseServicio()); + corrida.setConductor(null); + if (esquemaCorrida.getIndCorridaExtra()) { + corrida.setTipoServicio(new Short("2")); + } else { + corrida.setTipoServicio(new Short("1")); + } + corrida.setInfoCorrida(esquemaCorrida.getInfoCorrida()); + Integer cantparados = esquemaCorrida.getCantparados(); + if (cantparados != null) { + corrida.setCantParados(cantparados.shortValue()); + } + + corrida.setEsquemaAgrupacionId(esquemaCorrida.getEsquemaAgrupacionId()); + + corrida.setEmpresa(esquemaCorrida.getEmpresa()); + corrida.setEmpresa1(esquemaCorrida.getEmpresa1()); + + corrida.setFechorsalida(truncarDataHora(dataGeracao, esquemaCorrida.getHorasalida())); + corrida.setFechorSalidaOriginal(corrida.getFechorsalida()); + + if (esquemaCorrida.getStatusCorrida().equals("A")) { + corrida.setIndstatuscorrida("H"); + corrida.setActivo(ActivoUtil.ATIVO); + } else if (esquemaCorrida.getStatusCorrida().equals("L")) { + corrida.setIndstatuscorrida("P"); + corrida.setActivo(ActivoUtil.INATIVO); + } + + corrida.setMarca(esquemaCorrida.getMarca()); + corrida.setNodo(corridaCtrl.getNodo()); + corrida.setDivision(esquemaCorrida.getDivision()); + + corrida.setRuta(esquemaCorrida.getRuta()); + corrida.setRolOperativo(esquemaCorrida.getRolOperativo()); + corrida.setZona(null); + + boolean hayCorrida = corridaDAO.count(corrida.getOrigem(), corrida.getDestino(), corrida.getId().getFeccorrida(), corrida.getClaseServicio(), isPisoExtra); + + if (hayCorrida) { + return null; + } + + // corrida Tramo: + List lsCorridaTramo = new ArrayList(); + Integer numSec = 1; + List lsEsquemaTramo = esquemaTramoService.obtenerPorEsquemaCorridaOrderNumSec(esquemaCorrida); + Date horaChegadaAnterior = null; + + Date husoHorVeranoLlegadaAnterior = null; + + if (lsEsquemaTramo == null) { + return null; + } + + EsquemaTramo primeiro = lsEsquemaTramo.get(0); + Parada origem = primeiro.getTramo().getOrigem(); + if (origem == null) { + return null; + } + corrida.setOrigem(origem); + + EsquemaTramo ultimo = lsEsquemaTramo.get(lsEsquemaTramo.size() - 1); + Parada destino = ultimo.getTramo().getDestino(); + if (destino == null) { + return null; + } + corrida.setDestino(destino); + + for (EsquemaTramo esquemaTramo : lsEsquemaTramo) { + + CorridaTramo corridaTramo = new CorridaTramo(); + if (esquemaTramo.getNumsecuencia() == 22) { + System.out.println(""); + } + corridaTramo.setAutobus(null); + corridaTramo.setConductor(null); + corridaTramo.setConductor1(null); + corridaTramo.setPlataforma(esquemaTramo.getPlataforma()); + + corridaTramo.setTiempoEstancia(esquemaTramo.getTiempoEstancia()); + + // numSec: 1-2, 2-3, 3-4... + corridaTramo.setNumsecorigen(numSec.shortValue()); + numSec = numSec + 1; + corridaTramo.setNumsecdestino(numSec.shortValue()); + + Calendar salida = Calendar.getInstance(); + Date fecHorSalida = calcularFechorsalida(esquemaTramo, dataGeracao, horaChegadaAnterior, esquemaTramo.getTiempoEstancia()); + salida.setTime(fecHorSalida); + salida.set(salida.get(Calendar.YEAR), salida.get(Calendar.MONTH), salida.get(Calendar.DATE), + salida.get(Calendar.HOUR_OF_DAY), salida.get(Calendar.MINUTE), NumberUtils.INTEGER_ZERO); + corridaTramo.setFechorsalida(salida.getTime()); + + Calendar llegada = Calendar.getInstance(); + Date fecHorallegada = calcularFechorllegada(esquemaTramo, corrida.getClaseServicio(), dataGeracao, fecHorSalida); + llegada.setTime(fecHorallegada); + llegada.set(llegada.get(Calendar.YEAR), llegada.get(Calendar.MONTH), llegada.get(Calendar.DATE), + llegada.get(Calendar.HOUR_OF_DAY), llegada.get(Calendar.MINUTE), NumberUtils.INTEGER_ZERO); + corridaTramo.setFechorllegada(llegada.getTime()); + + horaChegadaAnterior = fecHorallegada; + + corridaTramo.setFechortarjetaviaje(null); + corridaTramo.setNodo(corridaCtrl.getNodo()); + + corridaTramo.setNumsecuencia(esquemaTramo.getNumsecuencia()); + Tramo tramo = esquemaTramo.getTramo(); + if (tramo != null) { + corridaTramo.setOrigem(tramo.getOrigem()); + corridaTramo.setDestino(tramo.getDestino()); + } + corridaTramo.setTramo(tramo); + corridaTramo.setUsuariotarjetaviajeId(null); + + Date excepcionTiempo = arreglaExcepcionTiempo(corridaTramo, corrida.getClaseServicio()); + if (excepcionTiempo != null) { + corridaTramo.setFechorllegada(excepcionTiempo); + horaChegadaAnterior = excepcionTiempo; + } + + if (esquemaCorrida.getStatusCorrida().equals("A")) { + corridaTramo.setActivo(ActivoUtil.ATIVO); + } else if (esquemaCorrida.getStatusCorrida().equals("L")) { + corridaTramo.setActivo(ActivoUtil.INATIVO); + } + // + corridaTramo.setFecmodif(Calendar.getInstance().getTime()); + if (UsuarioLogado.getUsuarioLogado() != null) { + corridaTramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + corridaTramo.setCorrida(corrida); + corridaTramo.setFechorSalidaOriginal(fecHorSalida); + + if (husoHorVeranoLlegadaAnterior == null) { + corridaTramo.setFechorsalidaH(corridaTramo.getFechorsalida()); + } else { + + // Ajusta tambem o tempo de instancia do calculo do horario de verao + if (esquemaTramo.getTiempoEstancia() != null) { + GregorianCalendar tmp = new GregorianCalendar(); + tmp.setTime(husoHorVeranoLlegadaAnterior); + + tmp.add(Calendar.MINUTE, esquemaTramo.getTiempoEstancia().getMinutes()); + tmp.add(Calendar.HOUR_OF_DAY, esquemaTramo.getTiempoEstancia().getHours()); + + log.debug("Tempo Recorrido H + Estancia: " + sdf.format(tmp.getTime())); + + husoHorVeranoLlegadaAnterior = tmp.getTime(); + + } + + corridaTramo.setFechorsalidaH(husoHorVeranoLlegadaAnterior); + } + + husoHorVeranoLlegadaAnterior = calcularHusoHorVeranoLlegada(esquemaTramo, corridaTramo); + + if (husoHorVeranoLlegadaAnterior != null) { + corridaTramo.setFechorllegadaH(husoHorVeranoLlegadaAnterior); + corridaTramo.setFechorSalidaOriginalH(husoHorVeranoLlegadaAnterior); + } else { + corridaTramo.setFechorllegadaH(corridaTramo.getFechorllegada()); + corridaTramo.setFechorSalidaOriginalH(corridaTramo.getFechorSalidaOriginal()); + } + + if (numSec == 1) { + corrida.setFechorSalidaOriginalH(corridaTramo.getFechorsalidaH()); + } + lsCorridaTramo.add(corridaTramo); + } + corrida.setCorridaTramoList(lsCorridaTramo); + // + corrida.setFecmodif(Calendar.getInstance().getTime()); + if (UsuarioLogado.getUsuarioLogado() != null) { + corrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } else { + corrida.setUsuarioId(1); + } + corrida.setIndTipoVenta(null); + corrida.setCodProdutoFiscal(UtiliteriasFiscal.defineCodigoProduto(corrida.getOrigem().getParadaId(), corrida.getDestino().getParadaId(), corrida.getRuta().getRutaId())); + corrida = corridaDAO.suscribir(corrida); + + cantCorridaGenerada++; + + List lsEsquemaAsiento = esquemaAsientoService.obtenerPorCorrida(esquemaCorrida); + for (EsquemaAsiento ea : lsEsquemaAsiento) { + DetDiagramaAutobus detDiagramaAutobus = detDiagramaAutobusService.obtenerPorDiagramaAutobusAsiento(esquemaCorrida.getDiagramaAutobusId(), ea.getNumasiento()); + if (detDiagramaAutobus.getVendible()) { + AsientoExclusivo asientoExclusivo = new AsientoExclusivo(); + asientoExclusivo.setCorrida(corrida); + asientoExclusivo.setMotivobloqueo(null); + asientoExclusivo.setNodo(corrida.getNodo()); + asientoExclusivo.setNumasiento(ea.getNumasiento()); + asientoExclusivo.setVendible(ea.getIndvendible()); + asientoExclusivo.setParada(ea.getParada()); + asientoExclusivo.setTiempoLiberacion(ea.getTiempoLiberacion()); + if (ea.getIndvendible()) { + asientoExclusivo.setMotivobloqueo(null); + } else { + asientoExclusivo.setMotivobloqueo(ea.getMotivobloqueo()); + asientoExclusivo.setDestino(ea.getDestino()); + } + + asientoExclusivo.setActivo(Boolean.TRUE); + asientoExclusivo.setFecmodif(Calendar.getInstance().getTime()); + if (UsuarioLogado.getUsuarioLogado() != null) { + asientoExclusivo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + asientoExclusivo = asientoExclusivoService.suscribir(asientoExclusivo); + } + } + + } catch (org.springframework.dao.DataIntegrityViolationException ex) { + log.error("", ex); + } + + return corrida; + } + + private Date calcularHusoHorVeranoLlegada(EsquemaTramo esquemaTramo, CorridaTramo corridaTramo) { + + Estado estadoOrigen = esquemaTramo.getTramo().getOrigem().getCiudad().getEstado(); + int tiempoOrigen = estadoOrigen.getTiempoHorHuso() == null ? 0 : estadoOrigen.getTiempoHorHuso(); + + Date fecInicioHorVerano = estadoOrigen.getFecInicioHorVerano(); + Date fecFinHorVerano = estadoOrigen.getFecFinoHorVerano(); + + if ((fecInicioHorVerano != null) && (fecFinHorVerano != null)) { + if ((DateUtil.compareOnlyDate(fecInicioHorVerano, corridaTramo.getFechorsalida()) <= 0) && (DateUtil.compareOnlyDate(fecFinHorVerano, corridaTramo.getFechorsalida()) >= 0)) { + tiempoOrigen += estadoOrigen.getTiempoHorVerano(); + } + } + // 21688 + Estado estadoDestino = esquemaTramo.getTramo().getDestino().getCiudad().getEstado(); + int tiempoDestino = 0; + + if (!estadoDestino.equals(estadoOrigen)) { + tiempoDestino = estadoDestino.getTiempoHorHuso() == null ? 0 : estadoDestino.getTiempoHorHuso(); + + Date fecInicioHorVeranoDestino = estadoDestino.getFecInicioHorVerano(); + Date fecFinHorVeranDestino = estadoDestino.getFecFinoHorVerano(); + + if ((fecInicioHorVeranoDestino != null) && (fecFinHorVeranDestino != null)) { + if ((DateUtil.compareOnlyDate(fecInicioHorVeranoDestino, corridaTramo.getFechorllegada()) <= 0) && (DateUtil.compareOnlyDate(fecFinHorVeranDestino, corridaTramo.getFechorllegada()) >= 0)) { + tiempoDestino += estadoDestino.getTiempoHorVerano(); + } + } + } else { + tiempoDestino = tiempoOrigen; + } + + Calendar horLlegada = null; + // Si los tiempos son distintos, hube cambio de huso horario/horario de verano + + long elapsedMinutes = DateUtil.getElapsedMinutos(corridaTramo.getFechorsalida(), corridaTramo.getFechorllegada()); + + horLlegada = Calendar.getInstance(); + horLlegada.setTime(corridaTramo.getFechorsalidaH()); + + horLlegada.add(Calendar.MINUTE, (int) elapsedMinutes); + if (tiempoOrigen != tiempoDestino) { + horLlegada.add(Calendar.HOUR, difHuso(tiempoOrigen, tiempoDestino)); + + } + + return (horLlegada == null) ? null : horLlegada.getTime(); + } + + private int difHuso(int a, int b) { + return b - a; + } + + private void generarCorrida(Date dataGeracao, List lsEsquemaCorrida) { + + DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW); + + // TODO: Melhorar o tratamento às transações manuais em caso de erro,etc + TransactionStatus status = transactionManager.getTransaction(def); + cantCorridaGenerada = 0; + cantCorridaCommit = 1; + java.sql.Date data = new java.sql.Date(dataGeracao.getTime()); + + try { + + for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) { + Boolean isFeriado = this.isFeriado(data, esquemaCorrida); + + log.info("esquema=" + esquemaCorrida.getEsquemacorridaId() + " numCorrida=" + esquemaCorrida.getNumCorrida()); + + if (!esquemaCorridaDAO.esHijoRebote(esquemaCorrida)) { + Corrida corrida = generarCorrida(esquemaCorrida, dataGeracao, false, isFeriado); + Corrida corridaPisoExtra = null; + + if (corrida == null) {// Si no genera la corrida, no va a + // generar el rebote + log.info("No fue generado corrida. Esquema " + esquemaCorrida.getEsquemacorridaId() + " Data" + dataGeracao); + continue; + } + + // PISO EXTRA + if (esquemaCorrida.getPisoExtra() != null && esquemaCorrida.getPisoExtra()) { + // Invertendo RolOperativo e Classe de Servico para o Piso + // Extra + RolOperativo ro = esquemaCorrida.getRolOperativo(); + ClaseServicio cs = esquemaCorrida.getClaseServicio(); + + esquemaCorrida.setRolOperativo(esquemaCorrida.getRolOperativo2()); + esquemaCorrida.setClaseServicio(esquemaCorrida.getClaseServicio2()); + + corridaPisoExtra = generarCorrida(esquemaCorrida, dataGeracao, true, isFeriado); + if (corrida != null && corridaPisoExtra != null) { + // Voltando RolOperativo e Classe de Servico + esquemaCorrida.setRolOperativo(ro); + esquemaCorrida.setClaseServicio(cs); + + // Salvando Referencia da Corrida no piso extra + corridaPisoExtra.setCorridaPiso(corrida); + corridaPisoExtra.setNumPiso(2); + corridaPisoExtra = corridaDAO.actualizacion(corridaPisoExtra); + + // Referencia do Piso extra na Corrida + corrida.setCorridaPiso(corridaPisoExtra); + corrida.setNumPiso(1); + corrida = corridaDAO.actualizacion(corrida); + } else { + // Voltando RolOperativo e Classe de Servico + // estava dando problema porque não estava voltando o roloperativo e nem a classe. + // daí, no caso de double piso, passava a gerar os próximos com classe errada. mantis 7075 + esquemaCorrida.setRolOperativo(ro); + esquemaCorrida.setClaseServicio(cs); + } + } + + if (esquemaCorrida.getEsquemaCorridaRebote() != null) { + log.info("Corrida Rebote=" + esquemaCorrida.getEsquemacorridaId()); + + Corrida corridaRebote = generarCorrida(esquemaCorrida.getEsquemaCorridaRebote(), dataGeracao, false, isFeriado); + Corrida corridaPisoExtraRebote = null; + boolean generaReboteDiaSeguinte = false; + + if (corridaRebote != null) { + EsquemaCorrida ecRebote = esquemaCorrida.getEsquemaCorridaRebote(); + if (ecRebote.getPisoExtra() != null && ecRebote.getPisoExtra()) { + // Invertendo RolOperativo e Classe de Servico + // para + // o Piso Extra + RolOperativo ro = ecRebote.getRolOperativo(); + ClaseServicio cs = ecRebote.getClaseServicio(); + + ecRebote.setRolOperativo(ecRebote.getRolOperativo2()); + ecRebote.setClaseServicio(ecRebote.getClaseServicio2()); + + corridaPisoExtraRebote = generarCorrida(ecRebote, dataGeracao, true, isFeriado); + if (corridaRebote != null && corridaPisoExtraRebote != null) { + // Salvando Referencia da Corrida no piso extra + corridaPisoExtraRebote.setCorridaPiso(corridaRebote); + corridaPisoExtraRebote.setNumPiso(2); + corridaPisoExtraRebote = corridaDAO.actualizacion(corridaPisoExtraRebote); + + // Voltando RolOperativo e Classe de Servico + ecRebote.setRolOperativo(ro); + ecRebote.setClaseServicio(cs); + + // Referencia do Piso extra na Corrida + corridaRebote.setCorridaPiso(corridaPisoExtraRebote); + corridaRebote.setNumPiso(1); + corridaRebote = corridaDAO.actualizacion(corridaRebote); + } + } + // RebotePisoExtra + if (DateUtil.compareDate(corrida.getFechorsalida(), corridaRebote.getFechorsalida()) > 0) { + generaReboteDiaSeguinte = true; // si fue generado + // con una + // fechamenor tienes + // que generar para + // el dia seguinte + } + } else { + generaReboteDiaSeguinte = true;// si no fue encontrado + // para el dia de + // hoy,genera para + // manhana + } + + if (generaReboteDiaSeguinte) { + log.info("Haciendo la busqueda por el esquema rebote para el dia seguiente pues ya existe al dia de hoy"); + + corridaRebote = generarReboteDiaSeguinte(esquemaCorrida, dataGeracao); + + if (corridaPisoExtraRebote != null) { + corridaPisoExtraRebote = generarReboteDiaSeguinte(esquemaCorrida, dataGeracao); + } + + if (corridaRebote == null) { + log.info("No fue posible generar la corrida rebote. No fue encontrado esquema para la fecha del dia seguinte a " + dataGeracao); + } + } + if (corridaRebote != null) { + log.info("Rebote generado=" + corridaRebote.getId()); + corrida.setCorridaRebote(corridaRebote); + corridaDAO.actualizacion(corrida); + } + if (corridaPisoExtraRebote != null && corridaPisoExtra != null) { + log.info("Rebote Piso Extra Generado=" + corridaPisoExtraRebote.getId()); + corridaPisoExtra.setCorridaRebote(corridaPisoExtraRebote); + corridaDAO.actualizacion(corridaPisoExtra); + } + } + } + + if (cantCorridaGenerada >= cantCorridaCommit) { + cantCorridaGenerada = 0; + transactionManager.commit(status); + status = transactionManager.getTransaction(def); + } + } // for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) + } finally { + if ((status != null) && (!status.isCompleted())) { + transactionManager.commit(status); + } + } + } + + /** + * Verifica se hay una excepcione de tiempo para el tramo informado. + * + * @param corridaTramo + * @param claseServicio + * @return - Si existe una excepcion, regresa la nueva fecLlegada para el tramo, sino, regreso null + */ + private Date arreglaExcepcionTiempo(CorridaTramo corridaTramo, ClaseServicio claseServicio) { + Date nuevaFecLlegada = null; + + Tramo tramo = corridaTramo.getTramo(); + + List lsExcepciones = tramoTiempoDAO.buscar(tramo, claseServicio, corridaTramo.getFechorsalida(), corridaTramo.getFechorllegada()); + + if (!lsExcepciones.isEmpty()) { + TramoTiempo tramoTiempo = lsExcepciones.get(0); + List diasSemana = getDiaDeLaSemana(tramoTiempo); + + Calendar fecCorrida = Calendar.getInstance(); + fecCorrida.setTime(corridaTramo.getFechorllegada()); + + if (diasSemana.contains(fecCorrida.get(Calendar.DAY_OF_WEEK))) { + log.info("Hay Excepcione de tiempo"); + + Calendar fechorsalida = Calendar.getInstance(); + fechorsalida.setTime(corridaTramo.getFechorsalida()); + + HoraSistema horaSistema = new HoraSistema(tramoTiempo.getTiemporecorrido()); + + fechorsalida.add(Calendar.HOUR, horaSistema.getHora()); + fechorsalida.add(Calendar.MINUTE, horaSistema.getMinuto()); + + nuevaFecLlegada = fechorsalida.getTime(); + } + } + + return nuevaFecLlegada; + } + + private Corrida generarReboteDiaSeguinte(EsquemaCorrida esquemaCorrida, Date dataGeracao) { + Calendar tmp = Calendar.getInstance(); + tmp.setTime(dataGeracao); + tmp.add(Calendar.DAY_OF_MONTH, 1); + java.sql.Date data = new java.sql.Date(dataGeracao.getTime()); + Boolean isFeriado = this.isFeriado(data, esquemaCorrida); + + return generarCorrida(esquemaCorrida.getEsquemaCorridaRebote(), tmp.getTime(), false, isFeriado); + } + + private List getDiaDeLaSemana(TramoTiempo tramoTiempo) { + List diasValidos = new ArrayList(); + + if (tramoTiempo.getIndapliclun()) { + diasValidos.add(Calendar.MONDAY); + } + if (tramoTiempo.getIndaplicmar()) { + diasValidos.add(Calendar.TUESDAY); + } + if (tramoTiempo.getIndaplicmie()) { + diasValidos.add(Calendar.WEDNESDAY); + } + if (tramoTiempo.getIndaplicjue()) { + diasValidos.add(Calendar.THURSDAY); + } + if (tramoTiempo.getIndaplicvie()) { + diasValidos.add(Calendar.FRIDAY); + } + if (tramoTiempo.getIndaplicsab()) { + diasValidos.add(Calendar.SATURDAY); + } + if (tramoTiempo.getIndaplicdom()) { + diasValidos.add(Calendar.SUNDAY); + } + + return diasValidos; + } + + @Override + public Date calcularDataFinalGeneracionCorrida() { + Date dataDe = new Date(); + + Constante constante = constanteService.buscarPorNomeConstante("CANT_DIAS_GENERACION_CORRIDA"); + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataDe); + calendarData.add(Calendar.DATE, Integer.parseInt(constante.getValorconstante())); + Date dataAte = calendarData.getTime(); + + return dataAte; + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public boolean generarCorridaAutomatica() { + feriadoCache.limpar(); + + Date dataDe = Calendar.getInstance().getTime(); + + Date dataAteConstante = calcularDataFinalGeneracionCorrida(); + Boolean hayErroConstante = !generarCorridaAutomaticaConstanteDias(dataDe, dataAteConstante); + + log.debug("corrida generadas por la constante. hayError=" + hayErroConstante); + + Boolean hayErroQtdeDias = !generarCorridaAutomaticaQtdeDias(dataDe); + + log.debug("corrida generadas por la cant de dias.hayError=" + hayErroQtdeDias); + + return hayErroConstante && hayErroQtdeDias; + } + + private boolean generarCorridaAutomaticaQtdeDias(Date dataDeOriginal) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + log.debug(" Generacion cant dias " + sdf.format(dataDeOriginal)); + + // TODO: Melhorar o tratamento às transações manuais em caso de erro,etc + DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW); + TransactionStatus status = transactionManager.getTransaction(def); + + List lsEsquemaCorrida = esquemaCorridaService.buscaDentroVigenciaQtdeDiasNotNull(dataDeOriginal); + for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) { + log.debug("esquemaCorrida=" + esquemaCorrida.getEsquemacorridaId()); + + Integer qtdeDiasGerar = esquemaCorrida.getCantDiasGeneracion(); + + if (qtdeDiasGerar <= 0) { + log.debug("cant dias <=0"); + + continue; + } + + log.debug("cantDiasGenerar=" + qtdeDiasGerar); + + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataDeOriginal); + calendarData.add(Calendar.DATE, qtdeDiasGerar - 1); + + Date dataAte = calendarData.getTime(); + Date dataDe = new Date(dataDeOriginal.getTime()); + + log.debug("Periodo generacion = " + sdf.format(dataDe) + " hasta " + sdf.format(dataAte)); + + if (DateUtil.compareOnlyDate(dataAte, esquemaCorrida.getEsquemaOperacional().getFecfinvigencia()) > 0) { + log.info("Cant dias excede final de la vigencia"); + dataAte = esquemaCorrida.getEsquemaOperacional().getFecfinvigencia(); + } + + try { + while (DateUtil.compareOnlyDate(dataDe, dataAte) <= 0) { + Boolean isFeriado = this.isFeriado(new java.sql.Date(dataDe.getTime()), esquemaCorrida); + generarCorrida(esquemaCorrida, dataDe, false, isFeriado); + calendarData.setTime(dataDe); + calendarData.add(Calendar.DATE, 1); + dataDe = calendarData.getTime(); + } + log.info("commit bloco corridas"); + transactionManager.commit(status); + status = transactionManager.getTransaction(def); + } catch (Throwable ex) { + log.error("", ex); + log.error(" Erro ao gerar corrida = " + esquemaCorrida.getNumCorrida() + " esquemaCorrida = " + esquemaCorrida.getEsquemacorridaId()); + transactionManager.rollback(status); + status = transactionManager.getTransaction(def); + } + } + + if (!status.isCompleted()) { + log.info("commit bloco final"); + transactionManager.commit(status); + } + + return Boolean.TRUE; + } + + private boolean generarCorridaAutomaticaConstanteDias(Date dataDe, Date dataAte) { + boolean generacionExitosa = true; + SimpleDateFormat sdfData = new SimpleDateFormat("dd/MM/yyyy"); + + log.debug("** AUTO - Data De: " + sdfData.format(dataDe) + " **Data Ateh: " + sdfData.format(dataAte)); + + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataAte); + calendarData.add(Calendar.DATE, 1); + dataAte = calendarData.getTime(); + try { + while (dataDe.before(dataAte)) { + log.debug("*** Data: " + sdfData.format(dataDe)); + + List lsEsquemaCorrida = esquemaCorridaService.buscaDentroVigenciaQtdeDiasNull(dataDe); + + Boolean dentroVigenciaEsquemaOperacional = !lsEsquemaCorrida.isEmpty(); + if (dentroVigenciaEsquemaOperacional) { + log.debug("Geracao de servicos sem cant dias especifico. Adotando o padrao"); + + this.generarCorrida(dataDe, lsEsquemaCorrida); + + } else { + log.info("No hay esquema vigente para la fecha " + sdfData.format(dataDe)); + } + + calendarData.setTime(dataDe); + calendarData.add(Calendar.DATE, 1); + dataDe = calendarData.getTime(); + } + } catch (Exception ex) { + log.error("Erro ao gerar corridas: " + ex, ex); + generacionExitosa = false; + } + + return generacionExitosa; + } + + private int cantDiasMaxGerarCorridasManual() { + + Constante constante = constanteService.buscarPorNomeConstante("CANT_MAX_CORRIDA_GERA_MANUAL"); + + if ((constante == null) || (StringUtils.isBlank(constante.getValorconstante()))) { + return CANT_MAX_CORRIDA_GERA_MANUAL; + } + + return Integer.valueOf(constante.getValorconstante()); + + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS, rollbackFor = BusinessException.class) + public Long generarCorridasSelecionadas(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException { + + int cantDiasGeneracion = DateUtil.getElapsedDias(dataDe, dataAte); + + int cantDiasMaxGerarCorridasManual = cantDiasMaxGerarCorridasManual(); + + log.info("cantDiasGeneracion=" + cantDiasGeneracion); + log.info("cantDiasMaxGerarCorridasManual=" + cantDiasMaxGerarCorridasManual); + + if (cantDiasGeneracion > cantDiasMaxGerarCorridasManual()) { + throw new BusinessException("corridaServiceImpl.geracaoCorrida.cantDiasManual", new Object[] { cantDiasMaxGerarCorridasManual }); + } + + SimpleDateFormat sdfData = new SimpleDateFormat("dd/MM/yyyy"); + + log.info("** SELECIONADOS - Data De: " + sdfData.format(dataDe) + " **Data Ateh: " + sdfData.format(dataAte)); + + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataDe); + + Long cantInicio = corridaDAO.cantCorridaGeneradasHoy(); + + while (DateUtil.compareOnlyDate(dataDe, dataAte) <= 0) { + log.info("*** Data: " + sdfData.format(dataDe)); + + this.generarCorrida(dataDe, lsEsquemaCorrida); + + calendarData.add(Calendar.DATE, 1); + dataDe = calendarData.getTime(); + } + + Long cantFim = corridaDAO.cantCorridaGeneradasHoy(); + + return cantFim - cantInicio; + } + + public List buscarGroupCorrridaId(Integer corridaId, Date dateInicio, Date dateFin) { + GregorianCalendar gCalendarDe = new GregorianCalendar(); + gCalendarDe.setTime(dateInicio); + gCalendarDe.set(Calendar.HOUR_OF_DAY, 0); + gCalendarDe.set(Calendar.MINUTE, 0); + gCalendarDe.set(Calendar.SECOND, 0); + gCalendarDe.set(Calendar.MILLISECOND, 0); + + GregorianCalendar gCalendarAte = new GregorianCalendar(); + gCalendarAte.setTime(dateFin); + gCalendarAte.set(Calendar.HOUR_OF_DAY, 0); + gCalendarAte.set(Calendar.MINUTE, 0); + gCalendarAte.set(Calendar.SECOND, 0); + gCalendarAte.set(Calendar.MILLISECOND, 0); + + return corridaDAO.buscarGroupCorrridaId(corridaId, gCalendarDe.getTime(), gCalendarAte.getTime()); + } + + @Override + public List buscarGroupCorrridaId(Integer corridaId, Integer origem, Integer destino, Integer ruta, Integer numRuta, Date dateInicio, Date dateFin) { + GregorianCalendar gCalendarDe = new GregorianCalendar(); + gCalendarDe.setTime(dateInicio); + gCalendarDe.set(Calendar.HOUR_OF_DAY, 0); + gCalendarDe.set(Calendar.MINUTE, 0); + gCalendarDe.set(Calendar.SECOND, 0); + gCalendarDe.set(Calendar.MILLISECOND, 0); + + GregorianCalendar gCalendarAte = new GregorianCalendar(); + gCalendarAte.setTime(dateFin); + gCalendarAte.set(Calendar.HOUR_OF_DAY, 0); + gCalendarAte.set(Calendar.MINUTE, 0); + gCalendarAte.set(Calendar.SECOND, 0); + gCalendarAte.set(Calendar.MILLISECOND, 0); + + return corridaDAO.buscarGroupCorrridaId(corridaId, origem, destino, ruta, numRuta, gCalendarDe.getTime(), gCalendarAte.getTime()); + } + + @Override + public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId) { + try { + List corridas = corridaDAO.buscarPorEstado(estado, dataInicial, corridaId); + corridaDAO.actualizaFecHusoFecVerano(corridas); + return Boolean.TRUE; + + } catch (Exception ex) { + log.error("Erro ao atualizar corridas FecHuso FecVerano: " + ex, ex); + } + return Boolean.FALSE; + + } + + @Override + public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial) { + return atualizarCorridaFecHusoFecVerano(estado, dataInicial, null); + } + + @Override + public List buscarCorridaRelatorio(Connection conexao, Parada origem, Parada destino, + Date feccorrida, Integer corridaId) { + + List ls = new ArrayList(); + try { + StringBuilder sql = new StringBuilder(); + sql.append(" select "); + sql.append(" c.corrida_id as corrida_id, "); + sql.append(" c.feccorrida as feccorrida, "); + sql.append(" c.fechorsalida as fechorsalida, "); + sql.append(" origen.parada_id as origen_id, "); + sql.append(" origen.descparada as origen, "); + sql.append(" destino.parada_id as destino_id, "); + sql.append(" destino.descparada as destino, "); + sql.append(" r.ruta_id as ruta_id, "); + sql.append(" r.descruta as descruta, "); + sql.append(" cs.claseservicio_id as claseservicio_id, "); + sql.append(" cs.descclase as descclase "); + sql.append(" from corrida c "); + sql.append(" inner join parada origen on c.origen_id = origen.parada_id "); + sql.append(" inner join parada destino on c.destino_id = destino.parada_id "); + sql.append(" inner join ruta r on c.ruta_id = r.ruta_id "); + sql.append(" inner join clase_servicio cs on c.claseservicio_id = cs.claseservicio_id "); + sql.append(" where c.activo <> 0 "); + sql.append(corridaId == null ? "" : " and c.corrida_id = ? "); + sql.append(feccorrida == null ? "" : " and c.feccorrida = ? "); + sql.append(origem == null ? "" : " and c.origen_id = ? "); + sql.append(destino == null ? "" : " and c.destino_id = ? "); + + int atbNum = 1; + PreparedStatement stmt = conexao.prepareStatement(sql.toString()); + if (corridaId != null) { + stmt.setInt(atbNum, corridaId); + atbNum++; + } + + if (feccorrida != null) { + stmt.setDate(atbNum, new java.sql.Date(feccorrida.getTime())); + atbNum++; + } + + if (origem != null) { + stmt.setInt(atbNum, origem.getParadaId()); + atbNum++; + } + + if (destino != null) { + stmt.setInt(atbNum, destino.getParadaId()); + atbNum++; + } + + ResultSet rset = stmt.executeQuery(); + + while (rset.next()) { + + Id id = new Id(); + id.setCorridaId(rset.getInt("corrida_id")); + id.setFeccorrida(rset.getDate("feccorrida")); + + Parada o = new Parada(); + o.setParadaId(rset.getInt("origen_id")); + o.setDescparada(rset.getString("origen")); + + Parada d = new Parada(); + d.setParadaId(rset.getInt("destino_id")); + d.setDescparada(rset.getString("destino")); + + Ruta ruta = new Ruta(); + ruta.setRutaId(rset.getInt("ruta_id")); + ruta.setDescruta(rset.getString("descruta")); + + ClaseServicio claseServicio = new ClaseServicio(); + claseServicio.setClaseservicioId(rset.getInt("claseservicio_id")); + claseServicio.setDescclase(rset.getString("descclase")); + + Corrida corrida = new Corrida(); + corrida.setId(id); + corrida.setFechorsalida(new Date(rset.getTimestamp("fechorsalida").getTime())); + corrida.setOrigem(o); + corrida.setDestino(d); + corrida.setRuta(ruta); + corrida.setClaseServicio(claseServicio); + + ls.add(corrida); + + } + + if (!conexao.isClosed()) + conexao.close(); + + } catch (SQLException e) { + log.error("", e); + } + + return ls; + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaTramoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaTramoServiceImpl.java new file mode 100644 index 000000000..b6f4fe01c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CorridaTramoServiceImpl.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CorridaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.service.CorridaTramoService; + +@Service("corridaTramoService") +public class CorridaTramoServiceImpl implements CorridaTramoService { + + @Autowired + private CorridaTramoDAO corridaTramoDAO; + + @Override + public List obtenerTodos() { + return corridaTramoDAO.obtenerTodos(); + } + + @Override + public CorridaTramo obtenerID(Integer id) { + return corridaTramoDAO.obtenerID(id); + } + + @Override + public CorridaTramo suscribir(CorridaTramo entidad) { + return corridaTramoDAO.suscribir(entidad); + } + + @Override + public CorridaTramo actualizacion(CorridaTramo entidad) { + return corridaTramoDAO.actualizacion(entidad); + } + + @Override + public void borrar(CorridaTramo entidad) { + corridaTramoDAO.borrar(entidad); + } + + @Override + public List obtenerTramoTarjetaEmitida() { + return corridaTramoDAO.obtenerTramoTarjetaEmitida(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaBeneficiarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaBeneficiarioServiceImpl.java new file mode 100644 index 000000000..390f99942 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaBeneficiarioServiceImpl.java @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CortesiaBeneficiarioDAO; +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; +import com.rjconsultores.ventaboletos.service.CortesiaBeneficiarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cortesiaBeneficiarioService") +public class CortesiaBeneficiarioServiceImpl implements CortesiaBeneficiarioService{ + + @Autowired + private CortesiaBeneficiarioDAO cortesiaBeneficiarioDAO; + + public List obtenerTodos() { + return cortesiaBeneficiarioDAO.obtenerTodos(); + } + + public CortesiaBeneficiario obtenerID(Integer id) { + return cortesiaBeneficiarioDAO.obtenerID(id); + } + + @Transactional + public CortesiaBeneficiario suscribir(CortesiaBeneficiario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaBeneficiarioDAO.suscribir(entidad); + } + + @Transactional + public CortesiaBeneficiario actualizacion(CortesiaBeneficiario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaBeneficiarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CortesiaBeneficiario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cortesiaBeneficiarioDAO.actualizacion(entidad); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaDireccionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaDireccionServiceImpl.java new file mode 100644 index 000000000..6665fbdc0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaDireccionServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CortesiaDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.service.CortesiaDireccionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cortesiaDireccionService") +public class CortesiaDireccionServiceImpl implements CortesiaDireccionService { + + @Autowired + private CortesiaDireccionDAO cortesiaDireccionDAO; + + public List obtenerTodos() { + return cortesiaDireccionDAO.obtenerTodos(); + } + + public CortesiaDireccion obtenerID(Integer id) { + return cortesiaDireccionDAO.obtenerID(id); + } + + @Transactional + public CortesiaDireccion suscribir(CortesiaDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDireccionDAO.suscribir(entidad); + + } + + @Transactional + public CortesiaDireccion actualizacion(CortesiaDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDireccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CortesiaDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cortesiaDireccionDAO.actualizacion(entidad); + } + + public List pesquisar(Marca marca, ClaseServicio claseServicio, Date fecInicio, Date fecFinal) { + + return cortesiaDireccionDAO.pesquisar(marca, claseServicio, fecInicio, fecFinal); + } + + public List buscar(CortesiaDireccion cortesiaDireccion) { + return cortesiaDireccionDAO.buscar(cortesiaDireccion); + } + + public List buscarFolio(CortesiaDireccion cortesiaDireccion) { + return cortesiaDireccionDAO.buscarFolio(cortesiaDireccion); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaServiceImpl.java new file mode 100644 index 000000000..d7a386823 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CortesiaServiceImpl.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CortesiaDAO; +import com.rjconsultores.ventaboletos.dao.EmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.service.CortesiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cortesiaService") +public class CortesiaServiceImpl implements CortesiaService { + + public static final String PENDIENTE = "P"; + @Autowired + private CortesiaDAO cortesiaDAO; + @Autowired + private EmpleadoDAO empleadoDAO; + + public List obtenerTodos() { + return cortesiaDAO.obtenerTodos(); + } + + public Cortesia obtenerID(Integer id) { + return cortesiaDAO.obtenerID(id); + } + + @Transactional + public Cortesia suscribir(Cortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDAO.suscribir(entidad); + } + + @Transactional + public Cortesia actualizacion(Cortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Cortesia entidad) { + + entidad = this.obtenerID(entidad.getCortesiaId()); + + for (CortesiaBeneficiario cb : entidad.getCortesiaBeneficiarioList()) { + cb.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cb.setFecmodif(Calendar.getInstance().getTime()); + cb.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cortesiaDAO.actualizacion(entidad); + } + + public List pesquisar(String empleadoClave) { + List empleados = empleadoDAO.obtenerTodos(); + Empleado eSlec = null; + for (Empleado emp : empleados) { + if (emp.getCveEmpleado().equals(empleadoClave)) { + eSlec = emp; + } + } + + return cortesiaDAO.pesquisar(eSlec); + } + + public Cortesia buscar(Integer cortesiaId) { + List cortesias = cortesiaDAO.obtenerTodos(); + Cortesia corSelec = null; + for (Cortesia c : cortesias) { + if (c.getCortesiaId().equals(cortesiaId)) { + corSelec = c; + } + } + + return cortesiaDAO.buscar(corSelec); + } + + public List buscarDplicidad(Cortesia cortesia) { + return cortesiaDAO.buscarDplicidad(cortesia); + } + + public boolean cortesiaUtilizada(Cortesia cortesia) { + if ((cortesia == null) || (cortesia.getNdstatus() == null)) { + throw new IllegalArgumentException("Deve de infromar los datos de la cortesia"); + } + if (!cortesia.getNdstatus().equals(PENDIENTE)) { + return true; + } + return false; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CuponConvenioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CuponConvenioServiceImpl.java new file mode 100644 index 000000000..8505609df --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CuponConvenioServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CuponConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import com.rjconsultores.ventaboletos.service.CuponConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cuponConvenioService") +public class CuponConvenioServiceImpl implements CuponConvenioService{ + + @Autowired + private CuponConvenioDAO cuponConvenioDAO; + public List obtenerTodos() { + return cuponConvenioDAO.obtenerTodos(); + } + + public CuponConvenio obtenerID(Integer id) { + return cuponConvenioDAO.obtenerID(id); + } + + @Transactional + public CuponConvenio suscribir(CuponConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponConvenioDAO.suscribir(entidad); + } + + @Transactional + public CuponConvenio actualizacion(CuponConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponConvenioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CuponConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cuponConvenioDAO.actualizacion(entidad); + } + + public List pesquisar(TipoConvenio tipoConvenio) { + + return cuponConvenioDAO.pesquisar(tipoConvenio); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CuponSecretariaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CuponSecretariaServiceImpl.java new file mode 100644 index 000000000..0d30145fb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CuponSecretariaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CuponSecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; +import com.rjconsultores.ventaboletos.service.CuponSecretariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("cuponSecretariaService") +public class CuponSecretariaServiceImpl implements CuponSecretariaService { + + @Autowired + private CuponSecretariaDAO cuponSecretariaDAO; + + public List obtenerTodos() { + return cuponSecretariaDAO.obtenerTodos(); + } + + public CuponSecretaria obtenerID(Integer id) { + return cuponSecretariaDAO.obtenerID(id); + } + + @Transactional + public CuponSecretaria suscribir(CuponSecretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponSecretariaDAO.suscribir(entidad); + } + + @Transactional + public CuponSecretaria actualizacion(CuponSecretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponSecretariaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CuponSecretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cuponSecretariaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CursoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CursoServiceImpl.java new file mode 100644 index 000000000..f220813fb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/CursoServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CursoDAO; +import com.rjconsultores.ventaboletos.entidad.Curso; +import com.rjconsultores.ventaboletos.service.CursoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("cursoService") +public class CursoServiceImpl implements CursoService { + + @Autowired + private CursoDAO CursoDAO; + + public List obtenerTodos() { + return CursoDAO.obtenerTodos(); + } + + public Curso obtenerID(Integer id) { + return CursoDAO.obtenerID(id); + } + + @Transactional + public Curso suscribir(Curso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return CursoDAO.suscribir(entidad); + } + + @Transactional + public Curso actualizacion(Curso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return CursoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Curso entidad) throws RegistroConDependenciaException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + CursoDAO.actualizacion(entidad); + } + + + public List buscar(String nomcurso){ + return CursoDAO.buscar(nomcurso); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DepositoBancarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DepositoBancarioServiceImpl.java new file mode 100644 index 000000000..eb3d21f1d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DepositoBancarioServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.DepositoBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; +import com.rjconsultores.ventaboletos.service.DepositoBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("depositoBancarioService") +public class DepositoBancarioServiceImpl implements DepositoBancarioService { + + @Autowired + private DepositoBancarioDAO depositoBancarioDAO; + + public List obtenerTodos() { + return depositoBancarioDAO.obtenerTodos(); + } + + public DepositoBancario obtenerID(Integer id) { + return depositoBancarioDAO.obtenerID(id); + } + + @Transactional + public DepositoBancario suscribir(DepositoBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return depositoBancarioDAO.suscribir(entidad); + } + + @Transactional + public DepositoBancario actualizacion(DepositoBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return depositoBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DepositoBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + depositoBancarioDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DescontoComissaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DescontoComissaoServiceImpl.java new file mode 100644 index 000000000..e1fa81cf3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DescontoComissaoServiceImpl.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DescontoComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; +import com.rjconsultores.ventaboletos.service.DescontoComissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("descontoComissaoService") +public class DescontoComissaoServiceImpl implements DescontoComissaoService { + + @Autowired + private DescontoComissaoDAO descontoComissaoDAO; + + @Override + public List obtenerTodos() { + return descontoComissaoDAO.obtenerTodos(); + } + + @Override + public DescontoComissao obtenerID(Long id) { + return descontoComissaoDAO.obtenerID(id); + } + + @Override + public List buscaDescontoComissaoPeriodo(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo) { + return descontoComissaoDAO.buscaDescontoComissao(puntoVentaId, empresaId, inicioPeriodo, fimPeriodo); + } + + @Transactional + @Override + public DescontoComissao suscribir(DescontoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return descontoComissaoDAO.suscribir(entidad); + } + + @Transactional + @Override + public DescontoComissao actualizacion(DescontoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return descontoComissaoDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(DescontoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + descontoComissaoDAO.actualizacion(entidad); + } + + @Override + @Transactional + public DescontoComissao suscribirOrActualizacion(DescontoComissao entidad) { + return entidad != null && entidad.getDescontocomissaoId() == null ? suscribir(entidad) : actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DetAbastoBoletoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DetAbastoBoletoServiceImpl.java new file mode 100644 index 000000000..5c1d90d53 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DetAbastoBoletoServiceImpl.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("detAbastoBoletoService") +public class DetAbastoBoletoServiceImpl implements DetAbastoBoletoService { + + @Autowired + private DetAbastoBoletoDAO detAbastoBoletoDAO; + + @Override + public List obtenerTodos() { + return detAbastoBoletoDAO.obtenerTodos(); + } + + @Override + public DetAbastoBoleto obtenerID(Integer id) { + return detAbastoBoletoDAO.obtenerID(id); + } + + @Transactional + public DetAbastoBoleto suscribir(DetAbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detAbastoBoletoDAO.suscribir(entidad); + } + + @Transactional + public DetAbastoBoleto actualizacion(DetAbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detAbastoBoletoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DetAbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + detAbastoBoletoDAO.actualizacion(entidad); + } + + @Override + public Long getSecuencia() { + return detAbastoBoletoDAO.getSecuencia(); + } + + @Override + public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) { + + List detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa); + + if (!detAbastoBoletos.isEmpty()) { + detAbastoBoletoDAO.desativaDetAbastos(detAbastoBoletos); + + DetAbastoBoleto detAbastoBoletoInicial = detAbastoBoletos.get(0); + detAbastoBoletoInicial.setNumfoliofinal(numfolioinicial); + detAbastoBoletoInicial.setActivo(Boolean.TRUE); + detAbastoBoletoDAO.actualizacion(detAbastoBoletoInicial); + + DetAbastoBoleto detAbastoBoletoFinal = detAbastoBoletos.get(detAbastoBoletos.size() - 1); + detAbastoBoletoFinal.setNumfolioinicial(numfoliofinal); + detAbastoBoletoFinal.setActivo(Boolean.TRUE); + detAbastoBoletoDAO.actualizacion(detAbastoBoletoFinal); + } + } + + @Override + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa) { + return detAbastoBoletoDAO.buscabDetAbastoBoletoAutomatico(estacion, numseriepreimpresa); + } + + @Override + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf aidf) { + return detAbastoBoletoDAO.buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(aidf); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DetDiagramaAutobusServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DetDiagramaAutobusServiceImpl.java new file mode 100644 index 000000000..75bb1794d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DetDiagramaAutobusServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.DetDiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.service.DetDiagramaAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("detDiagramaAutobusService") +public class DetDiagramaAutobusServiceImpl implements DetDiagramaAutobusService { + + @Autowired + private DetDiagramaAutobusDAO detDiagramaAtuobusDAO; + + public List obtenerTodos() { + return detDiagramaAtuobusDAO.obtenerTodos(); + } + + public DetDiagramaAutobus obtenerID(Short id) { + return detDiagramaAtuobusDAO.obtenerID(id); + } + + @Transactional + public DetDiagramaAutobus suscribir(DetDiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detDiagramaAtuobusDAO.suscribir(entidad); + } + + @Transactional + public DetDiagramaAutobus actualizacion(DetDiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detDiagramaAtuobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DetDiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + detDiagramaAtuobusDAO.actualizacion(entidad); + } + + @Override + public DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento) { + return detDiagramaAtuobusDAO.obtenerPorDiagramaAutobusAsiento(diagramaAutobusId,numAsiento); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DiagramaAutobusServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DiagramaAutobusServiceImpl.java new file mode 100644 index 000000000..41dea8b55 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DiagramaAutobusServiceImpl.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.service.DiagramaAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("diagramaAutobusService") +public class DiagramaAutobusServiceImpl implements DiagramaAutobusService { + + @Autowired + private DiagramaAutobusDAO diagramaAutobusDAO; + + public List obtenerTodos() { + return diagramaAutobusDAO.obtenerTodos(); + } + + public DiagramaAutobus obtenerID(Short id) { + return diagramaAutobusDAO.obtenerID(id); + } + + @Transactional + public DiagramaAutobus suscribir(DiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return diagramaAutobusDAO.suscribir(entidad); + } + + @Transactional + public DiagramaAutobus actualizacion(DiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return diagramaAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DiagramaAutobus entidad) { + + for (DetDiagramaAutobus dda : entidad.getDetDiagramaAutobusList()) { + dda.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + dda.setFecmodif(Calendar.getInstance().getTime()); + dda.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + diagramaAutobusDAO.actualizacion(entidad); + } + + public List buscar(String descDiagrama, Short maxparados,Short cantasientos) { + return diagramaAutobusDAO.buscar(descDiagrama, maxparados, cantasientos); + } + + public List buscar(String descDiagrama) { + return diagramaAutobusDAO.buscar(descDiagrama); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DivisionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DivisionServiceImpl.java new file mode 100644 index 000000000..5543b545c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/DivisionServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DivisionDAO; +import com.rjconsultores.ventaboletos.entidad.Division; +import com.rjconsultores.ventaboletos.service.DivisionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("divisionService") +public class DivisionServiceImpl implements DivisionService { + + @Autowired + private DivisionDAO divisionDAO; + + @Override + public List obtenerTodos() { + return divisionDAO.obtenerTodos(); + } + + @Override + public Division obtenerID(Integer id) { + return divisionDAO.obtenerID(id); + } + + @Override + @Transactional + public Division suscribir(Division entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return divisionDAO.suscribir(entidad); + } + + @Override + @Transactional + public Division actualizacion(Division entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return divisionDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(Division entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + divisionDAO.actualizacion(entidad); + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpleadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpleadoServiceImpl.java new file mode 100644 index 000000000..5211c9581 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpleadoServiceImpl.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConductorDAO; +import com.rjconsultores.ventaboletos.dao.EmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.Conductor; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.service.EmpleadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("empleadoService") +public class EmpleadoServiceImpl implements EmpleadoService { + + private static int CONDUCTOR = 1; + + @Autowired + private EmpleadoDAO empleadoDAO; + @Autowired + private ConductorDAO conductorDAO; + + public List obtenerTodos() { + return empleadoDAO.obtenerTodos(); + } + + public Empleado obtenerID(Integer id) { + return empleadoDAO.obtenerID(id); + } + + @Transactional + public Empleado suscribir(Empleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + Empleado result = empleadoDAO.suscribir(entidad); + + if (entidad.getTipoEmpleado().getTipoEmpleadoId() == CONDUCTOR){ + Conductor cond = new Conductor(); + cond.setActivo(Boolean.TRUE); + cond.setEmpleado(result); + cond.setFecmodif(Calendar.getInstance().getTime()); + cond.setNombconductor(entidad.getNombEmpleado()); + cond.setNomPaterno(entidad.getNombPaterno()); + cond.setNomMaterno(entidad.getNombMaterno()); + cond.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + conductorDAO.suscribir(cond); + } + + return result; + } + + @Transactional + public Empleado actualizacion(Empleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getTipoEmpleado().getTipoEmpleadoId() == CONDUCTOR){ + Conductor cond = conductorDAO.buscarPorEmpleado(entidad.getEmpleadoId()); + cond.setActivo(Boolean.TRUE); + cond.setEmpleado(entidad); + cond.setFecmodif(Calendar.getInstance().getTime()); + cond.setNombconductor(entidad.getNombEmpleado()); + cond.setNomPaterno(entidad.getNombPaterno()); + cond.setNomMaterno(entidad.getNombMaterno()); + cond.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + conductorDAO.actualizacion(cond); + } + + return empleadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Empleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + if (entidad.getTipoEmpleado().getTipoEmpleadoId() == CONDUCTOR){ + Conductor cond = conductorDAO.buscarPorEmpleado(entidad.getEmpleadoId()); + cond.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cond.setFecmodif(Calendar.getInstance().getTime()); + cond.setActivo(Boolean.FALSE); + conductorDAO.actualizacion(cond); + } + + empleadoDAO.actualizacion(entidad); + } + + public List pesquisaClave(String empleadoClave) { + return empleadoDAO.pesquisaClave(empleadoClave); + } + + @Override + public List pesquisaEmpresa(Empresa empresa) { + return empleadoDAO.pesquisaEmpresa(empresa.getEmpresaId()); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaContaBancariaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaContaBancariaServiceImpl.java new file mode 100644 index 000000000..b9992ff53 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaContaBancariaServiceImpl.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaContaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EmpresaContaBancariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaContaBancariaService") +public class EmpresaContaBancariaServiceImpl implements EmpresaContaBancariaService { + + @Autowired + private EmpresaContaBancariaDAO empresaContaBancariaDAO; + + @Transactional + public EmpresaContaBancaria suscribirActualizacion(EmpresaContaBancaria entidad) throws BusinessException { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getEmpresaContaBancariaId() == null) { + + entidad = empresaContaBancariaDAO.suscribir(entidad); + +// gerarMarca(entidad); + + } else { + entidad = empresaContaBancariaDAO.actualizacion(entidad); + } + + return entidad; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEquivalenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEquivalenciaServiceImpl.java new file mode 100644 index 000000000..0e6248b58 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEquivalenciaServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EmpresaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import com.rjconsultores.ventaboletos.service.EmpresaEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("empresaEquivalenciaService") +public class EmpresaEquivalenciaServiceImpl implements EmpresaEquivalenciaService { + + @Autowired + private EmpresaEquivalenciaDAO empresaEquivalenciaDAO; + + public List obtenerTodos() { + return empresaEquivalenciaDAO.obtenerTodos(); + } + + public EmpresaEquivalencia obtenerID(Integer id) { + return empresaEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public EmpresaEquivalencia suscribir(EmpresaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public EmpresaEquivalencia actualizacion(EmpresaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EmpresaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(Empresa empresa, ComisionistaExterno comisionistaExterno) { + return empresaEquivalenciaDAO.buscar(empresa, comisionistaExterno); + } + + public List buscarEquivalencia(EmpresaEquivalencia empresaEquivalencia) { + return empresaEquivalenciaDAO.buscar(empresaEquivalencia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java new file mode 100644 index 000000000..7c313e7d0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaImpostoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; +import com.rjconsultores.ventaboletos.service.EmpresaImpostoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("empresaImpostoService") +public class EmpresaImpostoServiceImpl implements EmpresaImpostoService { + + @Autowired + private EmpresaImpostoDAO empresaImpostoDAO; + + @Transactional + public EmpresaImposto suscribir(EmpresaImposto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaImpostoDAO.suscribir(entidad); + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.GenericService#obtenerTodos() + */ + @Override + public List obtenerTodos() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.GenericService#obtenerID(java.lang.Object) + */ + @Override + public EmpresaImposto obtenerID(Integer id) { + return empresaImpostoDAO.obtenerID(id); + } + + @Transactional + public EmpresaImposto actualizacion(EmpresaImposto entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + return empresaImpostoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EmpresaImposto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaImpostoDAO.actualizacion(entidad); + + } + + @Override + public List buscarByEmpresa(Empresa empresa) { + return empresaImpostoDAO.buscarByEmpresa(empresa); + + } + + @Override + public List buscarEmpresaImposto(Integer empresaId) { + return empresaImpostoDAO.buscarEmpresaImposto(empresaId); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java new file mode 100644 index 000000000..a81e71223 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java @@ -0,0 +1,219 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.MarcaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("empresaService") +public class EmpresaServiceImpl implements EmpresaService { + + @Autowired + private EmpresaDAO empresaDAO; + + @Autowired + private MarcaService marcaService; + + @Autowired + private RutaEmpresaDAO rutaEmpresaDAO; + + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + + public List obtenerTodos() { + return empresaDAO.obtenerTodos(); + } + + public Empresa obtenerID(Integer id) { + return empresaDAO.obtenerID(id); + } + + @Transactional + public Empresa suscribirActualizacion(Empresa entidad) throws BusinessException { + ComEmpConferencia comEmpConferencia = null; + if (entidad.getComEmpConferencias() != null && !entidad.getComEmpConferencias().isEmpty()) { + comEmpConferencia = entidad.getComEmpConferencias().iterator().next(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getEmpresaId() == null) { + + entidad = empresaDAO.suscribir(entidad); + + gerarMarca(entidad); + + } else { + entidad = empresaDAO.actualizacion(entidad); + } + + if (comEmpConferencia != null) { + comEmpConferencia.setEmpresa(entidad); + suscribirOrActualizacion(comEmpConferencia); + } + + return entidad; + } + + private void gerarMarca(Empresa empresa) { + + Marca marca = new Marca(); + + marca.setEmpresa(empresa); + marca.setDescmarca(empresa.getNombempresa()); + + marcaService.suscribir(marca); + + } + + @Transactional + public void borrar(Empresa entidad) throws RegistroConDependenciaException { + if ((rutaEmpresaDAO.obtenerPorEmpresa(entidad).size() > 0) || + (esquemaCorridaDAO.buscarPorEmpresaCorrida(entidad).size() > 0)) { + throw new RegistroConDependenciaException(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaDAO.actualizacion(entidad); + } + + public List buscar(String nombempresa, Boolean indExterna, Short indTipo) { + return empresaDAO.buscar(nombempresa, indExterna, indTipo); + } + + public List buscarTodosExceto(List empresa, Integer... idEmpresa) { + return empresaDAO.buscarTodosExceto(empresa, idEmpresa); + } + + public List obtenerIndExternoFalse() { + return empresaDAO.obtenerIndExternoFalse(); + } + + public List obtenerIndTipo2() { + return empresaDAO.obtenerIndTipo2(); + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.EmpresaService#buscarNotInPuntoVtaComissao(com.rjconsultores.ventaboletos.entidad.PuntoVenta) + */ + @Override + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta) { + return empresaDAO.buscarNotInPuntoVtaComissao(puntoVenta); + + } + + @Override + public List buscaInscricoesEstaduais(Empresa empresa) { + return empresaDAO.buscaInscricoesEstaduais(empresa); + } + + @Override + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual) { + empresaDAO.actualizaInscEstadual(inscricaoEstadual); + } + + @Override + public List buscaLike(String nombempresa) { + return empresaDAO.buscaLike(nombempresa); + } + + @Override + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria) { + comEmpCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpCategoria.setFecmodif(Calendar.getInstance().getTime()); + comEmpCategoria.setActivo(Boolean.TRUE); + return empresaDAO.adicionarComissaoCategoria(comEmpCategoria); + } + + @Override + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria) { + comEmpCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpCategoria.setFecmodif(Calendar.getInstance().getTime()); + comEmpCategoria.setActivo(Boolean.FALSE); + empresaDAO.removerComissaoCategoria(comEmpCategoria); + } + + @Override + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago) { + comEmpFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpFormapago.setFecmodif(Calendar.getInstance().getTime()); + comEmpFormapago.setActivo(Boolean.TRUE); + return empresaDAO.adicionarComissaoFormapago(comEmpFormapago); + } + + @Override + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago) { + comEmpFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpFormapago.setFecmodif(Calendar.getInstance().getTime()); + comEmpFormapago.setActivo(Boolean.FALSE); + empresaDAO.removerComissaoFormapago(comEmpFormapago); + } + + @Override + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + comEmpTipoEventoExtra.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpTipoEventoExtra.setFecmodif(Calendar.getInstance().getTime()); + comEmpTipoEventoExtra.setActivo(Boolean.TRUE); + return empresaDAO.adicionarComissaoTipoEventoExtra(comEmpTipoEventoExtra); + } + + @Override + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + comEmpTipoEventoExtra.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpTipoEventoExtra.setFecmodif(Calendar.getInstance().getTime()); + comEmpTipoEventoExtra.setActivo(Boolean.FALSE); + empresaDAO.removerComissaoTipoEventoExtra(comEmpTipoEventoExtra); + } + + @Override + public List obtenerTodosIncluindoEmpresaTodas() { + return empresaDAO.obtenerTodosIncluindoEmpresaTodas(); + } + + @Override + @Transactional + public ComEmpConferencia suscribirOrActualizacion(ComEmpConferencia comEmpConferencia) { + if (comEmpConferencia.getComempconferenciaId() == null) { + comEmpConferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpConferencia.setFecmodif(Calendar.getInstance().getTime()); + comEmpConferencia.setActivo(Boolean.TRUE); + return empresaDAO.suscribir(comEmpConferencia); + } else { + return empresaDAO.actualizacion(comEmpConferencia); + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EnderecoApanheServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EnderecoApanheServiceImpl.java new file mode 100644 index 000000000..cc7221e40 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EnderecoApanheServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EnderecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; +import com.rjconsultores.ventaboletos.service.EnderecoApanheService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("enderecoApanheService") +public class EnderecoApanheServiceImpl implements EnderecoApanheService { + + @Autowired + private EnderecoApanheDAO enderecoApanheDAO; + + public List obtenerTodos() { + return enderecoApanheDAO.obtenerTodos(); + } + + public EnderecoApanhe obtenerID(Long id) { + return enderecoApanheDAO.obtenerID(id); + } + + @Transactional + public EnderecoApanhe suscribir(EnderecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return enderecoApanheDAO.suscribir(entidad); + } + + @Transactional + public EnderecoApanhe actualizacion(EnderecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return enderecoApanheDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EnderecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + enderecoApanheDAO.actualizacion(entidad); + } + + public List buscar(Date datapacote, String numoperacion) { + return enderecoApanheDAO.buscar(datapacote, numoperacion); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EscolaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EscolaServiceImpl.java new file mode 100644 index 000000000..ebe3bac97 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EscolaServiceImpl.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CiudadDAO; +import com.rjconsultores.ventaboletos.dao.EscolaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; +import com.rjconsultores.ventaboletos.service.EscolaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("escolaService") +public class EscolaServiceImpl implements EscolaService { + + @Autowired + private EscolaDAO EscolaDAO; + @Autowired + private CiudadDAO ciudadDAO; + + public List obtenerTodos() { + return EscolaDAO.obtenerTodos(); + } + + public Escola obtenerID(Integer id) { + return EscolaDAO.obtenerID(id); + } + + @Transactional + public Escola suscribir(Escola entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return EscolaDAO.suscribir(entidad); + } + + @Transactional + public Escola actualizacion(Escola entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return EscolaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Escola entidad) throws RegistroConDependenciaException { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + EscolaDAO.actualizacion(entidad); + } + + public List buscar(String nombEscola, Ciudad ciudad) { + return EscolaDAO.buscar(nombEscola, ciudad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAgrupacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAgrupacionServiceImpl.java new file mode 100644 index 000000000..78ae2e0ba --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAgrupacionServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaAgrupacionDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.service.EsquemaAgrupacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author RJ Consultores + */ +@Service("esquemaAgrupacionService") +public class EsquemaAgrupacionServiceImpl implements EsquemaAgrupacionService { + + @Autowired + private EsquemaAgrupacionDAO esquemaAgrupacionDAO; + + public List obtenerTodos() { + return esquemaAgrupacionDAO.obtenerTodos(); + } + + public EsquemaAgrupacion obtenerID(Integer id) { + return esquemaAgrupacionDAO.obtenerID(id); + } + + @Transactional + public EsquemaAgrupacion suscribir(EsquemaAgrupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaAgrupacionDAO.suscribir(entidad); + } + + @Transactional + public EsquemaAgrupacion actualizacion(EsquemaAgrupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaAgrupacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EsquemaAgrupacion entidad) { + entidad = (entidad.getEsquemaagrupacionId() == null) ? entidad : esquemaAgrupacionDAO.obtenerID(entidad.getEsquemaagrupacionId()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaAgrupacionDAO.actualizacion(entidad); + } + + public List buscar(EsquemaAgrupacion esquemaAgrupacion) { + return esquemaAgrupacionDAO.buscar(esquemaAgrupacion); + } + + @Override + public EsquemaAgrupacion obtenerByEsquemaAgrupacion(Integer id) { + return esquemaAgrupacionDAO.obtenerByEsquemaAgrupacion(id); + } + + public boolean buscarNumAgrupacion(Integer numAgrupacion) { + return esquemaAgrupacionDAO.buscarNumAgrupacion(numAgrupacion); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java new file mode 100644 index 000000000..5e3fb42b2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java @@ -0,0 +1,214 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaAsientoDAO; +import com.rjconsultores.ventaboletos.dao.RutaSecuenciaDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.DiagramaAutobusService; +import com.rjconsultores.ventaboletos.service.EsquemaAsientoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("esquemaAsientoService") +public class EsquemaAsientoServiceImpl implements EsquemaAsientoService { + + private static Logger log = LoggerFactory.getLogger(EsquemaAsientoServiceImpl.class); + private static final String BLOQUEO_EXCLUSIVO = "BLOQUEO_EXCLUSIVO"; + private static final String BLOQUEO_OCUPACION = "BLOQUEO_OCUPACION"; + @Autowired + private EsquemaAsientoDAO esquemaAsientoDAO; + @Autowired + private RutaSecuenciaDAO rutaSecuenciaDAO; + @Autowired + private DiagramaAutobusService diagramaAutobusService; + + private EsquemaAsiento suscribir(EsquemaAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaAsientoDAO.suscribir(entidad); + } + + @Transactional + public void borrar(EsquemaAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaAsientoDAO.actualizacion(entidad); + } + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida) { + return esquemaAsientoDAO.obtenerPorCorrida(esquemaCorrida); + } + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento) { + return esquemaAsientoDAO.obtenerPorCorridaeAsiento(esquemaCorrida, asiento); + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public void bloqueoAsientoExclusivo(EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Integer tiempoLiberacion) throws BusinessException { + + if (origen == null) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.origenObligatoria"); + } + + hacerBloqueo(BLOQUEO_EXCLUSIVO, esquemaCorrida, strAsiento, origen, null, null, tiempoLiberacion); + } + + private boolean hacerBloqueo(String tipoBloqueo, EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Parada destino, String motivoOcupacion, Integer tiempoLiberacion) throws BusinessException { + List asientos = cargarAsientos(strAsiento); + + DiagramaAutobus da = diagramaAutobusService.obtenerID(esquemaCorrida.getRolOperativo().getDiagramaAutobus().getDiagramaautobusId()); + + for (String asiento : asientos) { + + boolean vende = true; + boolean existe = false; + List listDda = da.getDetDiagramaAutobusList(); + for (DetDiagramaAutobus dd : listDda) { + if (dd.getAsiento().equals(asiento)) { + existe = true; + if (!dd.getVendible()) { + vende = false; + } + } + } + if (!existe) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.invalido"); + } + + if (vende) { + EsquemaAsiento es = new EsquemaAsiento(); + es.setActivo(Boolean.TRUE); + es.setFecmodif(Calendar.getInstance().getTime()); + es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + es.setNumasiento(asiento.toString()); + es.setTiempoLiberacion(tiempoLiberacion); + + if (tipoBloqueo.equals(BLOQUEO_EXCLUSIVO)) { + es.setIndvendible(Boolean.TRUE); + es.setParada(origen); + } else { + es.setIndvendible(Boolean.FALSE); + es.setParada(origen); + es.setDestino(destino); + es.setMotivobloqueo(motivoOcupacion); + } + + es.setEsquemaCorrida(esquemaCorrida); + + EsquemaAsiento esquemaAsientoBusqueda = obtenerPorCorridaeAsiento(esquemaCorrida, asiento); + if (esquemaAsientoBusqueda.getEsquemaasientoId() == null) { + es = suscribir(es); + + // validação extra para garantir que salvou corretamente + if (tipoBloqueo.equals(BLOQUEO_EXCLUSIVO)) { + + if (!(es.getIndvendible() && (es.getParada() != null) && (es.getDestino() == null))) { + + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.validacionGrabacion"); + } + + } else { + // validação extra para garantir que salvou corretamente + if (!(!es.getIndvendible() && (es.getParada() != null) && (es.getDestino() != null))) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.validacionGrabacion"); + } + } + } else { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.poltronaJahConfigurada", new Object[] { asiento }); + } + + } else { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.poltronaNoVendible", new Object[] { asiento }); + } + } + + return true; + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Parada destino, Integer tiempoLiberacion, String motivoOcupacion) throws BusinessException { + + if (origen == null) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.origenObligatoria"); + } + if (destino == null) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.destinoObligatoria"); + } + if (StringUtils.isBlank(motivoOcupacion)) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.motivo"); + } + + if (!rutaSecuenciaDAO.paradaSecuenciaValida(esquemaCorrida.getRuta(), origen, destino)) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.tramo"); + } + + hacerBloqueo(BLOQUEO_OCUPACION, esquemaCorrida, strAsiento, origen, destino, motivoOcupacion, tiempoLiberacion); + } + + /** + * Hace la conversion de la string strAsientos en una lista de asientos válidos
+ * + * @param strAsientos + * @return + * @throws BusinessException + */ + private List cargarAsientos(String strAsientos) throws BusinessException { + List todosAsientos = new ArrayList(); + + try { + String asientos[] = strAsientos.split(","); + + for (int i = 0; i < asientos.length; i++) { + if (asientos[i].contains("-")) { + String intervalo[] = asientos[i].split("-"); + Integer ini = Integer.parseInt(intervalo[0]); + Integer fim = Integer.parseInt(intervalo[1]); + + while (ini <= fim) { + todosAsientos.add(ini.toString()); + ini++; + } + } else { + Integer.parseInt(asientos[i]);// para validar + todosAsientos.add(asientos[i]); + } + } + } catch (NumberFormatException t) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.invalido"); + } catch (Throwable t) { + log.error("", t); + + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.invalido"); + } + + return todosAsientos; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaServiceImpl.java new file mode 100644 index 000000000..64c73c3ef --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaServiceImpl.java @@ -0,0 +1,192 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaTramoDAO; +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEsquema; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("esquemaCorridaService") +public class EsquemaCorridaServiceImpl implements EsquemaCorridaService { + + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private RutaCombinacionDAO rutaCombinacionDAO; + @Autowired + private EsquemaTramoDAO esquemaTramoDAO; + + public List obtenerTodos() { + return esquemaCorridaDAO.obtenerTodos(); + } + + public EsquemaCorrida obtenerID(Integer id) { + return esquemaCorridaDAO.obtenerID(id); + } + + @Override + public List buscarPorEmpresaCorrida(Empresa empresa){ + return esquemaCorridaDAO.buscarPorEmpresaCorrida(empresa); + } + + @Transactional + public EsquemaCorrida suscribir(EsquemaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaCorridaDAO.suscribir(entidad); + } + + @Transactional + public EsquemaCorrida actualizacion(EsquemaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaCorridaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EsquemaCorrida entidad) { + entidad = (entidad.getEsquemacorridaId() == null) ? entidad : esquemaCorridaDAO.obtenerID(entidad.getEsquemacorridaId()); + for (EsquemaAsiento pricing : entidad.getEsquemaAsientoList()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + } + + for (EsquemaTramo pricing : entidad.getEsquemaTramoList()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaCorridaDAO.actualizacion(entidad); + } + + public List buscarPorEsquemaOperacional(EsquemaOperacional eo) { + return esquemaCorridaDAO.buscarPorEsquemaOperacional(eo); + } + + public List buscar(Marca marca, RolOperativo rolOperativo, + Ruta ruta, ClaseServicio claseServicio) { + return esquemaCorridaDAO.buscar(marca, rolOperativo, ruta, claseServicio); + } + + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra) { + return esquemaCorridaDAO.buscarNumCorrida(numCorrida, numCorridaPisoExtra); + } + + @Transactional + public void actualizaEsquemaTramo(List listParadaEsquema, EsquemaCorrida ec) { + + ec = this.obtenerID(ec.getEsquemacorridaId()); + if (ec.getEsquemaTramoList() != null) { + for (EsquemaTramo et : ec.getEsquemaTramoList()) { + et.setActivo(Boolean.FALSE); + et.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + et.setFecmodif(Calendar.getInstance().getTime()); + esquemaTramoDAO.actualizacion(et); + } + } + + Date dataHorInicioSistema = DateUtil.getFecInicio().getTime(); + for (int i = 0; (i < listParadaEsquema.size() - 1); i++) { + Parada paradaOrigen = listParadaEsquema.get(i).getParada(); + Parada paradaDestino = listParadaEsquema.get(i + 1).getParada(); + + Tramo t = rutaCombinacionDAO.busqueda(ec.getRuta(), paradaOrigen, paradaDestino); + + if (t == null) { + throw new RuntimeException("No fue encontrado el tramo para el origen:" + paradaOrigen + " y destino:" + paradaDestino); + } + + EsquemaTramo et = new EsquemaTramo(); + et.setActivo(Boolean.TRUE); + et.setEsquemaCorrida(ec); + et.setFecmodif(Calendar.getInstance().getTime()); + et.setNumsecuencia((short) (i + 1)); + et.setTramo(t); + et.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + et.setPlataforma(listParadaEsquema.get(i).getPlataforma()); + + Date tiempoEstancia = listParadaEsquema.get(i).getTiempoEstancia(); + if ((tiempoEstancia != null) && (DateUtil.compareDate(tiempoEstancia, dataHorInicioSistema) == 0)) { + et.setTiempoEstancia(null); + } else { + et.setTiempoEstancia(tiempoEstancia); + } + + Date excepcionRecorrido = listParadaEsquema.get(i).getExcepcionRecorrido(); + if ((excepcionRecorrido != null) && (DateUtil.compareDate(excepcionRecorrido, dataHorInicioSistema) == 0)) { + et.setExcepcionRecorrido(null); + } else { + et.setExcepcionRecorrido(excepcionRecorrido); + } + + esquemaTramoDAO.suscribir(et); + } + } + + @Override + public List buscaDentroVigencia(Date dataGeracao) { + return esquemaCorridaDAO.buscaDentroVigencia(dataGeracao); + } + + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao) { + return esquemaCorridaDAO.buscaDentroVigenciaQtdeDiasNull(dataGeracao); + } + + @Override + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataDe) { + return esquemaCorridaDAO.buscaDentroVigenciaQtdeDiasNotNull(dataDe); + } + + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo) { + return esquemaCorridaDAO.buscarEsquemaCorridaExisteTramo(tramo); + } + + @Override + public List existe(Ruta ruta, Integer paradaId) { + return esquemaCorridaDAO.existe(ruta, paradaId); + } + + @Override + public EsquemaCorrida obtenerByEsquemaCorrida(Integer id) { + return esquemaCorridaDAO.obtenerByEsquemaCorrida(id); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaOperacionalServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaOperacionalServiceImpl.java new file mode 100644 index 000000000..ff8c1e036 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaOperacionalServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EsquemaOperacionalDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.service.EsquemaOperacionalService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("esquemaOperacionalService") +public class EsquemaOperacionalServiceImpl implements EsquemaOperacionalService { + + @Autowired + private EsquemaOperacionalDAO esquemaOperacionalDAO; + + public List obtenerTodos() { + return esquemaOperacionalDAO.obtenerTodos(); + } + + public EsquemaOperacional obtenerID(Integer id) { + return esquemaOperacionalDAO.obtenerID(id); + } + + @Transactional + public EsquemaOperacional suscribir(EsquemaOperacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaOperacionalDAO.suscribir(entidad); + } + + @Transactional + public EsquemaOperacional actualizacion(EsquemaOperacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaOperacionalDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EsquemaOperacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaOperacionalDAO.actualizacion(entidad); + } + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao) { + return esquemaOperacionalDAO.dentroVigenciaEsquemaOperacional(dataGeracao); + } + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte) { + return esquemaOperacionalDAO.dentroVigenciaEsquemaOperacional(dataDe, dataAte); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaTramoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaTramoServiceImpl.java new file mode 100644 index 000000000..3d9cac67f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EsquemaTramoServiceImpl.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EsquemaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import com.rjconsultores.ventaboletos.service.EsquemaTramoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("esquemaTramoService") +public class EsquemaTramoServiceImpl implements EsquemaTramoService { + + @Autowired + private EsquemaTramoDAO esquemaTramoDAO; + + public List obtenerTodos() { + return esquemaTramoDAO.obtenerTodos(); + } + + public EsquemaTramo obtenerID(Integer id) { + return esquemaTramoDAO.obtenerID(id); + } + + @Transactional + public EsquemaTramo suscribir(EsquemaTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaTramoDAO.suscribir(entidad); + } + + @Transactional + public EsquemaTramo actualizacion(EsquemaTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaTramoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EsquemaTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaTramoDAO.actualizacion(entidad); + } + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec) { + return esquemaTramoDAO.obtenerPorEsquemaCorrida(ec); + } + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec) { + return esquemaTramoDAO.obtenerPorEsquemaCorridaOrderNumSec(ec); + } + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + return esquemaTramoDAO.obtenerAtivosDesativosPorEsquemaCorrida(esquemaCorrida); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java new file mode 100644 index 000000000..09d7d5878 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java @@ -0,0 +1,206 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.dao.EstacionDAO; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AutorizaFolioService; +import com.rjconsultores.ventaboletos.service.EstacionService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("estacionService") +public class EstacionServiceImpl implements EstacionService { + + @Autowired + private EstacionDAO estacionDAO; + + @Autowired + private AutorizaFolioService autorizaFolioService; + + public static final String BEMATECH_FISCAL = "BEMATECHFISCAL"; + + public List obtenerTodos() { + return estacionDAO.obtenerTodos(); + } + + public Estacion obtenerID(Integer id) { + return estacionDAO.obtenerID(id); + } + + @Transactional(rollbackFor = BusinessException.class) + public Estacion suscribirActualizar(Estacion estacion) throws BusinessException { + String nomeEstacao = ""; + Long numeroCaixa = 0l; + + validarEstoqueUpdate(estacion); + + Boolean esMacDuplicado = Boolean.FALSE; + List lsEstacionMac = estacionDAO.buscar(estacion.getDescmac()); + if (!lsEstacionMac.isEmpty()) { + for (Estacion est : lsEstacionMac) { + if (!est.getEstacionId().equals(estacion.getEstacionId())) { + nomeEstacao = est.getDescestacion(); + numeroCaixa = est.getNumcaja(); + esMacDuplicado = Boolean.TRUE; + } + } + } + if (esMacDuplicado) { + throw new BusinessException(Labels.getLabel("estacionServiceImpl.msg.macDuplicado") + "\n" + + Labels.getLabel("estacionServiceImpl.msg.macDuplicado.descricaoEstacao") + nomeEstacao + "\n" + + Labels.getLabel("estacionServiceImpl.msg.macDuplicado.numeroCaixa") + numeroCaixa, Boolean.TRUE); + } + + boolean esCajaDuplicado = false; + List lsEstacion = estacionDAO.buscar(estacion.getNumcaja(), estacion.getPuntoVenta()); + + if (!lsEstacion.isEmpty()) { + if (estacion.getEstacionId() == null) { + esCajaDuplicado = true; + } else { + esCajaDuplicado = !lsEstacion.get(0).getEstacionId().equals(estacion.getEstacionId()); + } + } + + if (esCajaDuplicado) { + throw new BusinessException("estacionServiceImpl.msg.cajaDuplicado"); + } + + estacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + estacion.setFecmodif(Calendar.getInstance().getTime()); + estacion.setActivo(Boolean.TRUE); + + boolean isNuevaFiscal = validacionNuevaImpressoraFiscal(estacion); + + if (estacion.getEstacionId() == null) { + estacion = estacionDAO.suscribir(estacion); + } else { + estacion = estacionDAO.actualizacion(estacion); + } + + String errorNoChequeFolio = null; + for (EstacionImpresora ei : estacion.getLsEstacionImpresora()) { + if (ApplicationProperties.getInstance().generarRotinaFolios()) + errorNoChequeFolio = autorizaFolioService.noChequeFolioPreimpresos(ei, false); + + if (validacionImpressoraFiscal(ei) && isNuevaFiscal) + errorNoChequeFolio = autorizaFolioService.noChequeFolioPreimpresos(ei, true); + } + + if (StringUtils.isNotBlank(errorNoChequeFolio)) { + throw new BusinessException(errorNoChequeFolio); + } + + return estacion; + } + + private boolean validacionNuevaImpressoraFiscal(final Estacion e) { + for (EstacionImpresora ei : e.getLsEstacionImpresora()) { + if (ei.getNombImpresora().equalsIgnoreCase(BEMATECH_FISCAL) && ei.getEstacionImpresoraId() == null) + return true; + } + return false; + } + + private boolean validacionImpressoraFiscal(final EstacionImpresora ei) { + if (ei.getNombImpresora().equalsIgnoreCase(BEMATECH_FISCAL)) + return true; + else + return false; + } + + @Override + public void devolverFoliosAutomaticosImpressoraFiscal(final EstacionImpresora ei) { + + if (ei.getNombImpresora().equalsIgnoreCase(BEMATECH_FISCAL)) { + autorizaFolioService.devolverFoliosAutomaticosImpressoraFiscal(ei); + } + } + + private void validarEstoqueUpdate(Estacion estacion) throws BusinessException { + + if (estacion.getEstacionId() == null) { + return; + } + + if (!ApplicationProperties.getInstance().generarRotinaFolios()) { + Estacion estacionPuntoVentaAnterior = estacionDAO.obtenerID(estacion.getEstacionId()); + if (estacionPuntoVentaAnterior.getPuntoVenta() != null) + if (!estacionPuntoVentaAnterior.getPuntoVenta().equals(estacion.getPuntoVenta())) { + if (estacionDAO.temEstoque(estacionPuntoVentaAnterior.getPuntoVenta(), estacion)) { + throw new BusinessException("estacionServiceImpl.msg.hayStock"); + } + } + } + } + + private void validarEstoqueBorrar(Estacion estacion) throws BusinessException { + if (!ApplicationProperties.getInstance().generarRotinaFolios()) { + if (estacionDAO.temEstoque(estacion.getPuntoVenta(), estacion)) { + throw new BusinessException("estacionServiceImpl.msg.hayStock.borrar"); + } + } + } + + @Transactional + public void borrar(Estacion entidad) throws BusinessException { + + validarEstoqueBorrar(entidad); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + if (entidad.getEstacionSitefList() != null) { + for (EstacionSitef es : entidad.getEstacionSitefList()) { + es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + es.setFecmodif(Calendar.getInstance().getTime()); + es.setActivo(Boolean.FALSE); + } + } + + estacionDAO.actualizacion(entidad); + } + + public List buscar(String descEstacion, String descMac, Long nunCaja, PuntoVenta pv) { + return estacionDAO.buscar(descEstacion, descMac, nunCaja, pv); + } + + public List buscar(String descMac) { + return estacionDAO.buscar(descMac); + } + + @Override + public Long getDecimalMAC(String mac) { + mac = mac.trim(); + mac = mac.replace("-", ""); + return Long.parseLong(mac, 16); + } + + @Override + public List buscarEstaciones(PuntoVenta puntoVenta) { + List estaciones = estacionDAO.buscarEstaciones(puntoVenta); + return estaciones; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java new file mode 100644 index 000000000..93479b556 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java @@ -0,0 +1,88 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CiudadDAO; +import com.rjconsultores.ventaboletos.dao.EstadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; +import com.rjconsultores.ventaboletos.service.EstadoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author MCosso + */ +@Service("estadoService") +public class EstadoServiceImpl implements EstadoService { + + @Autowired + private EstadoDAO estadoDAO; + @Autowired + private CiudadDAO ciudadDAO; + + public List obtenerTodos() { + return estadoDAO.obtenerTodos(); + } + + public Estado obtenerID(Integer id) { + return estadoDAO.obtenerID(id); + } + + @Transactional + public Estado suscribir(Estado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return estadoDAO.suscribir(entidad); + } + + @Transactional + public Estado actualizacion(Estado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return estadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Estado entidad) throws RegistroConDependenciaException { + + if (ciudadDAO.count("estado", entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + estadoDAO.actualizacion(entidad); + } + + public List buscar(String nombestado, Pais pais) { + return estadoDAO.buscar(nombestado, pais); + } + + public List buscarNotInEmpresaImposto(Empresa empresa) { + return estadoDAO.buscarNotInEmpresaImposto(empresa); + + } + + @Override + public List buscarCveEstado(String cveEstado) { + return estadoDAO.buscarCveEstado(cveEstado); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EventoExtraServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EventoExtraServiceImpl.java new file mode 100644 index 000000000..235d1eaa3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/EventoExtraServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.service.EventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("eventoExtraService") +public class EventoExtraServiceImpl implements EventoExtraService { + + @Autowired + private EventoExtraDAO eventoExtraDAO; + + public List obtenerTodos() { + return eventoExtraDAO.obtenerTodos(); + } + + public EventoExtra obtenerID(Integer id) { + return eventoExtraDAO.obtenerID(id); + } + + @Transactional + public EventoExtra suscribir(EventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return eventoExtraDAO.suscribir(entidad); + } + + @Transactional + public EventoExtra actualizacion(EventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return eventoExtraDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + eventoExtraDAO.actualizacion(entidad); + } + + @Transactional + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra){ + return eventoExtraDAO.obtenerPorTipo(tipoEventoExtra); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java new file mode 100644 index 000000000..22c907565 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java @@ -0,0 +1,85 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ExcepcionPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; +import com.rjconsultores.ventaboletos.service.ExcepcionPeajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("excepcionPeajeService") +public class ExcepcionPeajeServiceImpl implements ExcepcionPeajeService { + + @Autowired + private ExcepcionPeajeDAO excepcionPeajeDAO; + + public ExcepcionPeaje obtenerID(Integer id) { + return excepcionPeajeDAO.obtenerID(id); + } + + public List obtenerTodos() { + return excepcionPeajeDAO.obtenerTodos(); + } + + public List buscar(String descconvenio, String cveconvenio){ + return new ArrayList(); + } + + @Transactional + public ExcepcionPeaje suscribir(ExcepcionPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return excepcionPeajeDAO.suscribir(entidad); + } + + @Transactional + public ExcepcionPeaje actualizacion(ExcepcionPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return excepcionPeajeDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ExcepcionPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + +// for (ConvenioDet cd : entidad.getConvenioDetList()) { +// cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// cd.setFecmodif(Calendar.getInstance().getTime()); +// cd.setActivo(Boolean.FALSE); +// } +// +// for (ConvenioPuntoVenta cpv: entidad.getConvenioPuntoVentaList()) { +// cpv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// cpv.setFecmodif(Calendar.getInstance().getTime()); +// cpv.setActivo(Boolean.FALSE); +// } +// +// for (ConvenioUsuario cu : entidad.getConvenioUsuarioList()) { +// cu.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// cu.setFecmodif(Calendar.getInstance().getTime()); +// cu.setActivo(Boolean.FALSE); +// } +// +// for (ConvenioTramo ct : entidad.getConvenioTramoList()) { +// ct.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// ct.setFecmodif(Calendar.getInstance().getTime()); +// ct.setActivo(Boolean.FALSE); +// } + + excepcionPeajeDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionRedondoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionRedondoServiceImpl.java new file mode 100644 index 000000000..293f9091d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionRedondoServiceImpl.java @@ -0,0 +1,88 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ExcepcionRedondoDAO; +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ExcepcionRedondoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("excepcionRedondoService") +public class ExcepcionRedondoServiceImpl implements ExcepcionRedondoService { + + @Autowired + private ExcepcionRedondoDAO excepcionRedondoDAO; + + public List obtenerTodos() { + return excepcionRedondoDAO.obtenerTodos(); + } + + public ExcepcionRedondo obtenerID(Integer id) { + return excepcionRedondoDAO.obtenerID(id); + } + + @Transactional(rollbackFor=BusinessException.class) + public ExcepcionRedondo suscribirActualizar(ExcepcionRedondo entidad) throws BusinessException { + + if (entidad.getOrigem().getParadaId().equals(entidad.getDestino().getParadaId())) { + throw new BusinessException("MSG.Origem.Igual.Destino"); + } + + + List lsExcepciones = excepcionRedondoDAO.buscar(entidad.getOrigem(), entidad.getDestino()); + boolean podeSavar = false; + if (lsExcepciones.isEmpty()) { + podeSavar = true; + } else { + if (entidad.getExcepcionredondoId() != null) { + for (ExcepcionRedondo er : lsExcepciones) { + if (entidad.getExcepcionredondoId().equals(er.getExcepcionredondoId())) { + podeSavar = true; + } + } + } + } + + if (!podeSavar) { + throw new BusinessException("MSG.Registro.Existe"); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getExcepcionredondoId() == null) { + return excepcionRedondoDAO.suscribir(entidad); + } else { + return excepcionRedondoDAO.actualizacion(entidad); + } + + } + + + @Transactional + public void borrar(ExcepcionRedondo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + excepcionRedondoDAO.actualizacion(entidad); + } + + public List buscar(String indTipo, Parada origem, Parada destino) { + return excepcionRedondoDAO.buscar(indTipo, origem, destino); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamgeralServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamgeralServiceImpl.java new file mode 100644 index 000000000..0e48fc923 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamgeralServiceImpl.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamgeralDAO; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; +import com.rjconsultores.ventaboletos.service.FechamentoParamgeralService; + +@Service("fechamentoParamgeralService") +public class FechamentoParamgeralServiceImpl implements FechamentoParamgeralService { + + @Autowired + private FechamentoParamgeralDAO fechamentoParamgeralDAO; + + @Override + public List obtenerTodos() { + return fechamentoParamgeralDAO.obtenerTodos(); + } + + @Override + public FechamentoParamgeral obtenerID(Long id) { + return fechamentoParamgeralDAO.obtenerID(id); + } + + @Override + @Transactional + public FechamentoParamgeral suscribir(FechamentoParamgeral entidad) { + return fechamentoParamgeralDAO.suscribir(entidad); + } + + @Override + @Transactional + public FechamentoParamgeral actualizacion(FechamentoParamgeral entidad) { + return fechamentoParamgeralDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(FechamentoParamgeral entidad) { + fechamentoParamgeralDAO.borrar(entidad); + } + + + public Long count(String campo, Object o) { + return fechamentoParamgeralDAO.count(campo, o); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + return fechamentoParamgeralDAO.buscaParametrosPorEmpresas(empresasId); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresasId) { + return fechamentoParamgeralDAO.buscaParametrosPorEmpresa(empresasId); + } + + @Override + @Transactional + public FechamentoParamgeral suscribirOrActualizacion(FechamentoParamgeral fechamentoParamgeral) { + if(fechamentoParamgeral != null && fechamentoParamgeral.getFechamentoparamgeralId() == null) { + return suscribir(fechamentoParamgeral); + } else if(fechamentoParamgeral != null && fechamentoParamgeral.getFechamentoparamgeralId() != null) { + return actualizacion(fechamentoParamgeral); + } + return null; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java new file mode 100644 index 000000000..2744e4936 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java @@ -0,0 +1,79 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.FechamentoParamptovtaService; + +@Service("fechamentoParamptovtaService") +public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaService { + + @Autowired + private FechamentoParamptovtaDAO fechamentoParamptovtaDAO; + + @Override + public List obtenerTodos() { + return fechamentoParamptovtaDAO.obtenerTodos(); + } + + @Override + public FechamentoParamptovta obtenerID(Long id) { + return fechamentoParamptovtaDAO.obtenerID(id); + } + + @Override + @Transactional + public FechamentoParamptovta suscribir(FechamentoParamptovta entidad) { + return fechamentoParamptovtaDAO.suscribir(entidad); + } + + @Override + @Transactional + public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) { + return fechamentoParamptovtaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(FechamentoParamptovta entidad) { + fechamentoParamptovtaDAO.borrar(entidad); + } + + + public Long count(String campo, Object o) { + return fechamentoParamptovtaDAO.count(campo, o); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + return fechamentoParamptovtaDAO.buscaParametrosPorEmpresas(empresasId); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresasId) { + return fechamentoParamptovtaDAO.buscaParametrosPorEmpresa(empresasId); + } + + @Override + @Transactional + public FechamentoParamptovta suscribirOrActualizacion(FechamentoParamptovta FechamentoParamptovta) { + if(FechamentoParamptovta != null && FechamentoParamptovta.getFechamentoparamptovtaId() == null) { + return suscribir(FechamentoParamptovta); + } else if(FechamentoParamptovta != null && FechamentoParamptovta.getFechamentoparamptovtaId() != null) { + return actualizacion(FechamentoParamptovta); + } + return null; + } + + @Override + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa) { + List params = fechamentoParamptovtaDAO.buscaParametrosPorPuntoventa(puntoventa); + return params; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FeriadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FeriadoServiceImpl.java new file mode 100644 index 000000000..103a67e53 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FeriadoServiceImpl.java @@ -0,0 +1,67 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.sql.Date; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FeriadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; +import com.rjconsultores.ventaboletos.service.FeriadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("feriadoService") +public class FeriadoServiceImpl implements FeriadoService { + + @Autowired + private FeriadoDAO feriadoDAO; + + public List obtenerTodos() { + return feriadoDAO.obtenerTodos(); + } + + public Feriado obtenerID(Integer id) { + return feriadoDAO.obtenerID(id); + } + + @Transactional + public Feriado suscribir(Feriado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return feriadoDAO.suscribir(entidad); + } + + @Transactional + public Feriado actualizacion(Feriado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return feriadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Feriado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + feriadoDAO.actualizacion(entidad); + } + + public List buscar(Date fecferiado) { + return feriadoDAO.buscar(fecferiado); + } + + @Override + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado) { + return feriadoDAO.buscarDataEmpresaEstado(data, empresa, estado); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalAliquotaEmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalAliquotaEmpresaServiceImpl.java new file mode 100644 index 000000000..8436c1245 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalAliquotaEmpresaServiceImpl.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FiscalAliquotaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; +import com.rjconsultores.ventaboletos.service.FiscalAliquotaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("fiscalAliquotaEmpresa") +public class FiscalAliquotaEmpresaServiceImpl implements FiscalAliquotaEmpresaService { + + @Autowired + private FiscalAliquotaEmpresaDAO fiscalAliquotaEmpresaDAO; + + public List obtenerTodos() { + return fiscalAliquotaEmpresaDAO.obtenerTodos(); + } + + public FiscalAliquotaEmpresa obtenerID(Integer id) { + return fiscalAliquotaEmpresaDAO.obtenerID(id); + } + + @Transactional + public FiscalAliquotaEmpresa suscribirActualizar(FiscalAliquotaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getFiscalAliquotaEmpresaId() == null) { + return fiscalAliquotaEmpresaDAO.suscribir(entidad); + } + return fiscalAliquotaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FiscalAliquotaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + fiscalAliquotaEmpresaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraServiceImpl.java new file mode 100644 index 000000000..c1fe9fb43 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraServiceImpl.java @@ -0,0 +1,207 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FiscalImpressoraDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.FiscalImpressoraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("fiscalImpressoraService") +public class FiscalImpressoraServiceImpl implements FiscalImpressoraService { + + public enum TipoTotalizadorNaoFiscal { + + CancImpPost(false), + CartaoCredDeb(false), + CanPassagem(false), + VendaManual(false), + ImpressaoPost(false), + SeguroOpcional(true), + CancSeguroOpcional(true), + Multa(true), + DiferencaMaior(true), + DiferencaMenor(true), + CUSTOM(true); + + private final boolean temEE; + private TipoTotalizadorNaoFiscal(boolean pTemEE) { temEE = pTemEE; } + public boolean isTemEE() { + return temEE; + } + } + + public enum TipoFormaPagamento { + TotalCartao, + PtaAtendido, + TrocaPassagem, + Gratuidade, + CUSTOM; + } + + + @Autowired + FiscalImpressoraDAO fiscalImpressoraDAO; + + @Override + public List obtenerTodos() { + return fiscalImpressoraDAO.obtenerTodos(); + } + + @Override + public FiscalImpressora obtenerID(Integer id) { + return fiscalImpressoraDAO.obtenerID(id); + } + + @Override + @Transactional + public FiscalImpressora suscribir(FiscalImpressora entidad) { + return fiscalImpressoraDAO.suscribir(entidad); + } + + @Override + @Transactional + public FiscalImpressora actualizacion(FiscalImpressora entidad) { + return fiscalImpressoraDAO.actualizacion(entidad); + } + + @Override + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId) { + return fiscalImpressoraDAO.buscarTotsNaoFiscaisEmpresa(empresaEcfId); + } + + @Override + public List buscarFormaPagoEmpresa(Integer empresaEcfId) { + return fiscalImpressoraDAO.buscarFormaPagoEmpresa(empresaEcfId); + } + + @Override + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId) { + return fiscalImpressoraDAO.buscarItensRelgerencialEmpresa(empresaEcfId); + } + + @Override + public List obtenerTodosTotnaofiscalEmpresa() { + return fiscalImpressoraDAO.obtenerTodosTotnaofiscalEmpresa(); + } + + @Override + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id) { + return fiscalImpressoraDAO.obtenerIDTotnaofiscalEmpresa(id); + } + + @Override + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa totnaofiscalEmpresa) { + totnaofiscalEmpresa.setActivo(false); + totnaofiscalEmpresa.setFecmodif(Calendar.getInstance().getTime()); + totnaofiscalEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + fiscalImpressoraDAO.borrarTotnaofiscalEmpresa(totnaofiscalEmpresa); + } + + @Override + public FiscalTotnaofiscalEmpresa suscribirActualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) throws BusinessException { + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + + FiscalTotnaofiscalEmpresa item = null; + + if (!TipoTotalizadorNaoFiscal.CUSTOM.toString().equals(entidad.getTipototalizador())){ + item = fiscalImpressoraDAO.buscarTotNaoFiscal(entidad.getEmpresa(), entidad.getTipototalizador()); + }else{ + item = fiscalImpressoraDAO.buscarTotNaoFiscal(entidad.getEmpresa(), entidad.getTipototalizador(),entidad.getDescricao()); + } + + if ( (entidad.getFiscaltotnaofiscalId() == null) && (item != null) ){ + throw new BusinessException("editarTotnaofiscalEmpresaController.MSG.erroTipoTotalizador"); + } + + if ( (entidad.getFiscaltotnaofiscalId() != null) && (item != null) && (!item.getFiscaltotnaofiscalId().equals(entidad.getFiscaltotnaofiscalId())) ){ + throw new BusinessException("editarTotnaofiscalEmpresaController.MSG.erroTipoTotalizador"); + } + if (entidad.getFiscaltotnaofiscalId() == null){ + return fiscalImpressoraDAO.suscribirTotnaofiscalEmpresa(entidad); + }else{ + return fiscalImpressoraDAO.actualizarTotnaofiscalEmpresa(entidad); + } + } + + @Override + public List obtenerTodosFormapagoEmpresa() { + return fiscalImpressoraDAO.obtenerTodosFormapagoEmpresa(); + } + + @Override + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id) { + return fiscalImpressoraDAO.obtenerIDFormapagoEmpresa(id); + } + + @Override + public FiscalFormapagoEmpresa suscribirActualizarFormapagoEmpresa(FiscalFormapagoEmpresa entidad) throws BusinessException { + + FiscalFormapagoEmpresa item = null; + + if (!TipoFormaPagamento.CUSTOM.toString().equals(entidad.getTipoformapago())){ + item = fiscalImpressoraDAO.buscarFormaPago(entidad.getEmpresa(), entidad.getTipoformapago()); + }else{ + item = fiscalImpressoraDAO.buscarFormaPago(entidad.getEmpresa(), entidad.getTipoformapago(),entidad.getDescricao()); + } + + if ( (entidad.getFiscalformapagoempresaId() == null) && (item != null) ){ + throw new BusinessException("editarFormapagoEmpresaController.MSG.erroTipoFormaPago"); + } + + if ( (entidad.getFiscalformapagoempresaId() != null) && (item != null) && (!item.getFiscalformapagoempresaId().equals(entidad.getFiscalformapagoempresaId())) ){ + throw new BusinessException("editarFormapagoEmpresaController.MSG.erroTipoFormaPago"); + } + + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + if (entidad.getFiscalformapagoempresaId() == null){ + return fiscalImpressoraDAO.suscribirFormapagoEmpresa(entidad); + }else{ + return fiscalImpressoraDAO.actualizacionFormapagoEmpresa(entidad); + } + } + + @Override + public FiscalFormapagoEmpresa borrarFormapagoEmpresa(FiscalFormapagoEmpresa entidad) { + entidad.setActivo(false); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return fiscalImpressoraDAO.actualizacionFormapagoEmpresa(entidad); + } + + @Override + public List obtenerTodosRelgerencialEmpresa() { + return fiscalImpressoraDAO.obtenerTodosRelgerencialEmpresa(); + } + + @Override + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id) { + return fiscalImpressoraDAO.obtenerIDRelgerencialEmpresa(id); + } + + @Override + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + return fiscalImpressoraDAO.suscribirRelgerencialEmpresa(entidad); + } + + @Override + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + return fiscalImpressoraDAO.actualizacionRelgerencialEmpresa(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java new file mode 100644 index 000000000..b86bcd17b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java @@ -0,0 +1,771 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FiscalDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.service.FiscalService; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionECF; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionECFManual; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionECFReducaoZ; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionNaoFiscal; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionReducaoZ; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorNaoFiscalVO; + +@Service("fiscalService") +public class FiscalServiceImpl implements FiscalService { + + private static Logger log = Logger.getLogger(FiscalServiceImpl.class); + public static final String DATE_FORMAT_FISCAL = "yyyyMMdd"; + public static final BigDecimal CEM = BigDecimal.valueOf(100); + public static final String QUEBRA_LINHA = "\r\n"; + + private List lsTipoEventoExtra; + + @Autowired + private TipoEventoExtraService tipoEventoExtraService; + + @Autowired + private FiscalDAO fiscalDAO; + + @Autowired + private DataSource dataSourceRead; + + @Override + @Transactional + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte) { + return fiscalDAO.gerarRegistroP2_F2(lsEsquemaCorrida, dataDe, dataAte); + } + + @Override + public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa) { + + Connection connection = null; + try { + connection = getConnection(); + + List list = fiscalDAO.buscaDatosFiscaisECFManual(inicio, fim, empresa.getEmpresaId(), connection); + return new ArchivoIntegracionECFManual().importacionFiscalECFManual(inicio, fim, empresa, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalReducaoZPendencia(Date inicio, Date fim, Empresa empresa) { + + Connection connection = null; + try { + connection = getConnection(); + + List list = fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), true, connection); + return new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, true, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa) { + + Connection connection = null; + try { + connection = getConnection(); + + List list = fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), false, connection); + return new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, false, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalECFPendencias(Date inicio, Date fim, Empresa empresa) { + Connection connection = null; + try { + connection = getConnection(); + + List list = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), false, false, true, connection); + return new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, false, false, true, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalECFCancelados(Date inicio, Date fim, Empresa empresa) { + Connection connection = null; + try { + connection = getConnection(); + + List list = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), false, true, false, connection); + return new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, false, true, false, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public HashMap importacionFiscalECFValidaReducaoZ(Date inicio, Date fim, Empresa empresa) { + + Connection connection = null; + try { + connection = getConnection(); + + List listEcf = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), true, false, false, connection); + + List listRedZ = fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), false, connection); + + ArchivoIntegracionECFReducaoZ ecfRedZ = new ArchivoIntegracionECFReducaoZ(); + ecfRedZ.importacionFiscalECFValidaReducaoZ(listEcf, listRedZ); + + List files = new ArrayList(); + files.add(new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, true, false, false, ecfRedZ.getListEcfValidos())); + files.add(new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, false, ecfRedZ.getListRedZValidos())); + + files.add(new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, false, false, true, ecfRedZ.getListEcfInvalidos())); + files.add(new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, true, ecfRedZ.getListRedZInvalidos())); + + HashMap result = new HashMap(); + result.put("arquivos", files); + result.put("ecfInvalidos", ecfRedZ.getListEcfInvalidos()); + result.put("redZInvalido", ecfRedZ.getListRedZInvalidos()); + + return result; + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + + return null; + } + + @Override + public File importacionFiscalECF(Date inicio, Date fim, Empresa empresa) { + Connection connection = null; + try { + connection = getConnection(); + + List list = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), true, false, false, connection); + return new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, true, false, false, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa) { + Connection connection = null; + try { + connection = getConnection(); + + List importacionNaoFiscalVOs = fiscalDAO.buscaDatosNaoFiscais(inicio, fim, empresa.getEmpresaId(), connection); + + return new ArchivoIntegracionNaoFiscal().gerarArquivo(empresa.getCnpj(), importacionNaoFiscalVOs); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + private Connection getConnection() { + return DataSourceUtils.getConnection(dataSourceRead); + } + + @Override + public File importacionFiscalECFXls(Empresa empresa, File arquivoTxt) { + return gerarArquivoEcfXlsGenerico(empresa, arquivoTxt); + } + + @Override + public File importacionFiscalReducaoZXls(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosReducaoZ(empresa, arquivoTxt); + return gerarArquivoReducaoZXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private List carregarRegistrosReducaoZ(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorFiscalReducaoZVO leitorFiscalReducaoZ = null; + int indice = -1; + if (linha.startsWith("1")) { + leitorFiscalReducaoZ = new LeitorFiscalReducaoZVO(); + leitorFiscalReducaoZ.setEmpresaId(empresa.getEmpresaId()); + leitorFiscalReducaoZ.setNombempresa(empresa.getNombempresa()); + leitorFiscalReducaoZ.setDatamov(linha.substring(1, 9).trim()); + leitorFiscalReducaoZ.setCnpj(linha.substring(9, 23).trim()); + leitorFiscalReducaoZ.setAliquota(BigDecimalUtil.getStringToBigDecimal(linha.substring(196, 210).trim(), 2, LocaleUtil.getLocale())); + + if (registros.contains(leitorFiscalReducaoZ)) { + indice = registros.indexOf(leitorFiscalReducaoZ); + leitorFiscalReducaoZ = registros.get(indice); + } + + leitorFiscalReducaoZ.setImposto(leitorFiscalReducaoZ.getImposto().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(272, 285).trim(), 2, LocaleUtil.getLocale()))); + leitorFiscalReducaoZ.setValorNaoTributado(leitorFiscalReducaoZ.getValorNaoTributado().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(182, 196).trim(), 2, LocaleUtil.getLocale()))); + leitorFiscalReducaoZ.setVendabrutadiaria(leitorFiscalReducaoZ.getVendabrutadiaria().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(126, 140).trim(), 2, LocaleUtil.getLocale()))); + + linha = br.readLine(); + } else { + linha = br.readLine(); + } + + if (leitorFiscalReducaoZ != null && indice > -1) { + registros.set(indice, leitorFiscalReducaoZ); + } else if (leitorFiscalReducaoZ != null) { + registros.add(leitorFiscalReducaoZ); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private File gerarArquivoReducaoZXls(List registros, String nomeArquivo) throws IOException { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_MOVIMENTO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("CNPJ"); + row.createCell(3).setCellValue("VENDA_BRUTA_DIARIA"); + row.createCell(4).setCellValue("VALOR_NAO_TRIBUTADO"); + row.createCell(5).setCellValue("ALIQUOTA"); + row.createCell(6).setCellValue("VALOR_ICMS"); + + for (LeitorFiscalReducaoZVO leitorFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorFiscal.getDatamov()); + row.createCell(1).setCellValue(leitorFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorFiscal.getCnpj()); + row.createCell(3).setCellValue(leitorFiscal.getVendabrutadiaria().doubleValue()); + row.createCell(4).setCellValue(leitorFiscal.getValorNaoTributado().doubleValue()); + row.createCell(5).setCellValue(leitorFiscal.getAliquota().doubleValue()); + row.createCell(6).setCellValue(leitorFiscal.getImposto().doubleValue()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + } + + @Override + public File importacionFiscalECFManualXls(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosManualFiscal(empresa, arquivoTxt); + return gerarArquivoEcfManualXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private File gerarArquivoEcfManualXls(List registros, String nomeArquivo) throws Exception { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_EMISSAO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("UF_ORIGEM"); + row.createCell(3).setCellValue("UF_DESTINO"); + row.createCell(4).setCellValue("CLASSE"); + row.createCell(5).setCellValue("STATUS"); + row.createCell(6).setCellValue("TARIFA"); + row.createCell(7).setCellValue("TX_EMBARQUE"); + row.createCell(8).setCellValue("PEDAGIO"); + row.createCell(9).setCellValue("SEGURO"); + row.createCell(10).setCellValue("TOTAL"); + row.createCell(11).setCellValue("ALIQUOTA"); + row.createCell(12).setCellValue("VALOR_ICMS"); + row.createCell(13).setCellValue("QTDE"); + + for (LeitorManualFiscalVO leitorFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorFiscal.getDataEmissao()); + row.createCell(1).setCellValue(leitorFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorFiscal.getOrigenUf()); + row.createCell(3).setCellValue(leitorFiscal.getDestinoUf()); + row.createCell(4).setCellValue(leitorFiscal.getClaseServicio()); + row.createCell(5).setCellValue(leitorFiscal.getStatus()); + row.createCell(6).setCellValue(leitorFiscal.getValorItem().doubleValue()); + row.createCell(7).setCellValue(leitorFiscal.getImportetaxaembarque().doubleValue()); + row.createCell(8).setCellValue(leitorFiscal.getImportepedagio().doubleValue()); + row.createCell(9).setCellValue(leitorFiscal.getImporteseguro().doubleValue()); + row.createCell(10).setCellValue(leitorFiscal.getValorTotal().doubleValue()); + row.createCell(11).setCellValue(leitorFiscal.getIcms().doubleValue()); + row.createCell(12).setCellValue(leitorFiscal.getValorIcms().doubleValue()); + row.createCell(13).setCellValue(leitorFiscal.getQtdeItens()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + } + + @Override + public File importacionNaoFiscalXls(Empresa empresa, File arquivoTxt) { + return gerarArquivoNaoFiscalXls(empresa, arquivoTxt); + } + + @Override + public File importacionFiscalECFCanceladosXls(Empresa empresa, File arquivoTxt) { + return gerarArquivoEcfXlsGenerico(empresa, arquivoTxt); + } + + private File gerarArquivoNaoFiscalXls(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosNaoFiscais(empresa, arquivoTxt); + return gerarArquivoNaoFiscaisXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private File gerarArquivoEcfXlsGenerico(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosEcf(empresa, arquivoTxt); + return gerarArquivoEcfXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private File gerarArquivoEcfXls(List registros, String nomeArquivo) throws IOException { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_EMISSAO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("UF_ORIGEM"); + row.createCell(3).setCellValue("UF_DESTINO"); + row.createCell(4).setCellValue("CLASSE"); + row.createCell(5).setCellValue("MOTIVO_CANCELAMENTO"); + row.createCell(6).setCellValue("TARIFA"); + row.createCell(7).setCellValue("TX_EMBARQUE"); + row.createCell(8).setCellValue("PEDAGIO"); + row.createCell(9).setCellValue("SEGURO"); + row.createCell(10).setCellValue("MULTA"); + row.createCell(11).setCellValue("TOTAL"); + row.createCell(12).setCellValue("ALIQUOTA_ICMS"); + row.createCell(13).setCellValue("VALOR_ICMS"); + row.createCell(14).setCellValue("QTDE"); + + for (LeitorFiscalVO leitorFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorFiscal.getDataEmissao()); + row.createCell(1).setCellValue(leitorFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorFiscal.getOrigenUf()); + row.createCell(3).setCellValue(leitorFiscal.getDestinoUf()); + row.createCell(4).setCellValue(leitorFiscal.getClaseServicio()); + row.createCell(5).setCellValue(leitorFiscal.getDescmotivocancelamento()); + row.createCell(6).setCellValue(leitorFiscal.getValorTarifa().doubleValue()); + row.createCell(7).setCellValue(leitorFiscal.getValorEmbarque().doubleValue()); + row.createCell(8).setCellValue(leitorFiscal.getValorPedagio().doubleValue()); + row.createCell(9).setCellValue(leitorFiscal.getValorSeguro().doubleValue()); + row.createCell(10).setCellValue(leitorFiscal.getValorMulta().doubleValue()); + row.createCell(11).setCellValue(leitorFiscal.getTotal().doubleValue()); + row.createCell(12).setCellValue(leitorFiscal.getAliquota().doubleValue()); + row.createCell(13).setCellValue(leitorFiscal.getValorIcms().doubleValue()); + row.createCell(14).setCellValue(leitorFiscal.getQtdeItens()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + + } + + private List carregarRegistrosEcf(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorFiscalVO leitorFiscal = null; + int indice = -1; + if (linha.startsWith("1")) { + leitorFiscal = new LeitorFiscalVO(); + leitorFiscal.setEmpresaId(empresa.getEmpresaId()); + leitorFiscal.setNombempresa(empresa.getNombempresa()); + leitorFiscal.setDataEmissao(linha.substring(1, 9).trim()); + leitorFiscal.setOrigenUf(linha.substring(177, 179).trim()); + leitorFiscal.setDestinoUf(linha.substring(184, 186).trim()); + leitorFiscal.setClaseServicio(linha.substring(226, 256).trim()); + leitorFiscal.setDescmotivocancelamento(linha.substring(192, 212).trim()); + leitorFiscal.setAliquota(BigDecimalUtil.getStringToBigDecimal(linha.substring(79, 93).trim(), 2, LocaleUtil.getLocale())); + + if (registros.contains(leitorFiscal)) { + indice = registros.indexOf(leitorFiscal); + leitorFiscal = registros.get(indice); + } + + leitorFiscal.setQtdeItens(leitorFiscal.getQtdeItens() + 1); + linha = br.readLine(); + while (linha != null && linha.startsWith("2")) { + if (linha.indexOf("TA") >= 0) { + leitorFiscal.setValorTarifa(leitorFiscal.getValorTarifa().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("TX") >= 0) { + leitorFiscal.setValorEmbarque(leitorFiscal.getValorEmbarque().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("PE") >= 0) { + leitorFiscal.setValorPedagio(leitorFiscal.getValorPedagio().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("SE") >= 0) { + leitorFiscal.setValorSeguro(leitorFiscal.getValorSeguro().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + linha = br.readLine(); + } + } else { + linha = br.readLine(); + } + + if (leitorFiscal != null && indice > -1) { + registros.set(indice, leitorFiscal); + } else if (leitorFiscal != null) { + registros.add(leitorFiscal); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private List carregarRegistrosManualFiscal(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorManualFiscalVO leitorManualFiscal = null; + int indice = -1; + if (linha.startsWith("1")) { + leitorManualFiscal = new LeitorManualFiscalVO(); + leitorManualFiscal.setEmpresaId(empresa.getEmpresaId()); + leitorManualFiscal.setNombempresa(empresa.getNombempresa()); + leitorManualFiscal.setDataEmissao(linha.substring(1, 9).trim()); + leitorManualFiscal.setOrigenUf(linha.substring(177, 179).trim()); + leitorManualFiscal.setDestinoUf(linha.substring(184, 186).trim()); + leitorManualFiscal.setClaseServicio(linha.substring(226, 256).trim()); + leitorManualFiscal.setStatus(linha.substring(223, 224).trim()); + leitorManualFiscal.setIcms(BigDecimalUtil.getStringToBigDecimal(linha.substring(79, 93).trim(), 2, LocaleUtil.getLocale())); + + if (registros.contains(leitorManualFiscal)) { + indice = registros.indexOf(leitorManualFiscal); + leitorManualFiscal = registros.get(indice); + } + + leitorManualFiscal.setValorIcms(leitorManualFiscal.getValorIcms().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(93, 107).trim(), 2, LocaleUtil.getLocale()))); + leitorManualFiscal.setValorTotal(leitorManualFiscal.getValorTotal().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(51, 65).trim(), 2, LocaleUtil.getLocale()))); + + leitorManualFiscal.setQtdeItens(leitorManualFiscal.getQtdeItens() + 1); + linha = br.readLine(); + while (linha != null && linha.startsWith("2")) { + if (linha.indexOf("TA") >= 0) { + leitorManualFiscal.setValorItem(leitorManualFiscal.getValorItem().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("TX") >= 0) { + leitorManualFiscal.setImportetaxaembarque(leitorManualFiscal.getImportetaxaembarque().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("PE") >= 0) { + leitorManualFiscal.setImportepedagio(leitorManualFiscal.getImportepedagio().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("SE") >= 0) { + leitorManualFiscal.setImporteseguro(leitorManualFiscal.getImporteseguro().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + linha = br.readLine(); + } + } else { + linha = br.readLine(); + } + + if (leitorManualFiscal != null && indice > -1) { + registros.set(indice, leitorManualFiscal); + } else if (leitorManualFiscal != null) { + registros.add(leitorManualFiscal); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private List carregarRegistrosNaoFiscais(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorNaoFiscalVO naoFiscais = null; + int indice = -1; + if (linha.startsWith("1")) { + naoFiscais = new LeitorNaoFiscalVO(); + naoFiscais.setEmpresaId(empresa.getEmpresaId()); + naoFiscais.setNombempresa(empresa.getNombempresa()); + naoFiscais.setDatamov(linha.substring(1, 9).trim()); + + Integer tipoEventoExtraId = Integer.valueOf(linha.substring(69, 78).trim()); + TipoEventoExtra tipoEvento = getTipoEventoExtra(tipoEventoExtraId); + + naoFiscais.setTipoeventoextraId(tipoEvento.getTipoeventoextraId()); + naoFiscais.setDesctipoevento(tipoEvento.getDescTipoEvento()); + + if (registros.contains(naoFiscais)) { + indice = registros.indexOf(naoFiscais); + naoFiscais = registros.get(indice); + } + + naoFiscais.setValorTotal(naoFiscais.getValorTotal().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(52, 65).trim(), 2, LocaleUtil.getLocale()))); + + linha = br.readLine(); + } else { + linha = br.readLine(); + } + + if (naoFiscais != null && indice > -1) { + registros.set(indice, naoFiscais); + } else if (naoFiscais != null) { + registros.add(naoFiscais); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private File gerarArquivoNaoFiscaisXls(List registros, String nomeArquivo) throws IOException { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_EMISSAO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("CODIGO_NATUREZA"); + row.createCell(3).setCellValue("DESCRICAO_NATUREZA"); + row.createCell(4).setCellValue("VALOR_TOTAL"); + + for (LeitorNaoFiscalVO leitorNaoFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorNaoFiscal.getDatamov()); + row.createCell(1).setCellValue(leitorNaoFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorNaoFiscal.getTipoeventoextraId()); + row.createCell(3).setCellValue(leitorNaoFiscal.getDesctipoevento()); + row.createCell(4).setCellValue(leitorNaoFiscal.getValorTotal().doubleValue()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + + } + + private TipoEventoExtra getTipoEventoExtra(Integer tipoEventoExtraId) { + for (TipoEventoExtra tipoEvento : getListTipoEventoExtra()) { + if (tipoEventoExtraId.equals(tipoEvento.getTipoeventoextraId())) + return tipoEvento; + } + return null; + } + + private List getListTipoEventoExtra() { + if (lsTipoEventoExtra == null) { + lsTipoEventoExtra = tipoEventoExtraService.obtenerTodos(); + } + return lsTipoEventoExtra; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FolioPreimpresoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FolioPreimpresoServiceImpl.java new file mode 100644 index 000000000..5e73fe54d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FolioPreimpresoServiceImpl.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FolioPreimpresoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; +import com.rjconsultores.ventaboletos.service.FolioPreimpresoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("folioPreimpresoService") +public class FolioPreimpresoServiceImpl implements FolioPreimpresoService { + + @Autowired + private FolioPreimpresoDAO folioPreimpresoDAO; + + @Override + public List obtenerTodos() { + return folioPreimpresoDAO.obtenerTodos(); + } + + @Override + public FolioPreimpreso obtenerID(Integer id) { + return folioPreimpresoDAO.obtenerID(id); + } + + @Transactional + public FolioPreimpreso suscribir(FolioPreimpreso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return folioPreimpresoDAO.suscribir(entidad); + } + + @Transactional + public FolioPreimpreso actualizacion(FolioPreimpreso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return folioPreimpresoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FolioPreimpreso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + folioPreimpresoDAO.actualizacion(entidad); + } + + @Override + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa) { + return folioPreimpresoDAO.buscaFolioPreImpressoEstacionImpresora(estacion, empresa); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoDetServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoDetServiceImpl.java new file mode 100644 index 000000000..581aebe20 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoDetServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDetDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import com.rjconsultores.ventaboletos.service.FormaPagoDetService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("formaPagoDetService") +public class FormaPagoDetServiceImpl implements FormaPagoDetService { + + @Autowired + private FormaPagoDetDAO formaPagoDetDAO; + + public List obtenerTodos() { + return formaPagoDetDAO.obtenerTodos(); + } + + public FormaPagoDet obtenerID(Integer id) { + return formaPagoDetDAO.obtenerID(id); + } + + @Transactional + public FormaPagoDet suscribir(FormaPagoDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDetDAO.suscribir(entidad); + } + + @Transactional + public FormaPagoDet actualizacion(FormaPagoDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDetDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FormaPagoDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + formaPagoDetDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java new file mode 100644 index 000000000..1dcce15a8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.service.FormaPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("formaPagoService") +public class FormaPagoServiceImpl implements FormaPagoService { + + private Integer[] formasPagoEspeciales = {4, 5, 6, 9, 10, 11, 96, 97, 98, 99}; + + @Autowired + private FormaPagoDAO formaPagoDAO; + + public List obtenerTodos() { + return formaPagoDAO.obtenerTodos(); + } + + public FormaPago obtenerID(Short id) { + return formaPagoDAO.obtenerID(id); + } + + @Transactional + public FormaPago suscribir(FormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDAO.suscribir(entidad); + } + + @Transactional + public FormaPago actualizacion(FormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + formaPagoDAO.actualizacion(entidad); + } + + public List buscarPorDescricao(String descpago) { + return formaPagoDAO.buscarPorDescricao(descpago); + } + + public List buscarFormasPagoExceptoEspeciales() { + return formaPagoDAO.buscarTodosExceto(formasPagoEspeciales); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FuncionSistemaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FuncionSistemaServiceImpl.java new file mode 100644 index 000000000..29b6e152d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/FuncionSistemaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.FuncionSistemaDAO; +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; +import com.rjconsultores.ventaboletos.service.FuncionSistemaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("funcionSistemaService") +public class FuncionSistemaServiceImpl implements FuncionSistemaService { + + @Autowired + private FuncionSistemaDAO funcionSistemaDAO; + + public List obtenerTodos() { + return funcionSistemaDAO.obtenerTodos(); + } + + public FuncionSistema obtenerID(Integer id) { + return funcionSistemaDAO.obtenerID(id); + } + + @Transactional + public FuncionSistema suscribir(FuncionSistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return funcionSistemaDAO.suscribir(entidad); + } + + @Transactional + public FuncionSistema actualizacion(FuncionSistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return funcionSistemaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FuncionSistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + funcionSistemaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoCategoriaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoCategoriaServiceImpl.java new file mode 100644 index 000000000..6824b5b04 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoCategoriaServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.GrupoCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; +import com.rjconsultores.ventaboletos.service.GrupoCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("grupoCategoriaService") +public class GrupoCategoriaServiceImpl implements GrupoCategoriaService { + + @Autowired + private GrupoCategoriaDAO grupoCategoriaDAO; + + public List obtenerTodos() { + return grupoCategoriaDAO.obtenerTodos(); + } + + public GrupoCategoria obtenerID(Integer id) { + return grupoCategoriaDAO.obtenerID(id); + } + + @Transactional + public GrupoCategoria suscribir(GrupoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCategoriaDAO.suscribir(entidad); + } + + @Transactional + public GrupoCategoria actualizacion(GrupoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(GrupoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + grupoCategoriaDAO.actualizacion(entidad); + } + + @Override + public List buscar(String descricao) { + return grupoCategoriaDAO.buscar(descricao); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoCortesiasServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoCortesiasServiceImpl.java new file mode 100644 index 000000000..40bee2664 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoCortesiasServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.GrupoCortesiasDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import com.rjconsultores.ventaboletos.service.GrupoCortesiasService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("grupoCortesiaService") +public class GrupoCortesiasServiceImpl implements GrupoCortesiasService { + + @Autowired + private GrupoCortesiasDAO grupoCortesiasDAO; + + public List obtenerTodos() { + return grupoCortesiasDAO.obtenerTodos(); + } + + public GrupoCortesia obtenerID(Integer id) { + return grupoCortesiasDAO.obtenerID(id); + } + + @Transactional + public GrupoCortesia suscribir(GrupoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCortesiasDAO.suscribir(entidad); + } + + @Transactional + public GrupoCortesia actualizacion(GrupoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCortesiasDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(GrupoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + grupoCortesiasDAO.actualizacion(entidad); + } + + public List buscar(String descgrupo) { + return grupoCortesiasDAO.buscar(descgrupo); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoRutaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoRutaServiceImpl.java new file mode 100644 index 000000000..0851ec0d6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/GrupoRutaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.GrupoRutaDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; +import com.rjconsultores.ventaboletos.service.GrupoRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Service("grupoRutaService") +public class GrupoRutaServiceImpl implements GrupoRutaService { + + @Autowired + private GrupoRutaDAO grupoRutaDAO; + + public List obtenerTodos() { + return grupoRutaDAO.obtenerTodos(); + } + + public GrupoRuta obtenerID(Integer id) { + return grupoRutaDAO.obtenerID(id); + } + + @Transactional + public GrupoRuta suscribir(GrupoRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoRutaDAO.suscribir(entidad); + } + + @Transactional + public GrupoRuta actualizacion(GrupoRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoRutaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(GrupoRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + grupoRutaDAO.actualizacion(entidad); + } + + public List buscarPorNome(String descgrupo) { + return grupoRutaDAO.buscarPorNome(descgrupo); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java new file mode 100644 index 000000000..2f3baca89 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.HotelDAO; +import com.rjconsultores.ventaboletos.entidad.Hotel; +import com.rjconsultores.ventaboletos.service.HotelService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("hotelService") +public class HotelServiceImpl implements HotelService { + + @Autowired + private HotelDAO hotelDAO; + + public List obtenerTodos() { + return hotelDAO.obtenerTodos(); + } + + public Hotel obtenerID(Integer id) { + return hotelDAO.obtenerID(id); + } + + @Transactional + public Hotel suscribir(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return hotelDAO.suscribir(entidad); + } + + @Transactional + public Hotel actualizacion(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return hotelDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + hotelDAO.actualizacion(entidad); + } + + public List buscar(String deschotel) { + return hotelDAO.buscar(deschotel); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java new file mode 100644 index 000000000..156237af1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.BufferedReader; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteFidelidad; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.service.ClienteService; +import com.rjconsultores.ventaboletos.service.ImportacaoClientesService; +import com.rjconsultores.ventaboletos.service.TarjetaFidelidadService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("importacaoClientesService") +public class ImportacaoClientesServiceImpl implements ImportacaoClientesService { + + @Autowired + private ClienteService clienteService; + @Autowired + private TarjetaFidelidadService tarjetaFidelidadService; + + private static Logger log = Logger.getLogger(ImportacaoClientesServiceImpl.class); + + @Override + public String[] lerArquivo(Reader reader, List empresas) { + String linha = null; + Integer index = 0; + StringBuilder qtdeGravados = new StringBuilder(); + StringBuilder erros = new StringBuilder(); + + Integer inseridos = 0; + Integer atualizados = 0; + + try { + BufferedReader leitor = new BufferedReader(reader); + + while ((linha = leitor.readLine()) != null) { + String[] dados = linha.replace("\"", "").split(","); + Integer[] gravados = salvarClientes(dados, empresas); + inseridos = gravados[0] + inseridos; + atualizados = gravados[1] + atualizados; + index++; + } + + leitor.close(); + + qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index).append(" importados.\n"); + qtdeGravados.append("Atualizados ").append(atualizados).append(" clientes.\n"); + qtdeGravados.append("Inseridos ").append(inseridos).append(" novos clientes."); + + String[] resultado = { qtdeGravados.toString(), erros.toString() }; + return resultado; + + } catch (Exception e) { + erros.append("Linha ").append(index).append(" do arquivo de clientes, erro: ").append(e.getCause().getCause()).append("\n"); + + log.error(e); + String[] resultado = { e.toString() }; + return resultado; + } + } + + @Override + public Integer[] salvarClientes(String[] cliente, List empresas) { + String nomeCliente = cliente[1].replace("\"", "").toUpperCase(); + Integer inseridos = new Integer(0); + Integer atualizados = new Integer(0); + Integer[] gravados = {0,0}; + + for (Empresa e : empresas){ + + Cliente clienteGravar = clienteService.buscarPorNumeroFidelidade(Integer.parseInt(cliente[0]), e); + if (clienteGravar == null) { + clienteGravar = new Cliente(); + clienteGravar.setNombcliente(nomeCliente); + clienteGravar.setNumIdentificaUno(cliente[3]); + + TarjetaFidelidad tarjetaFidelidad = new TarjetaFidelidad(); + tarjetaFidelidad.setActivo(Boolean.TRUE); + tarjetaFidelidad.setFecmodif(Calendar.getInstance().getTime()); + tarjetaFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + // cast para Integer para remover 0 a esquerda: + tarjetaFidelidad.setNumTarjeta(Long.parseLong(cliente[0])); + + List ls = new ArrayList(); + + ClienteFidelidad clienteFidelidad = new ClienteFidelidad(); + clienteFidelidad.setTarjetaFidelidad(tarjetaFidelidad); + clienteFidelidad.setActivo(Boolean.TRUE); + clienteFidelidad.setFecmodif(Calendar.getInstance().getTime()); + clienteFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clienteFidelidad.setCliente(clienteGravar); + clienteFidelidad.setEmpresa(e); + ls.add(clienteFidelidad); + + clienteGravar.setListClienteFidelidad(ls); + + clienteService.suscribir(clienteGravar); + inseridos = inseridos + 1; + gravados[0] =gravados[0] + inseridos; + } else { + clienteGravar.setNombcliente(nomeCliente); + clienteGravar.setNumIdentificaUno(cliente[3]); + clienteService.actualizacion(clienteGravar); + + atualizados = atualizados + 1; + gravados[1] =gravados[1] + atualizados; + } + } + return gravados; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeCategoriaVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeCategoriaVentaServiceImpl.java new file mode 100644 index 000000000..8ab08c109 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeCategoriaVentaServiceImpl.java @@ -0,0 +1,92 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformeCategoriaVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformeCategoriaVentaService; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +/** + * + * @author Administrador + */ +@Service("informeCategoriaVentaService") +public class InformeCategoriaVentaServiceImpl implements InformeCategoriaVentaService { + + @Autowired + private InformeCategoriaVentaDAO informeCategoriaVentaDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformeCategoriaVentaServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException{ + Connection conn = null; + AMedia amedia = null; + + try { + conn = dataSource.getConnection(); + + ResultSet rs = informeCategoriaVentaDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + String nomeEmpresa = "TODAS"; + Empresa empresa = (Empresa) parameters.get("empresa"); + if (empresa != null) { + nomeEmpresa = empresa.getNombempresa().toUpperCase(); + } + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("nomeEmpresa", nomeEmpresa); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = + JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("categoriaVenta.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformePasajeroServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformePasajeroServicioServiceImpl.java new file mode 100644 index 000000000..48cc307b2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformePasajeroServicioServiceImpl.java @@ -0,0 +1,91 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformePasajeroServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformePasajeroServicioService; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +/** + * + * @author Administrador + */ +@Service("informePasajeroServicioService") +public class InformePasajeroServicioServiceImpl implements InformePasajeroServicioService { + + @Autowired + private InformePasajeroServicioDAO informePasajeroServicioDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformePasajeroServicioServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException { + Connection conn = null; + AMedia amedia = null; + + try { + conn = dataSource.getConnection(); + + ResultSet rs = informePasajeroServicioDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + String nomeEmpresa = "TODAS"; + Empresa empresa = (Empresa) parameters.get("empresa"); + if (empresa != null) { + nomeEmpresa = empresa.getNombempresa().toUpperCase(); + } + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("empresa", nomeEmpresa); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("pasajeroServicio.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeServicioDiarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeServicioDiarioServiceImpl.java new file mode 100644 index 000000000..7f5be17b5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeServicioDiarioServiceImpl.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformeServicioDiarioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformeServicioDiarioService; + +/** + * + * @author Administrador + */ +@Service("informeServicioDiarioService") +public class InformeServicioDiarioServiceImpl implements InformeServicioDiarioService { + + @Autowired + private InformeServicioDiarioDAO informeServicioDiarioDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformeServicioDiarioServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException { + AMedia amedia = null; + Connection conn = null; + try { + conn = dataSource.getConnection(); + ResultSet rs = informeServicioDiarioDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + String nomeEmpresa = "TODAS"; + Empresa empresa = (Empresa) parameters.get("empresa"); + if (empresa != null) { + nomeEmpresa = empresa.getNombempresa().toUpperCase(); + } + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("nomeEmpresa", nomeEmpresa); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = + JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("servicioDiario.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeVentasPuntoVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeVentasPuntoVentaServiceImpl.java new file mode 100644 index 000000000..ef77be93d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InformeVentasPuntoVentaServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformeVentasPuntoVentaDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformeVentasPuntoVentaService; + +/** + * + * @author Administrador + */ +@Service("informeVentasPuntoVentaService") +public class InformeVentasPuntoVentaServiceImpl implements InformeVentasPuntoVentaService { + + @Autowired + private InformeVentasPuntoVentaDAO informeVentasPuntoVentaDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformeVentasPuntoVentaServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException { + Connection conn = null; + AMedia amedia = null; + + try { + conn = dataSource.getConnection(); + + ResultSet rs = informeVentasPuntoVentaDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = + JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("ventasPuntoVenta.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InstiFinanceiraServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InstiFinanceiraServiceImpl.java new file mode 100644 index 000000000..10479d2c4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/InstiFinanceiraServiceImpl.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.InstiFinanceiraDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; +import com.rjconsultores.ventaboletos.service.InstiFinanceiraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaBancoService") +public class InstiFinanceiraServiceImpl implements InstiFinanceiraService { + + @Autowired + private InstiFinanceiraDAO ptovtaBancoDAO; + + public List obtenerTodos() { + return ptovtaBancoDAO.obtenerTodos(); + } + + public InstiFinanceira obtenerID(Integer id) { + return ptovtaBancoDAO.obtenerID(id); + } + + @Transactional + public InstiFinanceira suscribir(InstiFinanceira entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.suscribir(entidad); + } + + @Transactional + public InstiFinanceira actualizacion(InstiFinanceira entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(InstiFinanceira entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaBancoDAO.actualizacion(entidad); + } + + public List buscar(String nome) { + return ptovtaBancoDAO.buscar(nome); + } + + @Override + public List buscarContasBancariasPorIdEmpresa(Integer empresaId) { + return ptovtaBancoDAO.buscarContasBancariasPorIdEmpresa(empresaId); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ItemAdicionalServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ItemAdicionalServiceImpl.java new file mode 100644 index 000000000..f7d6fca3a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ItemAdicionalServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ItemAdicionalDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.service.ItemAdicionalService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("itemAdicionalService") +public class ItemAdicionalServiceImpl implements ItemAdicionalService { + + @Autowired + private ItemAdicionalDAO itemAdicionalDAO; + + @Override + public List obtenerTodos() { + return itemAdicionalDAO.obtenerTodos(); + } + + @Override + public ItemAdicional obtenerID(Integer id) { + return itemAdicionalDAO.obtenerID(id); + } + + @Transactional + @Override + public ItemAdicional suscribir(ItemAdicional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemAdicionalDAO.suscribir(entidad); + } + + @Transactional + @Override + public ItemAdicional actualizacion(ItemAdicional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemAdicionalDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ItemAdicional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + itemAdicionalDAO.actualizacion(entidad); + } + + @Override + public List buscaItemAdicionalPacote(Pacote pacote) { + return itemAdicionalDAO.buscaItemAdicionalPacote(pacote); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ItemDescontoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ItemDescontoServiceImpl.java new file mode 100644 index 000000000..c08e4b327 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ItemDescontoServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ItemDescontoDAO; +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; +import com.rjconsultores.ventaboletos.service.ItemDescontoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ItemDescontoService") +public class ItemDescontoServiceImpl implements ItemDescontoService { + + @Autowired + private ItemDescontoDAO itemDescontoDAO; + + @Override + public List obtenerTodos() { + return itemDescontoDAO.obtenerTodos(); + } + + @Override + public ItemDesconto obtenerID(Long id) { + return itemDescontoDAO.obtenerID(id); + } + + @Transactional + @Override + public ItemDesconto suscribir(ItemDesconto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemDescontoDAO.suscribir(entidad); + } + + @Transactional + @Override + public ItemDesconto actualizacion(ItemDesconto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemDescontoDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ItemDesconto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + itemDescontoDAO.actualizacion(entidad); + } + + @Override + public List buscarPorNome(String nomitemdesconto) { + return itemDescontoDAO.buscarPorNome(nomitemdesconto); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java new file mode 100644 index 000000000..f20d26705 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MarcaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; +import com.rjconsultores.ventaboletos.service.MarcaAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("marcaAutobusService") +public class MarcaAutobusServiceImpl implements MarcaAutobusService { + + @Autowired + private MarcaAutobusDAO marcaAutobusDAO; + + public List obtenerTodos() { + return marcaAutobusDAO.obtenerTodos(); + } + + public MarcaAutobus obtenerID(Integer id) { + return marcaAutobusDAO.obtenerID(id); + } + + @Transactional + public MarcaAutobus suscribir(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaAutobusDAO.suscribir(entidad); + } + + @Transactional + public MarcaAutobus actualizacion(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + marcaAutobusDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaClaseServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaClaseServicioServiceImpl.java new file mode 100644 index 000000000..b63dd6f68 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaClaseServicioServiceImpl.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MarcaClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.service.MarcaClaseServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("marcaClaseServicioService") +public class MarcaClaseServicioServiceImpl implements MarcaClaseServicioService { + + @Autowired + private MarcaClaseServicioDAO marcaClaseServicioDAO; + + public List obtenerTodos() { + return marcaClaseServicioDAO.obtenerTodos(); + } + + public MarcaClaseServicio obtenerID(MarcaClaseServicioPK id) { + return marcaClaseServicioDAO.obtenerID(id); + } + + @Transactional + public MarcaClaseServicio suscribir(MarcaClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaClaseServicioDAO.suscribir(entidad); + } + + @Transactional + public MarcaClaseServicio actualizacion(MarcaClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaClaseServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MarcaClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + marcaClaseServicioDAO.actualizacion(entidad); + } + + public List buscar(ClaseServicio clase) { + return marcaClaseServicioDAO.buscar(clase); + } + + @Override + public List buscarPorEmpresasPermitidas(ClaseServicio clase, Usuario usuarioLoggado) { + List idsEmpresa = getIdsEmpresaUsuario(usuarioLoggado); + return marcaClaseServicioDAO.buscarPorEmpresasPermitidas(clase, idsEmpresa); + } + + private List getIdsEmpresaUsuario(Usuario usuario){ + List toReturn = new ArrayList(); + for(Empresa empresa : usuario.getEmpresa()){ + toReturn.add(empresa.getEmpresaId()); + } + return toReturn; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaServiceImpl.java new file mode 100644 index 000000000..85fceb1e7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MarcaServiceImpl.java @@ -0,0 +1,82 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.service.MarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("marcaService") +public class MarcaServiceImpl implements MarcaService { + + @Autowired + private MarcaDAO marcaDAO; + + public List obtenerTodos() { + return marcaDAO.obtenerTodos(); + } + + public Marca obtenerID(Short id) { + return marcaDAO.obtenerID(id); + } + + @Transactional + public Marca suscribir(Marca entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaDAO.suscribir(entidad); + } + + @Transactional + public Marca actualizacion(Marca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Marca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + marcaDAO.actualizacion(entidad); + } + + public List buscarPorNome(String nomeMarca) { + return marcaDAO.buscarPorNome(nomeMarca); + } + + public List buscarTodosExceto(Usuario usuario,Integer... idMarca) { + return marcaDAO.buscarTodosExceto(usuario,idMarca); + } + + @Override + public List buscarDescricaoIdMarca() { + return marcaDAO.buscarDescricaoIdMarca(); + } + + + public List buscarMarcaPorEmpresa(List empresa){ + return marcaDAO.buscarMarcaPorEmpresa(empresa); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MercadoCompetidoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MercadoCompetidoServiceImpl.java new file mode 100644 index 000000000..c1baabe2e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MercadoCompetidoServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MercadoCompetidoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.service.MercadoCompetidoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("mercadoCompetidoService") +public class MercadoCompetidoServiceImpl implements MercadoCompetidoService { + + @Autowired + private MercadoCompetidoDAO mercadoCompetidoDAO; + + public List obtenerTodos() { + return mercadoCompetidoDAO.obtenerTodos(); + } + + public MercadoCompetido obtenerID(Integer id) { + return mercadoCompetidoDAO.obtenerID(id); + } + + @Transactional + public MercadoCompetido suscribir(MercadoCompetido entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return mercadoCompetidoDAO.suscribir(entidad); + } + + @Transactional + public MercadoCompetido actualizacion(MercadoCompetido entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return mercadoCompetidoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MercadoCompetido entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + mercadoCompetidoDAO.actualizacion(entidad); + } + + public boolean existe(ClaseServicio claseServicio, Parada origem, + Parada destino) { + return mercadoCompetidoDAO.existe(claseServicio, origem, destino); + } + + public List buscar(Parada origem, Parada destino) { + return mercadoCompetidoDAO.buscar(origem, destino); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MerchantBancarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MerchantBancarioServiceImpl.java new file mode 100644 index 000000000..130d96ff1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MerchantBancarioServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MerchantBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; +import com.rjconsultores.ventaboletos.service.MerchantBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("merchantBancarioService") +public class MerchantBancarioServiceImpl implements MerchantBancarioService { + + @Autowired + private MerchantBancarioDAO merchantBancarioDAO; + + public List obtenerTodos() { + return merchantBancarioDAO.obtenerTodos(); + } + + public MerchantBancario obtenerID(Integer id) { + return merchantBancarioDAO.obtenerID(id); + } + + @Transactional + public MerchantBancario suscribir(MerchantBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return merchantBancarioDAO.suscribir(entidad); + } + + @Transactional + public MerchantBancario actualizacion(MerchantBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return merchantBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MerchantBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + merchantBancarioDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MigracaoControleEstoqueServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MigracaoControleEstoqueServiceImpl.java new file mode 100644 index 000000000..1c6ab1107 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MigracaoControleEstoqueServiceImpl.java @@ -0,0 +1,155 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO; +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.ControleEstoqueMigracao; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.service.AbastoCentralService; +import com.rjconsultores.ventaboletos.service.MigracaoControleEstoqueService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("migracaoControleEstoqueService") +public class MigracaoControleEstoqueServiceImpl implements MigracaoControleEstoqueService { + + + @Autowired + private AbastoBoletoDAO abastoBoletoDAO; + + @Autowired + private DetAbastoBoletoDAO detAbastoBoletoDAO; + + @Autowired + private AidfDAO aidfDAO; + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + @Autowired + private AbastoHistoDAO abastoHistoDAO; + + @Autowired + private TipoMovimentacionDAO tipoMovimentacionDAO; + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + + public MigracaoControleEstoqueServiceImpl() { + } + + @Transactional + public void migraDadosBoletosPuntoVenta(PuntoVenta puntoVenta){ + puntoVentaDAO.actualizacion(puntoVenta); + } + + @Transactional + public void migraDadosBoletosPuntoVentaAutomatico(PuntoVenta puntoVenta){ + + List abastoBoletos = abastoBoletoDAO.buscaAbastoBoletoPorPuntoVenta(puntoVenta); + + List empresas = new ArrayList(); + empresas.add(puntoVenta.getEmpresa()); + + List aidfs = aidfDAO.buscaAidfsPorEmpresas(empresas); + + Map> abastoBoletosPorAidf = new HashMap>(); + + for(AbastoBoleto abastoBoleto: abastoBoletos){ + + List detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(abastoBoleto); + + for(Aidf aidf : aidfs){ + + if(!abastoBoletosPorAidf.containsKey(aidf)) + abastoBoletosPorAidf.put(aidf, new ArrayList()); + + for(DetAbastoBoleto detAbastoBoleto : detAbastoBoletos){ + + String serieDetAbastoBoleto = detAbastoBoleto.getNumseriepreimpresa(); + Long numFolioInicialDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfolioinicial()); + Long numFolioFinalDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfoliofinal()); + + Long numFolioInicialAidf = Long.valueOf(aidf.getForminicial()); + Long numFolioFinalAidf = Long.valueOf(aidf.getFormfinal()); + + if(serieDetAbastoBoleto.equals(aidf.getSerie()) + && numFolioInicialDetAbastoBoleto >= numFolioInicialAidf + && numFolioFinalDetAbastoBoleto <= numFolioFinalAidf){ + + abastoBoletosPorAidf.get(aidf).add(detAbastoBoleto); + } + } + } + } + + Iterator>> boletosIt = abastoBoletosPorAidf.entrySet().iterator(); + + List boletosAMigrar = new ArrayList(); + + Integer usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + Date fecmodif = new Date(); + + while(boletosIt.hasNext()){ + + Entry> boletosPorAidf = boletosIt.next(); + + Aidf aidf = boletosPorAidf.getKey(); + List detAbastoBoletos = boletosPorAidf.getValue(); + + for(DetAbastoBoleto detAbastoBoleto : detAbastoBoletos){ + + String serieDetAbastoBoleto = detAbastoBoleto.getNumseriepreimpresa(); + Long numFolioInicialDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfolioinicial()); + Long numFolioFinalDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfoliofinal()); + + int numBoletos = (int)(numFolioFinalDetAbastoBoleto - numFolioInicialDetAbastoBoleto); + + Boolean activo = detAbastoBoleto.getActivo(); + String numsubseriepreimpreso = ""; + + for(int contBoletos = 0 ; contBoletos < numBoletos; contBoletos++ ){ + + String numfoliopreimpreso = (numFolioInicialDetAbastoBoleto + contBoletos)+""; + + AbastoCentral boletoAMigrar = new AbastoCentral( + aidf, serieDetAbastoBoleto, numfoliopreimpreso, numsubseriepreimpreso, + puntoVenta, activo, fecmodif, usuarioId); + + boletosAMigrar.add(boletoAMigrar); + } + } + } + + abastoCentralDAO.suscribirBilhetes(boletosAMigrar); + + TipoMovimentacion tipoMovMigracao = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_MIGRACAO); + abastoHistoDAO.grabaHistoricoBilhetes(boletosAMigrar, tipoMovMigracao); + + + abastoCentralDAO.gravaControleEstoqueMigracao(puntoVenta, fecmodif, usuarioId); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MonedaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MonedaServiceImpl.java new file mode 100644 index 000000000..6117f1fef --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MonedaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MonedaDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.service.MonedaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("monedaService") +public class MonedaServiceImpl implements MonedaService { + + @Autowired + private MonedaDAO monedaDAO; + + public List obtenerTodos() { + return monedaDAO.obtenerTodos(); + } + + public Moneda obtenerID(Integer id) { + return monedaDAO.obtenerID(id); + } + + @Transactional + public Moneda suscribir(Moneda entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monedaDAO.suscribir(entidad); + } + + @Transactional + public Moneda actualizacion(Moneda entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monedaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Moneda entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + monedaDAO.actualizacion(entidad); + } + + public List buscar(String descmoneda) { + return monedaDAO.buscar(descmoneda); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelacionServiceImpl.java new file mode 100644 index 000000000..0a5bb695b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelacionServiceImpl.java @@ -0,0 +1,82 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.service.MotivoCancelacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("motivoCancelacionService") +public class MotivoCancelacionServiceImpl implements MotivoCancelacionService { + + @Autowired + private MotivoCancelacionDAO motivoCancelacionDAO; + public static final Integer MAX_CONS_MOV_CANCEL = Integer.valueOf(35); + + public List obtenerTodos() { + return motivoCancelacionDAO.obtenerTodos(); + } + + public MotivoCancelacion obtenerID(Integer id) { + return motivoCancelacionDAO.obtenerID(id); + } + + @Transactional + public MotivoCancelacion suscribir(MotivoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoCancelacionDAO.suscribir(entidad); + } + + @Transactional + public MotivoCancelacion actualizacion(MotivoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoCancelacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoCancelacionDAO.actualizacion(entidad); + } + + public List buscar(String descmotivo, String tipomotivo) { + return motivoCancelacionDAO.buscar(descmotivo, tipomotivo); + } + + public List obtenerTodosTipoMotivoB() { + return motivoCancelacionDAO.obtenerTodosTipoMotivoB(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + return motivoCancelacionDAO.obtenerTodosEspecificos(motivos); + } + + public boolean validaMotivoCancelacionConstante(MotivoCancelacion motivoCancelacion) { + if (motivoCancelacion.getMotivocancelacionId() <= MAX_CONS_MOV_CANCEL) + return false; + else + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoReimpresionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoReimpresionServiceImpl.java new file mode 100644 index 000000000..d163421f8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoReimpresionServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivoReimpresionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import com.rjconsultores.ventaboletos.service.MotivoReimpresionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("motivoReimpresionService") +public class MotivoReimpresionServiceImpl implements MotivoReimpresionService { + + @Autowired + private MotivoReimpresionDAO motivoReimpresionDAO; + + public List obtenerTodos() { + return motivoReimpresionDAO.obtenerTodos(); + } + + public MotivoReimpresion obtenerID(Integer id) { + return motivoReimpresionDAO.obtenerID(id); + } + + @Transactional + public MotivoReimpresion suscribir(MotivoReimpresion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoReimpresionDAO.suscribir(entidad); + } + + @Transactional + public MotivoReimpresion actualizacion(MotivoReimpresion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoReimpresionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivoReimpresion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoReimpresionDAO.actualizacion(entidad); + } + + public List buscar(String descmotivo) { + return motivoReimpresionDAO.buscar(descmotivo); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoViajeServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoViajeServiceImpl.java new file mode 100644 index 000000000..d64c6a0ca --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivoViajeServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivoViajeDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; +import com.rjconsultores.ventaboletos.service.MotivoViajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("motivoViajeService") +public class MotivoViajeServiceImpl implements MotivoViajeService { + + @Autowired + private MotivoViajeDAO motivoViajeDAO; + + public List obtenerTodos() { + return motivoViajeDAO.obtenerTodos(); + } + + public MotivoViaje obtenerID(Integer id) { + return motivoViajeDAO.obtenerID(id); + } + + @Transactional + public MotivoViaje suscribir(MotivoViaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoViajeDAO.suscribir(entidad); + } + + @Transactional + public MotivoViaje actualizacion(MotivoViaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoViajeDAO.actualizacion(entidad); + + } + + @Transactional + public void borrar(MotivoViaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoViajeDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivocancelacionEquivalenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivocancelacionEquivalenciaServiceImpl.java new file mode 100644 index 000000000..e37acc8bd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MotivocancelacionEquivalenciaServiceImpl.java @@ -0,0 +1,73 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivocancelacionEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import com.rjconsultores.ventaboletos.service.MotivocancelacionEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("motivocancelacionEquivalenciaService") +public class MotivocancelacionEquivalenciaServiceImpl + implements MotivocancelacionEquivalenciaService { + + @Autowired + private MotivocancelacionEquivalenciaDAO motivocancelacionEquivalenciaDAO; + + public List obtenerTodos() { + return motivocancelacionEquivalenciaDAO.obtenerTodos(); + } + + public MotivocancelacionEquivalencia obtenerID(Integer id) { + return motivocancelacionEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public MotivocancelacionEquivalencia suscribir(MotivocancelacionEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivocancelacionEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public MotivocancelacionEquivalencia actualizacion(MotivocancelacionEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivocancelacionEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivocancelacionEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivocancelacionEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(ComisionistaExterno comisionistaExterno, + MotivoCancelacion motivoCancelacion) { + return motivocancelacionEquivalenciaDAO.buscar(comisionistaExterno, motivoCancelacion); + } + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia) { + return motivocancelacionEquivalenciaDAO.buscarEquivalencia(motivoCancelacionEquivalencia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java new file mode 100644 index 000000000..cc67a25a0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java @@ -0,0 +1,204 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.service.AutorizaFolioService; +import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("movimentacioBilhetesService") +public class MovimentacionBilhetesServiceImpl implements MovimentacionBilhetesService { + + @Autowired + private AidfDAO aidfDAO; + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + @Autowired + private AbastoHistoDAO abastoHistoDAO; + + @Autowired + private TipoMovimentacionDAO tipoMovimentacionDAO; + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + + @Autowired + private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO; + + @Autowired + private AutorizaFolioService autorizaFolioService; + + + @Override + public List obtenerHistoricoMovimetacion(String numBilhete) { + + return null; + } + + @Override + public List obtenerHistoricoMovimetacion(Aidf aidf) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List obtenerHistoricoMovimetacion(Aidf aidf, Date fecInicial, Date fecFinal) { + // TODO Auto-generated method stub + return null; + } + + @Transactional + public void realizaAdquisicionBilhetes(Aidf aidf){ + + PuntoVenta suprimento = buscarAgSuprimento(); + + long formInicial = Long.valueOf(aidf.getForminicial()); + long formFinal = Long.valueOf(aidf.getFormfinal()); + + List bilhetes = new ArrayList(); + + for(long formCorrente = formInicial; formCorrente <= formFinal; formCorrente++){ + AbastoCentral nuevoBilhete = new AbastoCentral(); + nuevoBilhete.setAidf(aidf); + nuevoBilhete.setNumfoliopreimpreso(formCorrente+""); + nuevoBilhete.setNumseriepreimpresa(aidf.getSerie()); + nuevoBilhete.setNumsubseriepreimpreso(aidf.getSubserie()); + nuevoBilhete.setPuntoventa(suprimento); + nuevoBilhete.setFecmodif(Calendar.getInstance().getTime()); + nuevoBilhete.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + nuevoBilhete.setActivo(true); + + bilhetes.add(nuevoBilhete); + } + + abastoCentralDAO.suscribirBilhetes(bilhetes); + + TipoMovimentacion adquisicion = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_ADQUISICION); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, adquisicion); + + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + List bilhetes = abastoCentralDAO.obtenerBilhetes(aidf, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, Long cantidad, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + Long formInicial = Long.valueOf(aidf.getForminicial()); + Long formFinal = formInicial + cantidad.longValue(); + + realizaMovimentacionBilhetes(aidf, origem, destino, formInicial.toString(), formFinal.toString(), tipoMovimentacion); + + } + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + List bilhetes = abastoCentralDAO.obtenerBilhetes(aidf, formInicial, formFinal, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + } + + private boolean validaTipoMovimentacao(TipoMovimentacion tipoMovimentacion){ + TipoMovimentacion adquisicion = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_ADQUISICION); + return !tipoMovimentacion.equals(adquisicion); + } + + public List obtenerTiposMovimetacion() { + List tiposMovimentacion = tipoMovimentacionDAO.obtenerTodos(); + return tiposMovimentacion; + } + + public PuntoVenta buscarAgSuprimento() { + PtovtaTipoEstoque tipoSuprimento = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PuntoVenta suprimento = puntoVentaDAO.buscarPuntoVentaPorTipoEstoque(tipoSuprimento).get(0); + + return suprimento; + } + + + public PuntoVenta buscarAgContabilidade() { + PtovtaTipoEstoque tipoContabilidade = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + PuntoVenta contabilidade = puntoVentaDAO.buscarPuntoVentaPorTipoEstoque(tipoContabilidade).get(0); + + return contabilidade; + } + + public List obtenerTiposMovimetacionPuntoVenta() { + List tipos = tipoMovimentacionDAO.obtenerTiposMovimetacionPuntoVenta(); + return tipos; + } + + @Transactional + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String numSerie, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) { + + List bilhetes = abastoCentralDAO.obtenerBilhetesPorPuntoVenta(numSerie, formInicial, formFinal, puntoVentaBilhetes, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + trataRequisicionBilhetesEstacion(bilhetes, origem, destino, formInicial, formFinal, tipoMovimentacion); + } + + private void trataRequisicionBilhetesEstacion(List bilhetes, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, TipoMovimentacion tipoMovimentacion){ + + Aidf aidfCorrente = null; + + for(AbastoCentral bilhete : bilhetes){ + + if(aidfCorrente == null || (aidfCorrente != null && !aidfCorrente.equals(bilhete.getAidf()))){ + aidfCorrente = bilhete.getAidf(); + String numseriepreimpresa = aidfCorrente.getSerie(); + autorizaFolioService.noChequeFolioPreimpresos(aidfCorrente, origem, destino, numfolioinicial, numfoliofinal, numseriepreimpresa, aidfCorrente.getEmpresa(), tipoMovimentacion); + } + } + } + + private void atualizaBilhetesEGrabaHistorico(List bilhetes, Estacion destino, TipoMovimentacion tipoMovimentacion){ + + abastoCentralDAO.actualizaBilhetes(bilhetes, destino); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, tipoMovimentacion); + } + + private void atualizaBilhetesEGrabaHistorico(List bilhetes, PuntoVenta destino, TipoMovimentacion tipoMovimentacion){ + + abastoCentralDAO.actualizaBilhetes(bilhetes, destino); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, tipoMovimentacion); + } + + @Override + public List buscarSeriesBilhetesPorEstacion(Estacion estacion) { + List seriesEstacion = abastoCentralDAO.buscarSeriesBilhetesPorEstacion(estacion); + return seriesEstacion; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/NodoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/NodoServiceImpl.java new file mode 100644 index 000000000..3e038164c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/NodoServiceImpl.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.NodoDAO; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.service.NodoService; + +/** + * + * @author Administrador + */ +@Service("nodoService") +public class NodoServiceImpl implements NodoService { + + @Autowired + private NodoDAO nodoDAO; + + public List obtenerTodos() { + //No momento só será usado o nodo central + List ls = new ArrayList(); + ls.add(nodoDAO.obtenerID(Nodo.NODO_ID_CENTRAL)); + + return ls; + } + + @Override + public Nodo obtenerId(Integer id) { + return nodoDAO.obtenerID(id); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OCDParamServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OCDParamServiceImpl.java new file mode 100644 index 000000000..2fa80e963 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OCDParamServiceImpl.java @@ -0,0 +1,81 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OCDParamDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; +import com.rjconsultores.ventaboletos.service.OCDParamService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ocdParamService") +public class OCDParamServiceImpl implements OCDParamService { + + @Autowired + private OCDParamDAO ocdParamDAO; + + private void setUsuarioFecmodifActivoOCD(OCDParam entidad){ + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + @Override + public List obtenerTodos() { + List params = ocdParamDAO.obtenerTodos(); + return params; + } + + @Override + public OCDParam obtenerID(Integer id) { + OCDParam param = ocdParamDAO.obtenerID(id); + return param; + } + + @Transactional + public OCDParam suscribirActualizar(OCDParam entidad){ + if (entidad.getOcdparamId() == null && ocdParamDAO.buscaOCDParamPorEmpresa(entidad.getEmpresa()) != null){ + return null; + } else{ + return ocdParamDAO.suscribirActualizar(entidad); + } + } + + @Transactional + public OCDParam suscribir(OCDParam entidad) { + setUsuarioFecmodifActivoOCD(entidad); + OCDParam param = ocdParamDAO.suscribir(entidad); + return param; + } + + @Transactional + public OCDParam actualizacion(OCDParam entidad) { + setUsuarioFecmodifActivoOCD(entidad); + OCDParam param = ocdParamDAO.actualizacion(entidad); + return param; + } + + @Transactional + public void borrar(OCDParam entidad) { + setUsuarioFecmodifActivoOCD(entidad); + entidad.setActivo(Boolean.FALSE); + ocdParamDAO.borrar(entidad); + } + + @Override + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa) { + OCDParam param = ocdParamDAO.buscaOCDParamPorEmpresa(empresa); + return param; + } + + @Override + public List buscaOCDParams(Empresa empresa) { + List params = ocdParamDAO.buscaOCDParams(empresa); + return params; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoCancelacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoCancelacionServiceImpl.java new file mode 100644 index 000000000..f0ed89041 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoCancelacionServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OrgaoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.OrgaoCancelacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("orgaoCancelacionService") +public class OrgaoCancelacionServiceImpl implements OrgaoCancelacionService{ + + @Autowired + private OrgaoCancelacionDAO orgaoCancelacionDAO; + + public List obtenerTodos() { + return orgaoCancelacionDAO.obtenerTodos(); + } + + public OrgaoCancelacion obtenerID(Integer id) { + return orgaoCancelacionDAO.obtenerID(id); + } + + @Transactional + public OrgaoCancelacion suscribirActualizacion(OrgaoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getOrgaoCancelacionId() != null){ + return orgaoCancelacionDAO.actualizacion(entidad); + } else { + return orgaoCancelacionDAO.suscribir(entidad); + } + } + + @Transactional + public void borrar(OrgaoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + orgaoCancelacionDAO.actualizacion(entidad); + } + + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente) { + return orgaoCancelacionDAO.buscarPorOrgao(orgaoConcedente); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java new file mode 100644 index 000000000..33691e37f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("orgaoConcedenteService") +public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { + + @Autowired + private OrgaoConcedenteDAO orgaoConcedenteDAO; + + public List obtenerTodos() { + return orgaoConcedenteDAO.obtenerTodos(); + } + + public OrgaoConcedente obtenerID(Integer id) { + return orgaoConcedenteDAO.obtenerID(id); + } + + @Transactional + public OrgaoConcedente suscribir(OrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return orgaoConcedenteDAO.suscribir(entidad); + } + + @Transactional + public OrgaoConcedente actualizacion(OrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return orgaoConcedenteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(OrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + orgaoConcedenteDAO.actualizacion(entidad); + } + + public List buscar(String desc) { + return orgaoConcedenteDAO.buscar(desc); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoTramoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoTramoServiceImpl.java new file mode 100644 index 000000000..a93409153 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/OrgaoTramoServiceImpl.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; +import com.rjconsultores.ventaboletos.service.OrgaoTramoService; + +@Service("orgaoTramoService") +public class OrgaoTramoServiceImpl implements OrgaoTramoService { + + @Autowired + private OrgaoTramoDAO orgaoTramoDAO; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteConvenioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteConvenioServiceImpl.java new file mode 100644 index 000000000..6a13b6ccd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteConvenioServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; +import com.rjconsultores.ventaboletos.service.PacoteConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteConvenioService") +public class PacoteConvenioServiceImpl implements PacoteConvenioService { + + @Autowired + private PacoteConvenioDAO pacoteConvenioDAO; + + public List obtenerTodos() { + return pacoteConvenioDAO.obtenerTodos(); + } + + public PacoteConvenio obtenerID(Long id) { + return pacoteConvenioDAO.obtenerID(id); + } + + @Transactional + public PacoteConvenio suscribir(PacoteConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteConvenioDAO.suscribir(entidad); + } + + @Transactional + public PacoteConvenio actualizacion(PacoteConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteConvenioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PacoteConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteConvenioDAO.actualizacion(entidad); + } + + public List buscar(String deschotel) { + return pacoteConvenioDAO.buscar(deschotel); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteDescontoBilheteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteDescontoBilheteServiceImpl.java new file mode 100644 index 000000000..68a8f09ba --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteDescontoBilheteServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteDescontoBilheteDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; +import com.rjconsultores.ventaboletos.service.PacoteDescontoBilheteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteDescontoBilheteService") +public class PacoteDescontoBilheteServiceImpl implements PacoteDescontoBilheteService { + + @Autowired + PacoteDescontoBilheteDAO pacoteDescontoBilheteDAO; + + @Override + public List obtenerTodos() { + return pacoteDescontoBilheteDAO.obtenerTodos(); + } + + @Override + public PacoteDescontoBilhete obtenerID(Long id) { + return pacoteDescontoBilheteDAO.obtenerID(id); + } + + @Override + @Transactional + public PacoteDescontoBilhete suscribir(PacoteDescontoBilhete entidad) { + entidad.setActivo(true); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return pacoteDescontoBilheteDAO.suscribir(entidad); + } + + @Override + @Transactional + public PacoteDescontoBilhete actualizacion(PacoteDescontoBilhete entidad) { + entidad.setFecmodif(new Date()); + return pacoteDescontoBilheteDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PacoteDescontoBilhete entidad) { + entidad.setActivo(false); + entidad.setFecmodif(new Date()); + actualizacion(entidad); + } + + @Override + public List obtenerTodos(Integer pacoteId) { + return pacoteDescontoBilheteDAO.obtenerTodos(pacoteId); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteItemServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteItemServiceImpl.java new file mode 100644 index 000000000..1a7eb4c8f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteItemServiceImpl.java @@ -0,0 +1,91 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteItemDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; +import com.rjconsultores.ventaboletos.service.PacoteItemService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteItemService") +public class PacoteItemServiceImpl implements PacoteItemService { + + @Autowired + private PacoteItemDAO pacoteItemDAO; + + @Override + public List obtenerTodos() { + return pacoteItemDAO.obtenerTodos(); + } + + @Override + public PacoteItem obtenerID(Integer id) { + return pacoteItemDAO.obtenerID(id); + } + + @Transactional + @Override + public PacoteItem suscribir(PacoteItem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteItemDAO.suscribir(entidad); + } + + @Transactional + @Override + public PacoteItem actualizacion(PacoteItem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteItemDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(PacoteItem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteItemDAO.actualizacion(entidad); + } + + @Transactional(readOnly = false) + @Override + public PacoteItem vincularItemPacote(PacoteItem pacoteItem, Pacote pacote, ItemAdicional item) { + + if (pacoteItem == null) { + pacoteItem = new PacoteItem(); + } + + pacoteItem.setItemAdicional(item); + pacoteItem.setPacote(pacote); + + if (pacoteItem.getPacoteItemId() == null) { + return suscribir(pacoteItem); + } else { + return actualizacion(pacoteItem); + } + } + + @Override + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item) { + return pacoteItemDAO.buscaPacoteItem(pacote, item); + } + + @Override + public List buscaItensPacote(Pacote pacote) { + return pacoteItemDAO.buscaItensPacote(pacote); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteServiceImpl.java new file mode 100644 index 000000000..463644eea --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteServiceImpl.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; +import com.rjconsultores.ventaboletos.service.PacoteItemService; +import com.rjconsultores.ventaboletos.service.PacoteService; +import com.rjconsultores.ventaboletos.service.PacoteTarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteService") +public class PacoteServiceImpl implements PacoteService { + + @Autowired + private PacoteDAO pacoteDAO; + + @Autowired + private PacoteTarifaService pacoteTarifaService; + + @Autowired + private PacoteItemService pacoteItemService; + + @Override + public List obtenerTodos() { + return pacoteDAO.obtenerTodos(); + } + + @Override + public Pacote obtenerID(Integer id) { + return pacoteDAO.obtenerID(id); + } + + @Transactional + @Override + public Pacote suscribir(Pacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pacoteDAO.suscribir(entidad); + } + + @Transactional + @Override + public Pacote actualizacion(Pacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pacoteDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(Pacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteDAO.actualizacion(entidad); + } + + @Override + public Boolean verificaCadastroTarifa(Pacote pacote, TipoTarifaPacote tarifa) { + + List pacoteTarifaLs = pacoteTarifaService.buscaTarifasPacote(pacote); + for (PacoteTarifa pacoteTarifa : pacoteTarifaLs) { + if (pacoteTarifa.getTipoTarifaPacote().equals(tarifa)) + return Boolean.FALSE; + } + + return Boolean.TRUE; + } + + @Override + public Boolean verificaCadastroItemAdicional(Pacote pacote, ItemAdicional item) { + List pacoteItemLs = pacoteItemService.buscaItensPacote(pacote); + + for (PacoteItem pacoteItem : pacoteItemLs) { + if (pacoteItem.getItemAdicional().equals(item)) + return Boolean.FALSE; + } + + return Boolean.TRUE; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteTarifaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteTarifaServiceImpl.java new file mode 100644 index 000000000..2e4c31ddf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PacoteTarifaServiceImpl.java @@ -0,0 +1,92 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; +import com.rjconsultores.ventaboletos.service.PacoteTarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteTarifaService") +public class PacoteTarifaServiceImpl implements PacoteTarifaService { + + @Autowired + private PacoteTarifaDAO pacoteTarifaDAO; + + @Override + public List obtenerTodos() { + return pacoteTarifaDAO.obtenerTodos(); + } + + @Override + public PacoteTarifa obtenerID(Integer id) { + return pacoteTarifaDAO.obtenerID(id); + } + + @Transactional + @Override + public PacoteTarifa suscribir(PacoteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteTarifaDAO.suscribir(entidad); + } + + @Transactional + @Override + public PacoteTarifa actualizacion(PacoteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteTarifaDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(PacoteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteTarifaDAO.actualizacion(entidad); + } + + @Transactional(readOnly = false) + @Override + public PacoteTarifa vincularPacoteTarifa(PacoteTarifa pacoteTarifa, Pacote pacote, TipoTarifaPacote tipoTarifaPacote, BigDecimal tarifa) { + + if (pacoteTarifa == null) { + pacoteTarifa = new PacoteTarifa(); + } + + pacoteTarifa.setTarifa(tarifa); + pacoteTarifa.setTipoTarifaPacote(tipoTarifaPacote); + pacoteTarifa.setPacote(pacote); + + if (pacoteTarifa.getPacotetarifaId() == null) { + return suscribir(pacoteTarifa); + } else { + return actualizacion(pacoteTarifa); + } + } + + @Override + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote) { + return pacoteTarifaDAO.buscaPacoteTarifa(pacote, tipoTarifaPacote); + } + + @Override + public List buscaTarifasPacote(Pacote pacote) { + return pacoteTarifaDAO.buscaTarifasPacote(pacote); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PaisServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PaisServiceImpl.java new file mode 100644 index 000000000..d13f543f0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PaisServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PaisDAO; +import com.rjconsultores.ventaboletos.entidad.Pais; +import com.rjconsultores.ventaboletos.service.PaisService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("paisService") +public class PaisServiceImpl implements PaisService { + + @Autowired + private PaisDAO paisDAO; + + public List obtenerTodos() { + return paisDAO.obtenerTodos(); + } + + public Pais obtenerID(Integer id) { + return paisDAO.obtenerID(id); + } + + @Transactional + public Pais suscribir(Pais entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paisDAO.suscribir(entidad); + } + + @Transactional + public Pais actualizacion(Pais entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paisDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Pais entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paisDAO.actualizacion(entidad); + } + + public List buscar(String nombpais) { + return paisDAO.buscar(nombpais); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParadaEquivalenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParadaEquivalenciaServiceImpl.java new file mode 100644 index 000000000..afdb132cd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParadaEquivalenciaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParadaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import com.rjconsultores.ventaboletos.service.ParadaEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("paradaEquivalenciaService") +public class ParadaEquivalenciaServiceImpl implements ParadaEquivalenciaService { + + @Autowired + private ParadaEquivalenciaDAO paradaEquivalenciaDAO; + + public List obtenerTodos() { + return paradaEquivalenciaDAO.obtenerTodos(); + } + + public ParadaEquivalencia obtenerID(Integer id) { + return paradaEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public ParadaEquivalencia suscribir(ParadaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public ParadaEquivalencia actualizacion(ParadaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParadaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paradaEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(Parada parada, + ComisionistaExterno comisionistaExterno, String equivalencia) { + return paradaEquivalenciaDAO.buscar(parada, comisionistaExterno, equivalencia); + } + + public List buscarEquivalencia(String equivalencia) { + return paradaEquivalenciaDAO.buscarEquivalencia(equivalencia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java new file mode 100644 index 000000000..d1cc83f2e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ParadaDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ParadaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("paradaService") +public class ParadaServiceImpl implements ParadaService { + + private static final int MAX_ANTT = 99999; + + @Autowired + private ParadaDAO paradaDAO; + @Autowired + private TramoDAO tramoDAO; + + public Parada obtenerID(Integer id) { + return paradaDAO.obtenerID(id); + } + + @Transactional + public Parada suscribirActualizar(Parada entidad) throws BusinessException { + + Integer antt = entidad.getCodantt() != null ? entidad.getCodantt() : null; + if (antt != null) { + if (antt.equals(MAX_ANTT)) { + throw new BusinessException("editarCatalogoDeParadaController.MSG.maxAntt"); + } + } + + List lsParadas = paradaDAO.buscar(entidad.getCodantt()); + + if (!lsParadas.isEmpty()) { + if (entidad.getParadaId() == null) { + throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste"); + } else { + if (!lsParadas.contains(entidad)) { + throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste"); + } + } + } + + lsParadas = paradaDAO.buscar(entidad.getDescparada(), entidad.getCveparada(), entidad.getCiudad(), entidad.getTipoParada(), entidad.getNodo()); + + if (!lsParadas.isEmpty()) { + if (entidad.getParadaId() == null) { + throw new BusinessException("MSG.Registro.Existe"); + } else { + if (!lsParadas.contains(entidad)) { + throw new BusinessException("MSG.Registro.Existe"); + } + } + } + + lsParadas = buscarCVE(entidad.getCveparada()); + + if (!lsParadas.isEmpty()) { + if (entidad.getParadaId() == null) { + throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste"); + } else { + if (!lsParadas.contains(entidad)) { + throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste"); + } + } + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getParadaId() == null) { + return paradaDAO.suscribir(entidad); + } + + return paradaDAO.actualizacion(entidad); + + } + + @Transactional + public Parada suscribir(Parada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaDAO.suscribir(entidad); + } + + @Transactional + public Parada actualizacion(Parada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Parada entidad) throws RegistroConDependenciaException { + if ((tramoDAO.count("origem", entidad) > 0l) + || (tramoDAO.count("destino", entidad) > 0l)) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paradaDAO.actualizacion(entidad); + } + + public List buscar(String descparada, String cveparada, Ciudad ciudad, + TipoParada tipoParada, Nodo nodo) { + return paradaDAO.buscar(descparada, cveparada, ciudad, tipoParada, nodo); + } + + public List buscar(String descparada) { + return paradaDAO.buscar(descparada); + } + + public List buscarCVE(String cveparada) { + return paradaDAO.buscarCVE(StringUtils.trim(cveparada)); + } + + public List buscaLike(String descparada) { + return paradaDAO.buscaLike(descparada); + } + + public List obtenerOrigenPorRuta(Ruta ruta){ + return paradaDAO.obtenerOrigenPorRuta(ruta); + } + + @Override + public List obtenerTodos() { + return paradaDAO.obtenerTodos(); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaMasivoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaMasivoServiceImpl.java new file mode 100644 index 000000000..83fa27645 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaMasivoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaMasivoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; +import com.rjconsultores.ventaboletos.service.ParamAcumulaMasivoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramAcumulaMasivoService") +public class ParamAcumulaMasivoServiceImpl implements ParamAcumulaMasivoService { + + @Autowired + private ParamAcumulaMasivoDAO paramAcumulaMasivoDAO; + + public List obtenerTodos() { + return paramAcumulaMasivoDAO.obtenerTodos(); + } + + public ParamAcumulaMasivo obtenerID(Integer id) { + return paramAcumulaMasivoDAO.obtenerID(id); + } + + @Transactional + public ParamAcumulaMasivo suscribir(ParamAcumulaMasivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaMasivoDAO.suscribir(entidad); + } + + @Transactional + public ParamAcumulaMasivo actualizacion(ParamAcumulaMasivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaMasivoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamAcumulaMasivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramAcumulaMasivoDAO.actualizacion(entidad); + } + + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo) { + return paramAcumulaMasivoDAO.buscar(paramAcumulaMasivo); + } + + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim) { + return paramAcumulaMasivoDAO.buscar(emp, min, max, fecIni, fecFim); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaPuntoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaPuntoServiceImpl.java new file mode 100644 index 000000000..22ec106c1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaPuntoServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import com.rjconsultores.ventaboletos.service.ParamAcumulaPuntoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramAcumulaPuntoService") +public class ParamAcumulaPuntoServiceImpl implements ParamAcumulaPuntoService { + + @Autowired + private ParamAcumulaPuntoDAO paramAcumulaPuntoDAO; + + public List obtenerTodos() { + return paramAcumulaPuntoDAO.obtenerTodos(); + } + + public ParamAcumulaPunto obtenerID(Integer id) { + return paramAcumulaPuntoDAO.obtenerID(id); + } + + @Transactional + public ParamAcumulaPunto suscribir(ParamAcumulaPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaPuntoDAO.suscribir(entidad); + } + + @Transactional + public ParamAcumulaPunto actualizacion(ParamAcumulaPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaPuntoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamAcumulaPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramAcumulaPuntoDAO.actualizacion(entidad); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + return paramAcumulaPuntoDAO.buscar(origem, destino, ini, fim); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamArticuloServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamArticuloServiceImpl.java new file mode 100644 index 000000000..cc10e247c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamArticuloServiceImpl.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ParamArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; +import com.rjconsultores.ventaboletos.service.ParamArticuloService; + +/** + * + * @author Administrador + */ +@Service("paramArticuloService") +public class ParamArticuloServiceImpl implements ParamArticuloService { + + @Autowired + private ParamArticuloDAO paramArticuloDAO; + + public List obtenerTodos() { + return paramArticuloDAO.obtenerTodos(); + } + + public ParamArticulo obtenerID(Integer id) { + return paramArticuloDAO.obtenerID(id); + } + + @Transactional + public ParamArticulo suscribir(ParamArticulo entidad) { + + return paramArticuloDAO.suscribir(entidad); + } + + @Transactional + public ParamArticulo actualizacion(ParamArticulo entidad) { + + return paramArticuloDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamArticulo entidad) { + + paramArticuloDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCanjePuntoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCanjePuntoServiceImpl.java new file mode 100644 index 000000000..7be46374e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCanjePuntoServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamCanjePuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import com.rjconsultores.ventaboletos.service.ParamCanjePuntoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramCanjePuntoService") +public class ParamCanjePuntoServiceImpl implements ParamCanjePuntoService { + + @Autowired + private ParamCanjePuntoDAO paramCanjePuntoDAO; + + public List obtenerTodos() { + return paramCanjePuntoDAO.obtenerTodos(); + } + + public ParamCanjePunto obtenerID(Integer id) { + return paramCanjePuntoDAO.obtenerID(id); + } + + @Transactional + public ParamCanjePunto suscribir(ParamCanjePunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCanjePuntoDAO.suscribir(entidad); + } + + @Transactional + public ParamCanjePunto actualizacion(ParamCanjePunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCanjePuntoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamCanjePunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramCanjePuntoDAO.actualizacion(entidad); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + return paramCanjePuntoDAO.buscar(origem, destino, ini, fim); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCompraPuntoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCompraPuntoServiceImpl.java new file mode 100644 index 000000000..744110144 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCompraPuntoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamCompraPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import com.rjconsultores.ventaboletos.service.ParamCompraPuntoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramCompraPuntoService") +public class ParamCompraPuntoServiceImpl implements ParamCompraPuntoService { + + @Autowired + private ParamCompraPuntoDAO paramCompraPuntoDAO; + + public List obtenerTodos() { + return paramCompraPuntoDAO.obtenerTodos(); + } + + public ParamCompraPunto obtenerID(Integer id) { + return paramCompraPuntoDAO.obtenerID(id); + } + + @Transactional + public ParamCompraPunto suscribir(ParamCompraPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCompraPuntoDAO.suscribir(entidad); + } + + @Transactional + public ParamCompraPunto actualizacion(ParamCompraPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCompraPuntoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamCompraPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramCompraPuntoDAO.actualizacion(entidad); + } + + public List buscar(Date ini, Date fim) { + return paramCompraPuntoDAO.buscar(ini, fim); + } + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto) { + return paramCompraPuntoDAO.buscar(ini, fim, cantPuntos, costoPunto); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamConexionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamConexionServiceImpl.java new file mode 100644 index 000000000..e575e4496 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamConexionServiceImpl.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ParamConexionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamConexion; +import com.rjconsultores.ventaboletos.service.ParamConexionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("paramConexionService") +public class ParamConexionServiceImpl implements ParamConexionService { + + @Autowired + private ParamConexionDAO paramConexionDAO; + @Override + @Transactional + public ParamConexion actualizacion(ParamConexion paramConexion) { + paramConexion.setFecmodif(new java.util.Date()); + paramConexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return paramConexionDAO.actualizacion(paramConexion); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCostoTarjetaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCostoTarjetaServiceImpl.java new file mode 100644 index 000000000..2b5c18c90 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamCostoTarjetaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamCostoTarjetaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; +import com.rjconsultores.ventaboletos.service.ParamCostoTarjetaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramCostoTarjetaService") +public class ParamCostoTarjetaServiceImpl implements ParamCostoTarjetaService { + + @Autowired + private ParamCostoTarjetaDAO paramCostoTarjetaDAO; + + public List obtenerTodos() { + return paramCostoTarjetaDAO.obtenerTodos(); + } + + public ParamCostoTarjeta obtenerID(Integer id) { + return paramCostoTarjetaDAO.obtenerID(id); + } + + @Transactional + public ParamCostoTarjeta suscribir(ParamCostoTarjeta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCostoTarjetaDAO.suscribir(entidad); + } + + @Transactional + public ParamCostoTarjeta actualizacion(ParamCostoTarjeta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCostoTarjetaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamCostoTarjeta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramCostoTarjetaDAO.actualizacion(entidad); + } + + public List buscar(ParamCostoTarjeta paramCostoTarjeta) { + return paramCostoTarjetaDAO.buscar(paramCostoTarjeta); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamRecoleccionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamRecoleccionServiceImpl.java new file mode 100644 index 000000000..48d39d24b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ParamRecoleccionServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamRecoleccionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; +import com.rjconsultores.ventaboletos.service.ParamRecoleccionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("paramRecoleccionService") +public class ParamRecoleccionServiceImpl implements ParamRecoleccionService { + + @Autowired + private ParamRecoleccionDAO paramRecoleccionDAO; + + public List obtenerTodos() { + return paramRecoleccionDAO.obtenerTodos(); + } + + public ParamRecoleccion obtenerID(Integer id) { + return paramRecoleccionDAO.obtenerID(id); + } + + @Transactional + public ParamRecoleccion suscribir(ParamRecoleccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramRecoleccionDAO.suscribir(entidad); + } + + @Transactional + public ParamRecoleccion actualizacion(ParamRecoleccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramRecoleccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamRecoleccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramRecoleccionDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PerfilFuncionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PerfilFuncionServiceImpl.java new file mode 100644 index 000000000..a88c99492 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PerfilFuncionServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PerfilFuncionDAO; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import com.rjconsultores.ventaboletos.service.PerfilFuncionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("perfilFuncionService") +public class PerfilFuncionServiceImpl implements PerfilFuncionService { + + @Autowired + private PerfilFuncionDAO perfilFuncionDAO; + + public List obtenerTodos() { + return perfilFuncionDAO.obtenerTodos(); + } + + public PerfilFuncion obtenerID(Integer id) { + return perfilFuncionDAO.obtenerID(id); + } + + @Transactional + public PerfilFuncion suscribir(PerfilFuncion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilFuncionDAO.suscribir(entidad); + } + + @Transactional + public PerfilFuncion actualizacion(PerfilFuncion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilFuncionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PerfilFuncion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + perfilFuncionDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PerfilServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PerfilServiceImpl.java new file mode 100644 index 000000000..aafb62089 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PerfilServiceImpl.java @@ -0,0 +1,151 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import com.rjconsultores.ventaboletos.service.PerfilService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("perfilService") +public class PerfilServiceImpl implements PerfilService { + + @Autowired + private PerfilDAO perfilDAO; + + public List obtenerTodos() { + return perfilDAO.obtenerTodos(); + } + + public Perfil obtenerID(Integer id) { + return perfilDAO.obtenerID(id); + } + + @Transactional + public Perfil suscribir(Perfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilDAO.suscribir(entidad); + } + + @Transactional + public Perfil actualizacion(Perfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Perfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + perfilDAO.actualizacion(entidad); + } + + public List buscar(String dscPerfil) { + return perfilDAO.buscar(dscPerfil); + } + + public List buscaPerfilJerarquia(Perfil perfilUsuario) { + return perfilDAO.buscaPerfilJerarquia(perfilUsuario); + } + + @Transactional + public Boolean clonarPerfil(Integer perfilId, String nomePerfil) { + + Perfil perfil = this.obtenerID(perfilId); + Perfil clonePerfil = new Perfil(); + + clonePerfil.setDescperfil(nomePerfil); + +// clonePerfil.setActivo(perfil.getActivo()); o método actualizacion ja seta os campos activo usuario e fecmodif + clonePerfil.setIndJerarquia(perfil.getIndJerarquia()); + clonePerfil.setPerfilFuncionList(new ArrayList()); + clonePerfil.setUsuarioPerfilList(new ArrayList()); + + + clonePerfil = suscribir(clonePerfil); + + clonePerfil = percorrerPerfilAtivoParaClonar(perfil, clonePerfil); + + + actualizacion(clonePerfil); + +// inativar(clonePricing); + + if (clonePerfil.getPerfilId() != null) { + return true; + } else { + return false; + } + } + + private Perfil percorrerPerfilAtivoParaClonar(Perfil perfil, Perfil clonePerfil) { + + List usuarioPerfilList = new ArrayList(); + for(UsuarioPerfil usuarioPerfil : perfil.getUsuarioPerfilList()){ + UsuarioPerfil cloneUsuarioPerfil = new UsuarioPerfil(); + cloneUsuarioPerfil.setActivo(usuarioPerfil.getActivo()); + cloneUsuarioPerfil.setFecmodif(Calendar.getInstance().getTime()); + cloneUsuarioPerfil.setPerfil(clonePerfil); + cloneUsuarioPerfil.setUsuario(usuarioPerfil.getUsuario()); + cloneUsuarioPerfil.setUsuariomodifId(usuarioPerfil.getUsuariomodifId()); + cloneUsuarioPerfil.setUsuarioperfilId(usuarioPerfil.getUsuarioperfilId()); + usuarioPerfilList.add(cloneUsuarioPerfil); + } + clonePerfil.setUsuarioPerfilList(usuarioPerfilList); + + List perfilFuncionList = new ArrayList(); + for(PerfilFuncion perfilFuncion : perfil.getPerfilFuncionList()){ + PerfilFuncion clonePerfilFuncion = new PerfilFuncion(); + clonePerfilFuncion.setActivo(perfilFuncion.getActivo()); + clonePerfilFuncion.setFecmodif(Calendar.getInstance().getTime()); + clonePerfilFuncion.setFuncionSistema(perfilFuncion.getFuncionSistema()); + clonePerfilFuncion.setIndLectura(perfilFuncion.getIndLectura()); + clonePerfilFuncion.setPerfil(clonePerfil); + clonePerfilFuncion.setUsuarioId(perfilFuncion.getUsuarioId()); + perfilFuncionList.add(clonePerfilFuncion); + } + clonePerfil.setPerfilFuncionList(perfilFuncionList); + + return clonePerfil; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PeriodoVacacionalServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PeriodoVacacionalServiceImpl.java new file mode 100644 index 000000000..dde4476d9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PeriodoVacacionalServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PeriodoVacacionalDAO; +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; +import com.rjconsultores.ventaboletos.service.PeriodoVacacionalService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("periodoVacacionalService") +public class PeriodoVacacionalServiceImpl implements PeriodoVacacionalService { + + @Autowired + private PeriodoVacacionalDAO periodoVacacionalDAO; + + public List obtenerTodos() { + return periodoVacacionalDAO.obtenerTodos(); + } + + public PeriodoVacacional obtenerID(Integer id) { + return periodoVacacionalDAO.obtenerID(id); + } + + @Transactional + public PeriodoVacacional suscribir(PeriodoVacacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return periodoVacacionalDAO.suscribir(entidad); + } + + @Transactional + public PeriodoVacacional actualizacion(PeriodoVacacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return periodoVacacionalDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PeriodoVacacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + periodoVacacionalDAO.actualizacion(entidad); + } + + public List buscar(Date dataInicio, Date dataFim) { + return periodoVacacionalDAO.buscar(dataInicio, dataFim); + } + + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional) { + return periodoVacacionalDAO.buscarFechaTraslapa(periodoVacacional); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PlazaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PlazaServiceImpl.java new file mode 100644 index 000000000..11650129e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PlazaServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PlazaDAO; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.service.PlazaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("plazaService") +public class PlazaServiceImpl implements PlazaService { + + @Autowired + private PlazaDAO plazaDAO; + + public List obtenerTodos() { + return plazaDAO.obtenerTodos(); + } + + public Plaza obtenerID(Integer id) { + return plazaDAO.obtenerID(id); + } + + @Transactional + public Plaza suscribir(Plaza entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return plazaDAO.suscribir(entidad); + } + + @Transactional + public Plaza actualizacion(Plaza entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return plazaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Plaza entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + plazaDAO.actualizacion(entidad); + } + + public List buscar(String nombplaza) { + return plazaDAO.buscar(nombplaza); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PrecioVentajaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PrecioVentajaServiceImpl.java new file mode 100644 index 000000000..6e02e517b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PrecioVentajaServiceImpl.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.dao.PrecioVentajaDAO; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.PrecioVentajaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Igor + */ +@Service("precioVentajaService") +public class PrecioVentajaServiceImpl implements PrecioVentajaService { + + @Autowired + private PrecioVentajaDAO precioVentajaDAO; + + @Autowired + private RutaService rutaService; + + public List obtenerTodos() { + return null; + } + + public PrecioVentaja obtenerID(Integer id) { + return null; + } + + @Transactional + public PrecioVentaja suscribirActualizacion(PrecioVentaja entidad) throws BusinessException { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + + if(!verificarPreenhimentoLinhaOriginal(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.linha.original"); + } + + if(!verificarPreenchimentoOrigemDestinoOriginais(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.origem.destino.originais"); + } + + if(!verificarPreenhimentoLinhaASerCopiada(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.linhaASerCopiada"); + } + + if(!verificarPreenchimentoOrigemDestinoASeremCopiados(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.origem.destinoASeremCopiados"); + } + + if(!verificarPreenchimentoDataInicioFim(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.data.InicioFim"); + } + + if(!verificarRutaOrigemDestinoOriginal(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.destinoOuOrigemNaoExistemOriginal"); + } + + if(!verificarRutaOrigemDestinoASerCopiado(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.destinoOuOrigemNaoExistemDestino"); + } + + Boolean precioVentajaDuplicado = validarDuplicidade(entidad); + + if (precioVentajaDuplicado) { + throw new BusinessException("editarPrecioVentajaController.MSG.data.existeIgual", new Object[] { entidad.getOrigenOriginalId().getDescparada(), + entidad.getDestinoOriginalId().getDescparada(), entidad.getRutaOriginalId().getDescruta() }); + } + + + + if (entidad.getPrecioVentajaId() == null) { + return precioVentajaDAO.suscribir(entidad); + } else { + return precioVentajaDAO.actualizacion(entidad); + } + } + + private Boolean validarDuplicidade(PrecioVentaja entidad) { + List lsPrecioVentaja = precioVentajaDAO.buscarPrecioVentaja(entidad.getOrigenOriginalId().getParadaId(), entidad.getDestinoOriginalId().getParadaId(), entidad.getRutaOriginalId().getRutaId()); + Boolean precioVentajaDuplicado = false; + + if (!lsPrecioVentaja.isEmpty()) { + + if (entidad.getPrecioVentajaId() == null){ + precioVentajaDuplicado = Boolean.TRUE; + }else{ + for (PrecioVentaja est : lsPrecioVentaja) { + if (!est.getPrecioVentajaId().equals(entidad.getPrecioVentajaId())) { + precioVentajaDuplicado = Boolean.TRUE; + break; + } + } + } + } + + return precioVentajaDuplicado; + } + + private Boolean verificarPreenchimentoDataInicioFim(PrecioVentaja entidad){ + if(entidad.getFechaInicio() == null || entidad.getFechaFinal() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenchimentoOrigemDestinoASeremCopiados(PrecioVentaja entidad){ + if(entidad.getOrigenPrecioId() == null || entidad.getDestinoPrecioId() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenhimentoLinhaASerCopiada(PrecioVentaja entidad) { + if(entidad.getRutaPrecioId() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenchimentoOrigemDestinoOriginais(PrecioVentaja entidad){ + if(entidad.getOrigenOriginalId() == null || entidad.getDestinoOriginalId() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenhimentoLinhaOriginal(PrecioVentaja entidad) { + if(entidad.getRutaOriginalId() == null){ + return false; + } + return true; + } + + private Boolean verificarRutaOrigemDestinoOriginal(PrecioVentaja entidad) { + Boolean existeOrigemOriginal = rutaService.paradaExisteEnLaRuta(entidad.getOrigenOriginalId(), entidad.getRutaOriginalId()); + Boolean exiteDestinoOriginal = rutaService.paradaExisteEnLaRuta(entidad.getDestinoOriginalId(), entidad.getRutaOriginalId()); + return existeOrigemOriginal && exiteDestinoOriginal; + } + + private Boolean verificarRutaOrigemDestinoASerCopiado(PrecioVentaja entidad) { + Boolean exiteOrigemASerCopiado = rutaService.paradaExisteEnLaRuta(entidad.getOrigenPrecioId(), entidad.getRutaPrecioId()); + Boolean exiteDestinoASerCopiado = rutaService.paradaExisteEnLaRuta(entidad.getDestinoPrecioId(), entidad.getRutaPrecioId()); + return exiteOrigemASerCopiado && exiteDestinoASerCopiado; + } + + + @Transactional + public void borrar(PrecioVentaja entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + precioVentajaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java new file mode 100644 index 000000000..47470d92f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PrecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; +import com.rjconsultores.ventaboletos.service.PrecoApanheService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("precoApanheService") +public class PrecoApanheServiceImpl implements PrecoApanheService { + + @Autowired + private PrecoApanheDAO precoApanheDAO; + + public List obtenerTodos() { + return precoApanheDAO.obtenerTodos(); + } + + public PrecoApanhe obtenerID(Integer id) { + return precoApanheDAO.obtenerID(id); + } + + @Transactional + public PrecoApanhe suscribir(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return precoApanheDAO.suscribir(entidad); + } + + @Transactional + public PrecoApanhe actualizacion(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return precoApanheDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + precoApanheDAO.actualizacion(entidad); + } + + public List buscar(String deschotel, String desccolonia, String nombciudad) { + return precoApanheDAO.buscar(deschotel, desccolonia, nombciudad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingAsientoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingAsientoServiceImpl.java new file mode 100644 index 000000000..4cd0a2af6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingAsientoServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingAsientoDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import com.rjconsultores.ventaboletos.service.PricingAsientoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingAsientoService") +public class PricingAsientoServiceImpl implements PricingAsientoService { + + @Autowired + private PricingAsientoDAO pricingAsientoDAO; + + public List obtenerTodos() { + return pricingAsientoDAO.obtenerTodos(); + } + + public PricingAsiento obtenerID(Integer id) { + return pricingAsientoDAO.obtenerID(id); + } + + @Transactional + public PricingAsiento suscribir(PricingAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingAsientoDAO.suscribir(entidad); + } + + @Transactional + public PricingAsiento actualizacion(PricingAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingAsientoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingAsientoDAO.actualizacion(entidad); + } + + public List obtenerPricingCategoria(Pricing pricing, Integer asiento) { + return pricingAsientoDAO.obtenerPricingCategoria(pricing, asiento); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingCategoriaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingCategoriaServiceImpl.java new file mode 100644 index 000000000..0f2b51b1a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingCategoriaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; +import com.rjconsultores.ventaboletos.service.PricingCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingCategoriaService") +public class PricingCategoriaServiceImpl implements PricingCategoriaService { + + @Autowired + private PricingCategoriaDAO pricingCategoriaDAO; + + public List obtenerTodos() { + return pricingCategoriaDAO.obtenerTodos(); + } + + public PricingCategoria obtenerID(Integer id) { + return pricingCategoriaDAO.obtenerID(id); + } + + @Transactional + public PricingCategoria suscribir(PricingCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCategoriaDAO.suscribir(entidad); + } + + @Transactional + public PricingCategoria actualizacion(PricingCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingCategoriaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria) { + return pricingCategoriaDAO.obtenerPricingCategoria(pricing, categoria); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingClaseServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingClaseServiceImpl.java new file mode 100644 index 000000000..6c2aaa38c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingClaseServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import com.rjconsultores.ventaboletos.service.PricingClaseService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingClaseService") +public class PricingClaseServiceImpl implements PricingClaseService { + + @Autowired + private PricingClaseDAO pricingClaseDAO; + + public List obtenerTodos() { + return pricingClaseDAO.obtenerTodos(); + } + + public PricingClase obtenerID(Integer id) { + return pricingClaseDAO.obtenerID(id); + } + + @Transactional + public PricingClase suscribir(PricingClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingClaseDAO.suscribir(entidad); + } + + @Transactional + public PricingClase actualizacion(PricingClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingClaseDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingClaseDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio) { + return pricingClaseDAO.obtenerPricingClase(pricing, claseServicio); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingClasseTarifariaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingClasseTarifariaServiceImpl.java new file mode 100644 index 000000000..c19d998da --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingClasseTarifariaServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingClasseTarifariaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; +import com.rjconsultores.ventaboletos.service.PricingClasseTarifariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingClasseTarifariaService") +public class PricingClasseTarifariaServiceImpl implements PricingClasseTarifariaService { + + @Autowired + private PricingClasseTarifariaDAO pricingClasseTarifariaDAO; + + @Override + public List obtenerTodos() { + return pricingClasseTarifariaDAO.obtenerTodos(); + } + + @Override + public PricingClasseTarifaria obtenerID(Integer id) { + return pricingClasseTarifariaDAO.obtenerID(id); + } + + @Override + @Transactional + public PricingClasseTarifaria suscribir(PricingClasseTarifaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return pricingClasseTarifariaDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingClasseTarifaria actualizacion(PricingClasseTarifaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return pricingClasseTarifariaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PricingClasseTarifaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + pricingClasseTarifariaDAO.actualizacion(entidad); + } + + public Boolean validacionSigla(String sigla) { + return pricingClasseTarifariaDAO.validacionSigla(sigla); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingCorridaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingCorridaServiceImpl.java new file mode 100644 index 000000000..fc0fe03b6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingCorridaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; +import com.rjconsultores.ventaboletos.service.PricingCorridaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingCorridaService") +public class PricingCorridaServiceImpl implements PricingCorridaService { + + @Autowired + private PricingCorridaDAO pricingCorridaDAO; + + public List obtenerTodos() { + return pricingCorridaDAO.obtenerTodos(); + } + + public PricingCorrida obtenerID(Integer id) { + return pricingCorridaDAO.obtenerID(id); + } + + @Transactional + public PricingCorrida suscribir(PricingCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCorridaDAO.suscribir(entidad); + } + + @Transactional + public PricingCorrida actualizacion(PricingCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCorridaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingCorridaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida) { + return pricingCorridaDAO.obtenerPricingCorrida(pricing, corrida); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingDiaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingDiaServiceImpl.java new file mode 100644 index 000000000..539f08af6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingDiaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingDiaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import com.rjconsultores.ventaboletos.service.PricingDiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingDiaService") +public class PricingDiaServiceImpl implements PricingDiaService { + + @Autowired + private PricingDiaDAO pricingDiaDAO; + + public List obtenerTodos() { + return pricingDiaDAO.obtenerTodos(); + } + + public PricingDia obtenerID(Integer id) { + return pricingDiaDAO.obtenerID(id); + } + + @Transactional + public PricingDia suscribir(PricingDia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDiaDAO.suscribir(entidad); + } + + @Transactional + public PricingDia actualizacion(PricingDia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDiaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingDia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingDiaDAO.actualizacion(entidad); + } + + public List buscarTraslapa(PricingDia pricingDia) { + return pricingDiaDAO.buscarTraslapa(pricingDia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoOcupacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoOcupacionServiceImpl.java new file mode 100644 index 000000000..920b67728 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoOcupacionServiceImpl.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; +import com.rjconsultores.ventaboletos.service.PricingEspecificoOcupacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingEspecificoOcupacionService") +public class PricingEspecificoOcupacionServiceImpl implements PricingEspecificoOcupacionService { + @Autowired + private PricingEspecificoOcupacionDAO pricingEspecificoOcupacionDAO; + + @Override + public List obtenerTodos() { + return pricingEspecificoOcupacionDAO.obtenerTodos(); + } + + @Override + public PricingEspecificoOcupacion obtenerID(Long id) { + return pricingEspecificoOcupacionDAO.obtenerID(id); + } + + @Override + public PricingEspecificoOcupacion suscribir(PricingEspecificoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoOcupacionDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingEspecificoOcupacion actualizacion(PricingEspecificoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pricingEspecificoOcupacionDAO.actualizacion(entidad); + } + + @Override + public void borrar(PricingEspecificoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pricingEspecificoOcupacionDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoServiceImpl.java new file mode 100644 index 000000000..d5b68a93f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoServiceImpl.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.service.PricingEspecificoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingEspecificoService") +public class PricingEspecificoServiceImpl implements PricingEspecificoService { + + @Autowired + private PricingEspecificoDAO pricingEspecificoDAO; + + public List obtenerTodos() { + return pricingEspecificoDAO.obtenerTodos(); + } + + public PricingEspecifico obtenerID(Long id) { + return pricingEspecificoDAO.obtenerID(id); + } + + @Transactional + public PricingEspecifico suscribir(PricingEspecifico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoDAO.suscribir(entidad); + } + + @Transactional + public PricingEspecifico actualizacion(PricingEspecifico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingEspecifico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pricingEspecificoDAO.actualizacion(entidad); + } + + public List buscarPorNome(PricingEspecifico pricingEspecifico) { + return pricingEspecificoDAO.buscarPorNome(pricingEspecifico); + } + + @Override + public List buscarPorNome(String nome) { + // TODO Auto-generated method stub + return null; + } + + @Override + @Transactional + public PricingEspecifico clonarPricing(Long id, String nome) { + + PricingEspecifico pricingToClone = obtenerID(id); + PricingEspecifico clonePricing = new PricingEspecifico(); + + clonePricing.setNombPricing(nome); + clonePricing.setCategoria(pricingToClone.getCategoria()); + clonePricing.setClaseServicio(pricingToClone.getClaseServicio()); + clonePricing.setCorridaId(pricingToClone.getCorridaId()); + clonePricing.setFechorfin(pricingToClone.getFechorfin()); + clonePricing.setFechorinicio(pricingToClone.getFechorinicio()); + clonePricing.setMarca(pricingToClone.getMarca()); + clonePricing.setMoneda(pricingToClone.getMoneda()); + clonePricing.setParada(pricingToClone.getParada()); + clonePricing.setParada1(pricingToClone.getParada1()); + clonePricing.setPricingEspecificoOcupacionsList(getPricingEspecificoOcupacion(pricingToClone, clonePricing)); + clonePricing.setTarifa(pricingToClone.getTarifa()); + clonePricing.setTarifaredabierto(pricingToClone.getTarifaredabierto()); + clonePricing.setTipoPtovta(pricingToClone.getTipoPtovta()); + + return suscribir(clonePricing); + } + + private List getPricingEspecificoOcupacion(PricingEspecifico pricingToClone, PricingEspecifico clonePricing){ + + List list = new ArrayList(); + + for(PricingEspecificoOcupacion peo : pricingToClone.getPricingEspecificoOcupacionsList()){ + PricingEspecificoOcupacion newPeo = new PricingEspecificoOcupacion(); + newPeo.setActivo(peo.getActivo()); + newPeo.setFecmodif(new Date()); + newPeo.setOcupacionfinal(peo.getOcupacionfinal()); + newPeo.setOcupacioninicial(peo.getOcupacioninicial()); + newPeo.setPricingEspecifico(clonePricing); + newPeo.setTarifa(peo.getTarifa()); + newPeo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + list.add(newPeo); + } + + return list; + } + + @Override + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal) { + return pricingEspecificoDAO.buscar(empresas, tipoClasses, origens, destinos, vigenciaInicial, vigenciaFinal); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingFormapagoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingFormapagoServiceImpl.java new file mode 100644 index 000000000..2dc8b3e1d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingFormapagoServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingFormapagoDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; +import com.rjconsultores.ventaboletos.service.PricingFormapagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingFormapagoService") +public class PricingFormapagoServiceImpl implements PricingFormapagoService { + + @Autowired + private PricingFormapagoDAO pricingFormapagoDAO; + + @Override + public List obtenerTodos() { + return pricingFormapagoDAO.obtenerTodos(); + } + + @Override + public PricingFormapago obtenerID(Integer id) { + return pricingFormapagoDAO.obtenerID(id); + } + + @Transactional + public PricingFormapago suscribir(PricingFormapago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingFormapagoDAO.suscribir(entidad); + + } + + @Transactional + public PricingFormapago actualizacion(PricingFormapago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingFormapagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingFormapago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingFormapagoDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingImporteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingImporteServiceImpl.java new file mode 100644 index 000000000..87761106d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingImporteServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingImporteDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import com.rjconsultores.ventaboletos.service.PricingImporteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingImporteService") +public class PricingImporteServiceImpl implements PricingImporteService { + + @Autowired + private PricingImporteDAO pricingImporteDAO; + + public List obtenerTodos() { + return pricingImporteDAO.obtenerTodos(); + } + + public PricingImporte obtenerID(Integer id) { + return pricingImporteDAO.obtenerID(id); + } + + @Transactional + public PricingImporte suscribir(PricingImporte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingImporteDAO.suscribir(entidad); + } + + @Transactional + public PricingImporte actualizacion(PricingImporte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingImporteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingImporte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingImporteDAO.actualizacion(entidad); + } + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda) { + return pricingImporteDAO.buscarMoneda(pricingImporte, moneda); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingMarcaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingMarcaServiceImpl.java new file mode 100644 index 000000000..b52e5b523 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingMarcaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; +import com.rjconsultores.ventaboletos.service.PricingMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingMarcaService") +public class PricingMarcaServiceImpl implements PricingMarcaService { + + @Autowired + private PricingMarcaDAO pricingMarcaDAO; + + public List obtenerTodos() { + return pricingMarcaDAO.obtenerTodos(); + } + + public PricingMarca obtenerID(Integer id) { + return pricingMarcaDAO.obtenerID(id); + } + + @Transactional + public PricingMarca suscribir(PricingMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMarcaDAO.suscribir(entidad); + } + + @Transactional + public PricingMarca actualizacion(PricingMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingMarcaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca) { + return pricingMarcaDAO.obtenerPricingMarca(pricing, marca); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingMercadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingMercadoServiceImpl.java new file mode 100644 index 000000000..966c445b4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingMercadoServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; +import com.rjconsultores.ventaboletos.service.PricingMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingMercadoService") +public class PricingMercadoServiceImpl implements PricingMercadoService { + + @Autowired + private PricingMercadoDAO pricingMercadoDAO; + + public List obtenerTodos() { + return pricingMercadoDAO.obtenerTodos(); + } + + public PricingMercado obtenerID(Integer id) { + return pricingMercadoDAO.obtenerID(id); + } + + @Transactional + public PricingMercado suscribir(PricingMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMercadoDAO.suscribir(entidad); + } + + @Transactional + public PricingMercado actualizacion(PricingMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingMercadoDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino) { + return pricingMercadoDAO.obtenerPricingMercado(pricing, origen, destino); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java new file mode 100644 index 000000000..fb2338a2c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java @@ -0,0 +1,124 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingOcupaAntecipaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.PricingOcupaAntecipaService; +import com.rjconsultores.ventaboletos.utilerias.TraslaparUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingOcupacionService") +public class PricingOcupaAntecipaServiceImpl implements PricingOcupaAntecipaService { + + private static final Logger log = LoggerFactory.getLogger(PricingOcupaAntecipaServiceImpl.class); + + @Autowired + private PricingOcupaAntecipaDAO pricingOcupacionDAO; + + @Transactional + public PricingOcupaAntecipa suscribir(PricingOcupaAntecipa entidad) throws BusinessException { + if (traslapa(entidad)) { + throw new BusinessException("PricingOcupaAntecipaServiceImpl.msg.traslapa"); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingOcupacionDAO.suscribir(entidad); + } + + @Transactional(rollbackFor = BusinessException.class) + public PricingOcupaAntecipa actualizacion(PricingOcupaAntecipa entidad) throws BusinessException { + if (traslapa(entidad)) { + throw new BusinessException("PricingOcupaAntecipaServiceImpl.msg.traslapa"); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingOcupacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingOcupaAntecipa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingOcupacionDAO.actualizacion(entidad); + } + + public List updateList(PricingOcupaAntecipa pricingOcupaAntecipa) { + List lsSalvos = pricingOcupacionDAO.buscarOcupaAntecipaPricing(pricingOcupaAntecipa.getPricing().getPricingId()); + return lsSalvos; + } + + private boolean traslapa(PricingOcupaAntecipa pricingOcupaAntecipa) { + + boolean traslapa = false; + List lsSalvos = pricingOcupacionDAO.buscarOcupaAntecipaPricing(pricingOcupaAntecipa.getPricing().getPricingId()); + + // removo o pricing que eu estou validando + lsSalvos.remove(pricingOcupaAntecipa); + + BigDecimal cantocupaini = pricingOcupaAntecipa.getOcupacioninicial(); + BigDecimal cantocupafin = pricingOcupaAntecipa.getOcupacionfinal(); + + boolean validaCantPorcentaje = ((cantocupaini != null) && (cantocupafin != null)); + + Integer cantasientosmin = pricingOcupaAntecipa.getCantasientosmin(); + Integer cantasientosmax = pricingOcupaAntecipa.getCantasientosmax(); + + boolean validaCantAsientos = ((cantasientosmin != null) && (cantasientosmax != null)); + + Integer cantdiasmin = pricingOcupaAntecipa.getCantdiasmin(); + Integer cantdiasmax = pricingOcupaAntecipa.getCantdiasmax(); + + boolean validaCantDias = ((cantdiasmin != null) && (cantdiasmax != null)); + + for (PricingOcupaAntecipa poa : lsSalvos) { + boolean traslapaCantPorcentaje = false; + if (validaCantPorcentaje) { + if ((poa.getOcupacioninicial() != null) && (poa.getOcupacionfinal() != null)) { + traslapaCantPorcentaje = TraslaparUtil.intersectNum(poa.getOcupacioninicial(), poa.getOcupacionfinal(), cantocupaini, cantocupafin); + } + } + + boolean traslapaCantAsiento = false; + if (validaCantAsientos) { + if ((poa.getCantasientosmin() != null) && (poa.getCantasientosmax() != null)) { + traslapaCantAsiento = TraslaparUtil.intersectNum(poa.getCantasientosmin(), poa.getCantasientosmax(), cantasientosmin, cantasientosmax); + } + } + + boolean traslapaCantDias = false; + if (validaCantDias) { + if ((poa.getCantdiasmin() != null) && (poa.getCantdiasmax() != null)) { + traslapaCantDias = TraslaparUtil.intersectNum(poa.getCantdiasmin(), poa.getCantdiasmax(), cantdiasmin, cantdiasmax); + } + } + + if ((traslapaCantPorcentaje || traslapaCantAsiento ) && traslapaCantDias ){ + log.info("registro que traslapa PricingOcupaAntecipa id =" + poa.getPricingocupaantecipaId()); + + traslapa = true; + + break; + } + + } + + return traslapa; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingPuntoVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingPuntoVentaServiceImpl.java new file mode 100644 index 000000000..990c4c26f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingPuntoVentaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.PricingPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingPuntoVentaService") +public class PricingPuntoVentaServiceImpl implements PricingPuntoVentaService { + + @Autowired + private PricingPuntoVentaDAO pricingPuntoVentaDAO; + + public List obtenerTodos() { + return pricingPuntoVentaDAO.obtenerTodos(); + } + + public PricingPuntoVenta obtenerID(Integer id) { + return pricingPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public PricingPuntoVenta suscribir(PricingPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public PricingPuntoVenta actualizacion(PricingPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingPuntoVentaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta) { + return pricingPuntoVentaDAO.obtenerPricingPuntoVenta(pricing, puntoVenta); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingRutaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingRutaServiceImpl.java new file mode 100644 index 000000000..c564bd4f5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingRutaServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingRutaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.PricingRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingRutaService") +public class PricingRutaServiceImpl implements PricingRutaService { + + @Autowired + private PricingRutaDAO pricingRutaDAO; + + public List obtenerTodos() { + return pricingRutaDAO.obtenerTodos(); + } + + public PricingRuta obtenerID(Integer id) { + return pricingRutaDAO.obtenerID(id); + } + + @Transactional + public PricingRuta suscribir(PricingRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingRutaDAO.suscribir(entidad); + } + + @Transactional + public PricingRuta actualizacion(PricingRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingRutaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingRutaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta) { + return pricingRutaDAO.obtenerPricingRuta(pricing, ruta); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java new file mode 100644 index 000000000..e8751a041 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java @@ -0,0 +1,502 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import com.rjconsultores.ventaboletos.service.PricingService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("pricingService") +public class PricingServiceImpl implements PricingService { + + @Autowired + private PricingDAO pricingDAO; + + public List obtenerTodos() { + return pricingDAO.obtenerTodos(); + } + + public Pricing obtenerID(Integer id) { + return pricingDAO.obtenerID(id); + } + + @Transactional + public Pricing suscribir(Pricing entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDAO.suscribir(entidad); + } + + @Transactional + public Pricing actualizacion(Pricing entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDAO.actualizacion(entidad); + } + + private void ativarInativarExcluirPricing(Pricing entidad, Integer statusPricing, Integer ativarInativarExcluir) { + entidad = obtenerID(entidad.getPricingId()); + + for (PricingAsiento pricingAsiento : entidad.getPricingAsientoList()) { + pricingAsiento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingAsiento.setFecmodif(Calendar.getInstance().getTime()); + pricingAsiento.setActivo(ativarInativarExcluir); + } + + for (PricingCategoria pricingCategoria : entidad.getPricingCategoriaList()) { + pricingCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingCategoria.setFecmodif(Calendar.getInstance().getTime()); + pricingCategoria.setActivo(ativarInativarExcluir); + } + + for (PricingClase pricingClase : entidad.getPricingClaseList()) { + pricingClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingClase.setFecmodif(Calendar.getInstance().getTime()); + pricingClase.setActivo(ativarInativarExcluir); + } + + for (PricingCorrida pricingCorrida : entidad.getPricingCorridaList()) { + pricingCorrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingCorrida.setFecmodif(Calendar.getInstance().getTime()); + pricingCorrida.setActivo(ativarInativarExcluir); + } + + for (PricingDia pricingDia : entidad.getPricingDiaList()) { + pricingDia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingDia.setFecmodif(Calendar.getInstance().getTime()); + pricingDia.setActivo(ativarInativarExcluir); + } + + for (PricingImporte pricingImporte : entidad.getPricingImporteList()) { + pricingImporte.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingImporte.setFecmodif(Calendar.getInstance().getTime()); + pricingImporte.setActivo(ativarInativarExcluir); + } + + for (PricingMarca pricingMarca : entidad.getPricingMarcaList()) { + pricingMarca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingMarca.setFecmodif(Calendar.getInstance().getTime()); + pricingMarca.setActivo(ativarInativarExcluir); + } + + for (PricingMercado pricingMercado : entidad.getPricingMercadoList()) { + pricingMercado.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingMercado.setFecmodif(Calendar.getInstance().getTime()); + pricingMercado.setActivo(ativarInativarExcluir); + } + + for (PricingOcupaAntecipa pricingOcupaAntecipa : entidad.getPricingOcupaAntecipaList()) { + pricingOcupaAntecipa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingOcupaAntecipa.setFecmodif(Calendar.getInstance().getTime()); + pricingOcupaAntecipa.setActivo(ativarInativarExcluir); + } + + for (PricingPuntoVenta pricingPuntoVenta : entidad.getPricingPuntoventaList()) { + pricingPuntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingPuntoVenta.setFecmodif(Calendar.getInstance().getTime()); + pricingPuntoVenta.setActivo(ativarInativarExcluir); + } + + for (PricingRuta pricingRuta : entidad.getPricingRutaList()) { + pricingRuta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingRuta.setFecmodif(Calendar.getInstance().getTime()); + pricingRuta.setActivo(ativarInativarExcluir); + } + + for (PricingTipoPtoVta pricingTipoPtoVta : entidad.getPricingTipoptovtaList()) { + pricingTipoPtoVta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingTipoPtoVta.setFecmodif(Calendar.getInstance().getTime()); + pricingTipoPtoVta.setActivo(ativarInativarExcluir); + } + + for (PricingVigencia pricingVigencia : entidad.getPricingVigenciaList()) { + pricingVigencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingVigencia.setFecmodif(Calendar.getInstance().getTime()); + pricingVigencia.setActivo(ativarInativarExcluir); + } + + for (PricingTipoServicio pricingTipoServicio : entidad.getPricingTipoServicioList()) { + pricingTipoServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingTipoServicio.setFecmodif(Calendar.getInstance().getTime()); + pricingTipoServicio.setActivo(ativarInativarExcluir); + } + + for (PricingFormapago pricingFormapago : entidad.getPricingFormapagoList()) { + pricingFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingFormapago.setFecmodif(Calendar.getInstance().getTime()); + pricingFormapago.setActivo(ativarInativarExcluir); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ativarInativarExcluir); + + pricingDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Pricing entidad) { + ativarInativarExcluirPricing(entidad, Pricing.ATIVO, Pricing.EXCLUIDO); + } + + @Transactional + public void inativar(Pricing entidad) { + ativarInativarExcluirPricing(entidad, Pricing.ATIVO, Pricing.INATIVO); + } + + @Transactional + public void ativar(Pricing entidad) { + ativarInativarExcluirPricing(entidad, Pricing.INATIVO, Pricing.ATIVO); + } + + @Transactional + public void borrarFisico(Pricing entidad) { + borrar(entidad); + } + + public List buscar(String nombPricing, Empresa empresa, Short cantboleto, + Integer cantdiasanticipacion, BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo) { + return pricingDAO.buscar(nombPricing, empresa, cantboleto, cantdiasanticipacion, descuentoporcentaje, descuentoporcredondo); + } + + public List buscarPorNombre(String nombPricing) { + return pricingDAO.buscarPorNombre(nombPricing); + } + + @Transactional + public Boolean clonarPricing(Integer pricingId, String nomePricing) { + + Pricing pricing = this.obtenerID(pricingId); + Pricing clonePricing = new Pricing(); + + clonePricing.setNombPricing(nomePricing); + + clonePricing.setCantboleto(pricing.getCantboleto()); + clonePricing.setCantdiasanticipacion(pricing.getCantdiasanticipacion()); + clonePricing.setDescuentoporcentaje(pricing.getDescuentoporcentaje()); + clonePricing.setDescuentoporcredondo(pricing.getDescuentoporcredondo()); + clonePricing.setEmpresa(pricing.getEmpresa()); + clonePricing.setIndcancelable(pricing.getIndcancelable()); + clonePricing.setIndGeneraFeriadoVenta(pricing.getIndGeneraFeriadoVenta()); + clonePricing.setIndGeneraFeriadoViaje(pricing.getIndGeneraFeriadoViaje()); + clonePricing.setIndtransferible(pricing.getIndtransferible()); + + clonePricing.setPricingAsientoList(new ArrayList()); + clonePricing.setPricingCategoriaList(new ArrayList()); + clonePricing.setPricingClaseList(new ArrayList()); + clonePricing.setPricingCorridaList(new ArrayList()); + clonePricing.setPricingDiaList(new ArrayList()); + clonePricing.setPricingImporteList(new ArrayList()); + clonePricing.setPricingMarcaList(new ArrayList()); + clonePricing.setPricingMercadoList(new ArrayList()); + clonePricing.setPricingOcupaAntecipaList(new ArrayList()); + clonePricing.setPricingPuntoventaList(new ArrayList()); + clonePricing.setPricingRutaList(new ArrayList()); + clonePricing.setPricingTipoptovtaList(new ArrayList()); + clonePricing.setPricingTipoServicioList(new ArrayList()); + clonePricing.setPricingVigenciaList(new ArrayList()); + + clonePricing = suscribir(clonePricing); + + clonePricing = percorrerPricingAtivoParaClonar(pricing, clonePricing); + actualizacion(clonePricing); + + inativar(clonePricing); + + if (clonePricing.getPricingId() != null) { + return true; + } else { + return false; + } + } + + private Pricing percorrerPricingAtivoParaClonar(Pricing pricing, Pricing clonePricing) { + + Integer ativar = Pricing.ATIVO; + + List pricingAsientoList = new ArrayList(); + for (PricingAsiento pricingAsiento : pricing.getPricingAsientoList()) { + + PricingAsiento clonePricingAsiento = new PricingAsiento(); + + clonePricingAsiento.setNombImagen(pricingAsiento.getNombImagen()); + clonePricingAsiento.setNumeasiento(pricingAsiento.getNumeasiento()); + clonePricingAsiento.setPorcentaje(pricingAsiento.getPorcentaje()); + + clonePricingAsiento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingAsiento.setFecmodif(Calendar.getInstance().getTime()); + clonePricingAsiento.setActivo(ativar); + clonePricingAsiento.setPricing(clonePricing); + pricingAsientoList.add(clonePricingAsiento); + } + clonePricing.setPricingAsientoList(pricingAsientoList); + + List pricingCategoriaList = new ArrayList(); + for (PricingCategoria pricingCategoria : pricing.getPricingCategoriaList()) { + + PricingCategoria clonePricingCategoria = new PricingCategoria(); + + clonePricingCategoria.setCategoria(pricingCategoria.getCategoria()); + + clonePricingCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingCategoria.setFecmodif(Calendar.getInstance().getTime()); + clonePricingCategoria.setActivo(ativar); + clonePricingCategoria.setPricing(clonePricing); + pricingCategoriaList.add(clonePricingCategoria); + } + clonePricing.setPricingCategoriaList(pricingCategoriaList); + List pricingClaseList = new ArrayList(); + for (PricingClase pricingClase : pricing.getPricingClaseList()) { + + PricingClase clonePricingClase = new PricingClase(); + + clonePricingClase.setClaseServicio(pricingClase.getClaseServicio()); + + clonePricingClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingClase.setFecmodif(Calendar.getInstance().getTime()); + clonePricingClase.setActivo(ativar); + clonePricingClase.setPricing(clonePricing); + pricingClaseList.add(clonePricingClase); + } + clonePricing.setPricingClaseList(pricingClaseList); + + List pricingCorridaList = new ArrayList(); + for (PricingCorrida pricingCorrida : pricing.getPricingCorridaList()) { + + PricingCorrida clonePricingCorrida = new PricingCorrida(); + + clonePricingCorrida.setCorridaCtrl(pricingCorrida.getCorridaCtrl()); + + clonePricingCorrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingCorrida.setFecmodif(Calendar.getInstance().getTime()); + clonePricingCorrida.setActivo(ativar); + clonePricingCorrida.setPricing(clonePricing); + pricingCorridaList.add(clonePricingCorrida); + } + clonePricing.setPricingCorridaList(pricingCorridaList); + + List pricingDiaList = new ArrayList(); + for (PricingDia pricingDia : pricing.getPricingDiaList()) { + + PricingDia clonePricingDia = new PricingDia(); + + clonePricingDia.setHorariofin(pricingDia.getHorariofin()); + clonePricingDia.setHorarioinicio(pricingDia.getHorarioinicio()); + clonePricingDia.setInddomingo(pricingDia.getInddomingo()); + clonePricingDia.setIndjueves(pricingDia.getIndjueves()); + clonePricingDia.setIndlunes(pricingDia.getIndlunes()); + clonePricingDia.setIndmartes(pricingDia.getIndmartes()); + clonePricingDia.setIndmiercoles(pricingDia.getIndmiercoles()); + clonePricingDia.setIndsabado(pricingDia.getIndsabado()); + clonePricingDia.setIndviernes(pricingDia.getIndviernes()); + clonePricingDia.setIndfecventa(pricingDia.getIndfecventa()); + clonePricingDia.setIndfecviaje(pricingDia.getIndfecviaje()); + + clonePricingDia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingDia.setFecmodif(Calendar.getInstance().getTime()); + clonePricingDia.setActivo(ativar); + clonePricingDia.setPricing(clonePricing); + pricingDiaList.add(clonePricingDia); + } + clonePricing.setPricingDiaList(pricingDiaList); + + List pricingImporteList = new ArrayList(); + for (PricingImporte pricingImporte : pricing.getPricingImporteList()) { + + PricingImporte clonePricingImporte = new PricingImporte(); + + clonePricingImporte.setImporte(pricingImporte.getImporte()); + clonePricingImporte.setMoneda(pricingImporte.getMoneda()); + + clonePricingImporte.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingImporte.setFecmodif(Calendar.getInstance().getTime()); + clonePricingImporte.setActivo(ativar); + clonePricingImporte.setPricing(clonePricing); + pricingImporteList.add(clonePricingImporte); + } + clonePricing.setPricingImporteList(pricingImporteList); + + List pricingMarcaList = new ArrayList(); + for (PricingMarca pricingMarca : pricing.getPricingMarcaList()) { + + PricingMarca clonePricingMarca = new PricingMarca(); + + clonePricingMarca.setMarca(pricingMarca.getMarca()); + + clonePricingMarca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingMarca.setFecmodif(Calendar.getInstance().getTime()); + clonePricingMarca.setActivo(ativar); + clonePricingMarca.setPricing(clonePricing); + pricingMarcaList.add(clonePricingMarca); + } + clonePricing.setPricingMarcaList(pricingMarcaList); + + List pricingMercadoList = new ArrayList(); + for (PricingMercado pricingMercado : pricing.getPricingMercadoList()) { + + PricingMercado clonePricingMercado = new PricingMercado(); + + clonePricingMercado.setDestino(pricingMercado.getDestino()); + clonePricingMercado.setOrigen(pricingMercado.getOrigen()); + + clonePricingMercado.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingMercado.setFecmodif(Calendar.getInstance().getTime()); + clonePricingMercado.setActivo(ativar); + clonePricingMercado.setPricing(clonePricing); + pricingMercadoList.add(clonePricingMercado); + } + clonePricing.setPricingMercadoList(pricingMercadoList); + + List pricingOcupaAntecipaList = new ArrayList(); + for (PricingOcupaAntecipa pricingOcupaAntecipa : pricing.getPricingOcupaAntecipaList()) { + + PricingOcupaAntecipa clonePricingOcupaAntecipa = new PricingOcupaAntecipa(); + + clonePricingOcupaAntecipa.setCantasientosmin(pricingOcupaAntecipa.getCantasientosmin()); + clonePricingOcupaAntecipa.setCantasientosmax(pricingOcupaAntecipa.getCantasientosmax()); + clonePricingOcupaAntecipa.setCantdiasmin(pricingOcupaAntecipa.getCantdiasmin()); + clonePricingOcupaAntecipa.setCantdiasmax(pricingOcupaAntecipa.getCantdiasmax()); + clonePricingOcupaAntecipa.setImporte(pricingOcupaAntecipa.getImporte()); + clonePricingOcupaAntecipa.setPorcentaje(pricingOcupaAntecipa.getPorcentaje()); + clonePricingOcupaAntecipa.setOcupacioninicial(pricingOcupaAntecipa.getOcupacioninicial()); + clonePricingOcupaAntecipa.setOcupacionfinal(pricingOcupaAntecipa.getOcupacionfinal()); + + clonePricingOcupaAntecipa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingOcupaAntecipa.setFecmodif(Calendar.getInstance().getTime()); + clonePricingOcupaAntecipa.setActivo(ativar); + clonePricingOcupaAntecipa.setPricing(clonePricing); + pricingOcupaAntecipaList.add(clonePricingOcupaAntecipa); + } + clonePricing.setPricingOcupaAntecipaList(pricingOcupaAntecipaList); + + List pricingPuntoVentaList = new ArrayList(); + for (PricingPuntoVenta pricingPuntoVenta : pricing.getPricingPuntoventaList()) { + + PricingPuntoVenta clonePricingPuntoVenta = new PricingPuntoVenta(); + + clonePricingPuntoVenta.setPuntoVenta(pricingPuntoVenta.getPuntoVenta()); + + clonePricingPuntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingPuntoVenta.setFecmodif(Calendar.getInstance().getTime()); + clonePricingPuntoVenta.setActivo(ativar); + clonePricingPuntoVenta.setPricing(clonePricing); + pricingPuntoVentaList.add(clonePricingPuntoVenta); + } + clonePricing.setPricingPuntoventaList(pricingPuntoVentaList); + + List pricingRutaList = new ArrayList(); + for (PricingRuta pricingRuta : pricing.getPricingRutaList()) { + + PricingRuta clonePricingRuta = new PricingRuta(); + + clonePricingRuta.setRuta(pricingRuta.getRuta()); + + clonePricingRuta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingRuta.setFecmodif(Calendar.getInstance().getTime()); + clonePricingRuta.setActivo(ativar); + clonePricingRuta.setPricing(clonePricing); + pricingRutaList.add(clonePricingRuta); + } + clonePricing.setPricingRutaList(pricingRutaList); + + List pricingTipoPtoVtaList = new ArrayList(); + for (PricingTipoPtoVta pricingTipoPtoVta : pricing.getPricingTipoptovtaList()) { + + PricingTipoPtoVta clonePricingTipoPtoVta = new PricingTipoPtoVta(); + + clonePricingTipoPtoVta.setTipoPtovta(pricingTipoPtoVta.getTipoPtovta()); + + clonePricingTipoPtoVta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingTipoPtoVta.setFecmodif(Calendar.getInstance().getTime()); + clonePricingTipoPtoVta.setActivo(ativar); + clonePricingTipoPtoVta.setPricing(clonePricing); + pricingTipoPtoVtaList.add(clonePricingTipoPtoVta); + } + clonePricing.setPricingTipoptovtaList(pricingTipoPtoVtaList); + + List pricingVigenciaList = new ArrayList(); + for (PricingVigencia pricingVigencia : pricing.getPricingVigenciaList()) { + + PricingVigencia clonePricingVigencia = new PricingVigencia(); + + clonePricingVigencia.setFecfinventa(pricingVigencia.getFecfinventa()); + clonePricingVigencia.setFecinicioventa(pricingVigencia.getFecinicioventa()); + clonePricingVigencia.setFecinicioviaje(pricingVigencia.getFecinicioviaje()); + clonePricingVigencia.setFecfinviaje(pricingVigencia.getFecfinviaje()); + + clonePricingVigencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingVigencia.setFecmodif(Calendar.getInstance().getTime()); + clonePricingVigencia.setActivo(ativar); + clonePricingVigencia.setPricing(clonePricing); + pricingVigenciaList.add(clonePricingVigencia); + } + clonePricing.setPricingVigenciaList(pricingVigenciaList); + + List pricingTipoServicioList = new ArrayList(); + for (PricingTipoServicio pricingTipoServicio : pricing.getPricingTipoServicioList()) { + + PricingTipoServicio clonePricingTipoServicio = new PricingTipoServicio(); + clonePricingTipoServicio.setTipoServicio(pricingTipoServicio.getTipoServicio()); + + clonePricingTipoServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingTipoServicio.setFecmodif(Calendar.getInstance().getTime()); + clonePricingTipoServicio.setActivo(ativar); + clonePricingTipoServicio.setPricing(clonePricing); + pricingTipoServicioList.add(clonePricingTipoServicio); + } + clonePricing.setPricingTipoServicioList(pricingTipoServicioList); + + List pricingFormapagoList = new ArrayList(); + for (PricingFormapago pricingFormapago : pricing.getPricingFormapagoList()) { + + PricingFormapago clonePricingFormapago = new PricingFormapago(); + clonePricingFormapago.setIndexcepcion(pricingFormapago.getIndexcepcion()); + clonePricingFormapago.setFormaPago(pricingFormapago.getFormaPago()); + + clonePricingFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingFormapago.setFecmodif(Calendar.getInstance().getTime()); + clonePricingFormapago.setActivo(ativar); + clonePricingFormapago.setPricing(clonePricing); + pricingFormapagoList.add(clonePricingFormapago); + } + clonePricing.setPricingFormapagoList(pricingFormapagoList); + + return clonePricing; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoPtoVtaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoPtoVtaServiceImpl.java new file mode 100644 index 000000000..50f4adfc4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoPtoVtaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.service.PricingTipoPtoVtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingTipoPtoVtaService") +public class PricingTipoPtoVtaServiceImpl implements PricingTipoPtoVtaService { + + @Autowired + private PricingTipoPtoVtaDAO pricingTipoPtoVtaDAO; + + public List obtenerTodos() { + return pricingTipoPtoVtaDAO.obtenerTodos(); + } + + public PricingTipoPtoVta obtenerID(Integer id) { + return pricingTipoPtoVtaDAO.obtenerID(id); + } + + @Transactional + public PricingTipoPtoVta suscribir(PricingTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoPtoVtaDAO.suscribir(entidad); + } + + @Transactional + public PricingTipoPtoVta actualizacion(PricingTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoPtoVtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingTipoPtoVtaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta) { + return pricingTipoPtoVtaDAO.obtenerPricingTipoPuntoVenta(pricing, tipoPuntoVenta); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoServicioServiceImpl.java new file mode 100644 index 000000000..6284a033a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoServicioServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingTipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import com.rjconsultores.ventaboletos.service.PricingTipoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("pricingTipoServicioService") +public class PricingTipoServicioServiceImpl implements PricingTipoServicioService { + + @Autowired + private PricingTipoServicioDAO pricingTipoServicioDAO; + + public List obtenerTodos() { + return pricingTipoServicioDAO.obtenerTodos(); + } + + public PricingTipoServicio obtenerID(Integer id) { + return pricingTipoServicioDAO.obtenerID(id); + } + + @Transactional + public PricingTipoServicio suscribir(PricingTipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoServicioDAO.suscribir(entidad); + } + + @Transactional + public PricingTipoServicio actualizacion(PricingTipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingTipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingTipoServicioDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio) { + return pricingTipoServicioDAO.obtenerPricingTipoServicio(pricing, tipoServicio); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingVigenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingVigenciaServiceImpl.java new file mode 100644 index 000000000..4d586cdd4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PricingVigenciaServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import com.rjconsultores.ventaboletos.service.PricingVigenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingVigenciaService") +public class PricingVigenciaServiceImpl implements PricingVigenciaService { + + @Autowired + private PricingVigenciaDAO pricingVigenciaDAO; + + public List obtenerTodos() { + return pricingVigenciaDAO.obtenerTodos(); + } + + public PricingVigencia obtenerID(Integer id) { + return pricingVigenciaDAO.obtenerID(id); + } + + @Transactional + public PricingVigencia suscribir(PricingVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingVigenciaDAO.suscribir(entidad); + } + + @Transactional + public PricingVigencia actualizacion(PricingVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingVigenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingVigenciaDAO.actualizacion(entidad); + } + + public List buscarPorVigencias(PricingVigencia pv) { + return pricingVigenciaDAO.buscarPorVigencias(pv); + } + + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, Date inicio, Date fim) { + return pricingVigenciaDAO.podeSalvar(pricing, pricingVigencia, inicio, fim); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdClaseServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdClaseServicioServiceImpl.java new file mode 100644 index 000000000..eaab1a96b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdClaseServicioServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; +import com.rjconsultores.ventaboletos.service.ProdClaseServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodClaseServicioService") +public class ProdClaseServicioServiceImpl implements ProdClaseServicioService { + + @Autowired + private ProdClaseServicioDAO prodClaseServicioDAO; + + public List obtenerTodos() { + return prodClaseServicioDAO.obtenerTodos(); + } + + public ProdClaseServicio obtenerID(Integer id) { + return prodClaseServicioDAO.obtenerID(id); + } + + @Transactional + public ProdClaseServicio suscribir(ProdClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodClaseServicioDAO.suscribir(entidad); + } + + @Transactional + public ProdClaseServicio actualizacion(ProdClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodClaseServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodClaseServicioDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdFormaPagoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdFormaPagoServiceImpl.java new file mode 100644 index 000000000..384fb064d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdFormaPagoServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdFormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; +import com.rjconsultores.ventaboletos.service.ProdFormaPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodFormaPagoService") +public class ProdFormaPagoServiceImpl implements ProdFormaPagoService { + + @Autowired + private ProdFormaPagoDAO prodFormaPagoDAO; + + public List obtenerTodos() { + return prodFormaPagoDAO.obtenerTodos(); + } + + public ProdFormaPago obtenerID(Integer id) { + return prodFormaPagoDAO.obtenerID(id); + } + + @Transactional + public ProdFormaPago suscribir(ProdFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodFormaPagoDAO.suscribir(entidad); + } + + @Transactional + public ProdFormaPago actualizacion(ProdFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodFormaPagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodFormaPagoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdMarcaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdMarcaServiceImpl.java new file mode 100644 index 000000000..0720f8d09 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdMarcaServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.service.ProdMarcaService; +import com.rjconsultores.ventaboletos.service.ProdPrecioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodMarcaService") +public class ProdMarcaServiceImpl implements ProdMarcaService { + + @Autowired + private ProdMarcaDAO prodMarcaDAO; + @Autowired + private ProdPrecioService prodPrecioService; + + + public List obtenerTodos() { + return prodMarcaDAO.obtenerTodos(); + } + + public ProdMarca obtenerID(Integer id) { + return prodMarcaDAO.obtenerID(id); + } + + @Transactional + public ProdMarca suscribir(ProdMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMarcaDAO.suscribir(entidad); + } + + @Transactional + public ProdMarca actualizacion(ProdMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodMarcaDAO.actualizacion(entidad); + } + + @Transactional + public ProdMarca actualizacion(ProdMarca entidad, List listPrecios) { + entidad = this.actualizacion(entidad); + for(ProdPrecio pp : listPrecios){ + prodPrecioService.actualizacion(pp); + } + return entidad; + } + + @Transactional + public ProdMarca suscribir(ProdMarca entidad, List listPrecios) { + entidad = this.suscribir(entidad); + for(ProdPrecio pp : listPrecios){ + prodPrecioService.suscribir(pp); + } + return entidad; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdMercadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdMercadoServiceImpl.java new file mode 100644 index 000000000..195ec4458 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdMercadoServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMercado; +import com.rjconsultores.ventaboletos.service.ProdMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodMercadoService") +public class ProdMercadoServiceImpl implements ProdMercadoService { + + @Autowired + private ProdMercadoDAO prodMercadoDAO; + + public List obtenerTodos() { + return prodMercadoDAO.obtenerTodos(); + } + + public ProdMercado obtenerID(Integer id) { + return prodMercadoDAO.obtenerID(id); + } + + @Transactional + public ProdMercado suscribir(ProdMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMercadoDAO.suscribir(entidad); + } + + @Transactional + public ProdMercado actualizacion(ProdMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodMercadoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdPrecioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdPrecioServiceImpl.java new file mode 100644 index 000000000..b34b2a356 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdPrecioServiceImpl.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdPrecioDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import com.rjconsultores.ventaboletos.service.ProdPrecioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("prodPrecioService") +public class ProdPrecioServiceImpl implements ProdPrecioService { + + @Autowired + private ProdPrecioDAO prodPrecioDAO; + + public List obtenerTodos() { + return prodPrecioDAO.obtenerTodos(); + } + + public ProdPrecio obtenerID(Integer id) { + return prodPrecioDAO.obtenerID(id); + } + + @Transactional + public ProdPrecio suscribir(ProdPrecio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPrecioDAO.suscribir(entidad); + } + + @Transactional + public ProdPrecio actualizacion(ProdPrecio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPrecioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdPrecio entidad) { + if (entidad.getProdprecio() == null) { + return; + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodPrecioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Marca marca) { + if (marca == null){ + return; + } + List lsPrecios = prodPrecioDAO.buscar(marca); + for (ProdPrecio pp : lsPrecios) { + pp.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pp.setFecmodif(Calendar.getInstance().getTime()); + pp.setActivo(Boolean.FALSE); + + prodPrecioDAO.actualizacion(pp); + } + } + + public List buscar(Marca marca, ProductoServicio productoservicio) { + return prodPrecioDAO.buscar(marca, productoservicio); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdPuntoVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdPuntoVentaServiceImpl.java new file mode 100644 index 000000000..113f32c2b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdPuntoVentaServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; +import com.rjconsultores.ventaboletos.service.ProdPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodPuntoVentaService") +public class ProdPuntoVentaServiceImpl implements ProdPuntoVentaService { + + @Autowired + private ProdPuntoVentaDAO prodPuntoVentaDAO; + + public List obtenerTodos() { + return prodPuntoVentaDAO.obtenerTodos(); + } + + public ProdPuntoVenta obtenerID(Integer id) { + return prodPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public ProdPuntoVenta suscribir(ProdPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public ProdPuntoVenta actualizacion(ProdPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodPuntoVentaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdRutaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdRutaServiceImpl.java new file mode 100644 index 000000000..7415810f6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdRutaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdRuta; +import com.rjconsultores.ventaboletos.service.ProdRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodRutaService") +public class ProdRutaServiceImpl implements ProdRutaService { + + @Autowired + private ProdRutaDAO prodRutaDAO; + + public List obtenerTodos() { + return prodRutaDAO.obtenerTodos(); + } + + public ProdRuta obtenerID(Integer id) { + return prodRutaDAO.obtenerID(id); + } + + @Transactional + public ProdRuta suscribir(ProdRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodRutaDAO.suscribir(entidad); + } + + @Transactional + public ProdRuta actualizacion(ProdRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodRutaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodRutaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdTipoptovtaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdTipoptovtaServiceImpl.java new file mode 100644 index 000000000..308ed122f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdTipoptovtaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; +import com.rjconsultores.ventaboletos.service.ProdTipoptovtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodTipoptovtaService") +public class ProdTipoptovtaServiceImpl implements ProdTipoptovtaService { + + @Autowired + private ProdTipoptovtaDAO prodTipoptovtaDAO; + + public List obtenerTodos() { + return prodTipoptovtaDAO.obtenerTodos(); + } + + public ProdTipoptovta obtenerID(Integer id) { + return prodTipoptovtaDAO.obtenerID(id); + } + + @Transactional + public ProdTipoptovta suscribir(ProdTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodTipoptovtaDAO.suscribir(entidad); + } + + @Transactional + public ProdTipoptovta actualizacion(ProdTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodTipoptovtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodTipoptovtaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdVigenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdVigenciaServiceImpl.java new file mode 100644 index 000000000..d75ffcdd7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProdVigenciaServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import com.rjconsultores.ventaboletos.service.ProdVigenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodVigenciaService") +public class ProdVigenciaServiceImpl implements ProdVigenciaService { + + @Autowired + private ProdVigenciaDAO prodVigenciaDAO; + + public List obtenerTodos() { + return prodVigenciaDAO.obtenerTodos(); + } + + public ProdVigencia obtenerID(Integer id) { + return prodVigenciaDAO.obtenerID(id); + } + + @Transactional + public ProdVigencia suscribir(ProdVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodVigenciaDAO.suscribir(entidad); + } + + @Transactional + public ProdVigencia actualizacion(ProdVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodVigenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodVigenciaDAO.actualizacion(entidad); + } + + public List buscarTraslapa(ProdVigencia prodVigencia) { + return prodVigenciaDAO.buscarTraslapa(prodVigencia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProductoServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProductoServicioServiceImpl.java new file mode 100644 index 000000000..4afc90601 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ProductoServicioServiceImpl.java @@ -0,0 +1,124 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProductoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import com.rjconsultores.ventaboletos.entidad.ProdMercado; +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.ProdRuta; +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import com.rjconsultores.ventaboletos.service.ProductoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("productoServicioService") +public class ProductoServicioServiceImpl implements ProductoServicioService { + + @Autowired + private ProductoServicioDAO productoServicioDAO; + + public List obtenerTodos() { + return productoServicioDAO.obtenerTodos(); + } + + public ProductoServicio obtenerID(Integer id) { + return productoServicioDAO.obtenerID(id); + } + + @Transactional + public ProductoServicio suscribir(ProductoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return productoServicioDAO.suscribir(entidad); + } + + @Transactional + public ProductoServicio actualizacion(ProductoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return productoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProductoServicio entidad) { + + entidad = this.obtenerID(entidad.getProductoservicioId()); + for (ProdClaseServicio p : entidad.getProdClaseServicioList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdFormaPago p : entidad.getProdFormaPagoList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdMarca p : entidad.getProdMarcaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdMercado p : entidad.getProdMercadoList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdPuntoVenta p : entidad.getProdPuntoVentaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdRuta p : entidad.getProdRutaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdTipoptovta p : entidad.getProdTipoptovtaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdVigencia p : entidad.getProdVigenciaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + productoServicioDAO.actualizacion(entidad); + } + @Transactional + public void borrarFisico(ProductoServicio entidad) { + productoServicioDAO.borrar(entidad); + } + + public List buscar(String descproductoservicio) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public List obtener(ProductoServicio ps) { + return productoServicioDAO.obtener(ps); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaCheckinServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaCheckinServiceImpl.java new file mode 100644 index 000000000..2a5601d35 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaCheckinServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtoVtaCheckinDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; +import com.rjconsultores.ventaboletos.service.PtoVtaCheckinService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptoVtaCheckinService") +public class PtoVtaCheckinServiceImpl implements PtoVtaCheckinService { + + @Autowired + private PtoVtaCheckinDAO ptovtaEmpresaBloqueadaServiceDAO; + + @Override + public List obtenerTodos() { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerTodos(); + } + + @Override + public PtoVtaCheckin obtenerID(Integer id) { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerID(id); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaCheckin suscribir(PtoVtaCheckin entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.suscribir(entidad); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaCheckin actualizacion(PtoVtaCheckin entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + + @Override + @Transactional(readOnly = false) + public void borrar(PtoVtaCheckin entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaSeguroServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaSeguroServiceImpl.java new file mode 100644 index 000000000..2c40fd09c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaSeguroServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtoVtaSeguroDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; +import com.rjconsultores.ventaboletos.service.PtoVtaSeguroService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptoVtaSeguroService") +public class PtoVtaSeguroServiceImpl implements PtoVtaSeguroService { + + @Autowired + private PtoVtaSeguroDAO ptoVtaSeguroServiceDAO; + + @Override + public List obtenerTodos() { + return ptoVtaSeguroServiceDAO.obtenerTodos(); + } + + @Override + public PtoVtaSeguro obtenerID(Integer id) { + return ptoVtaSeguroServiceDAO.obtenerID(id); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaSeguro suscribir(PtoVtaSeguro entidad) { + return ptoVtaSeguroServiceDAO.suscribir(entidad); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaSeguro actualizacion(PtoVtaSeguro entidad) { + return ptoVtaSeguroServiceDAO.actualizacion(entidad); + } + + @Override + @Transactional(readOnly = false) + public void borrar(PtoVtaSeguro entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + ptoVtaSeguroServiceDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaUsuarioBancarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaUsuarioBancarioServiceImpl.java new file mode 100644 index 000000000..de9d34c3c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaUsuarioBancarioServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtoVtaUsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; +import com.rjconsultores.ventaboletos.service.PtoVtaUsuarioBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptoVtaUsuarioBancarioService") +public class PtoVtaUsuarioBancarioServiceImpl implements PtoVtaUsuarioBancarioService { + + @Autowired + private PtoVtaUsuarioBancarioDAO ptoVtaUsuarioBancarioDAO; + + public List obtenerTodos() { + return ptoVtaUsuarioBancarioDAO.obtenerTodos(); + } + + public PtoVtaUsuarioBancario obtenerID(Integer id) { + return ptoVtaUsuarioBancarioDAO.obtenerID(id); + } + + @Transactional + public PtoVtaUsuarioBancario suscribir(PtoVtaUsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptoVtaUsuarioBancarioDAO.suscribir(entidad); + } + + @Transactional + public PtoVtaUsuarioBancario actualizacion(PtoVtaUsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptoVtaUsuarioBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtoVtaUsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptoVtaUsuarioBancarioDAO.actualizacion(entidad); + } + + public void borrarFisico(PtoVtaUsuarioBancario pto2) { + ptoVtaUsuarioBancarioDAO.borrarFisico(pto2); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAgenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAgenciaServiceImpl.java new file mode 100644 index 000000000..f4a902a61 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAgenciaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; +import com.rjconsultores.ventaboletos.service.ProdVigenciaService; +import com.rjconsultores.ventaboletos.service.PtovtaAgenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaAgenciaBancariaService") +public class PtovtaAgenciaServiceImpl implements PtovtaAgenciaService { + + @Autowired + private PtovtaAgenciaDAO ptovtaBancoDAO; + + public List obtenerTodos() { + return ptovtaBancoDAO.obtenerTodos(); + } + + public PtovtaAgencia obtenerID(Integer id) { + return ptovtaBancoDAO.obtenerID(id); + } + + @Transactional + public PtovtaAgencia suscribir(PtovtaAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.suscribir(entidad); + } + + @Transactional + public PtovtaAgencia actualizacion(PtovtaAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.actualizacion(entidad); + } + + + @Transactional + public void borrar(PtovtaAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaBancoDAO.actualizacion(entidad); + } + + + public List buscar(String numagencia) { + return ptovtaBancoDAO.buscar(numagencia); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntecipacomissaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntecipacomissaoServiceImpl.java new file mode 100644 index 000000000..1d83962fa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntecipacomissaoServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaAntecipacomissaoDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; +import com.rjconsultores.ventaboletos.service.PtovtaAntecipacomissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaAntecipacomissaoService") +public class PtovtaAntecipacomissaoServiceImpl implements PtovtaAntecipacomissaoService { + + @Autowired + private PtovtaAntecipacomissaoDAO ptovtaAntecipacomissaoDAO; + + public List obtenerTodos() { + return ptovtaAntecipacomissaoDAO.obtenerTodos(); + } + + public PtovtaAntecipacomissao obtenerID(Integer id) { + return ptovtaAntecipacomissaoDAO.obtenerID(id); + } + + @Transactional + public PtovtaAntecipacomissao suscribir(PtovtaAntecipacomissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaAntecipacomissaoDAO.suscribir(entidad); + } + + @Transactional + public PtovtaAntecipacomissao actualizacion(PtovtaAntecipacomissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaAntecipacomissaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaAntecipacomissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaAntecipacomissaoDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaAntecipacomissaoDAO.buscar(id); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaCatIndServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaCatIndServiceImpl.java new file mode 100644 index 000000000..cfdef1f35 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaCatIndServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaCatIndDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; +import com.rjconsultores.ventaboletos.service.PtovtaCatIndService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptovtaCatIndService") +public class PtovtaCatIndServiceImpl implements PtovtaCatIndService { + + @Autowired + private PtovtaCatIndDAO ptovtaCatIndDAO; + + @Override + public List obtenerTodos() { + return ptovtaCatIndDAO.obtenerTodos(); + } + + @Override + public PtovtaCatInd obtenerID(Integer id) { + return ptovtaCatIndDAO.obtenerID(id); + } + + @Override + @Transactional + public PtovtaCatInd suscribir(PtovtaCatInd entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return ptovtaCatIndDAO.suscribir(entidad); + } + + @Override + @Transactional + public PtovtaCatInd actualizacion(PtovtaCatInd entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return ptovtaCatIndDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PtovtaCatInd entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + ptovtaCatIndDAO.actualizacion(entidad); + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java new file mode 100644 index 000000000..a482cbd3e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.PtovtaComissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaComissaoService") +public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { + + @Autowired + private PtovtaComissaoDAO ptovtaComissaoDAO; + + public List obtenerTodos() { + return ptovtaComissaoDAO.obtenerTodos(); + } + + public PtovtaComissao obtenerID(Integer id) { + return ptovtaComissaoDAO.obtenerID(id); + } + + @Transactional + public PtovtaComissao suscribir(PtovtaComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaComissaoDAO.suscribir(entidad); + } + + @Transactional + public PtovtaComissao actualizacion(PtovtaComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaComissaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaComissaoDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaComissaoDAO.buscar(id); + } + + public List buscarByPuntaVenta(PuntoVenta puntaVenta) { + return ptovtaComissaoDAO.buscarByPuntaVenta(puntaVenta); + } + + @Override + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId) { + return ptovtaComissaoDAO.buscarPuntaVentaEmpresa(puntaVentaId, empresaId); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaDiversosServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaDiversosServiceImpl.java new file mode 100644 index 000000000..328f28523 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaDiversosServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaDiversosDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; +import com.rjconsultores.ventaboletos.service.PtovtaDiversosService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaDiversosService") +public class PtovtaDiversosServiceImpl implements PtovtaDiversosService { + + @Autowired + private PtovtaDiversosDAO ptovtaDiversosDAO; + + public List obtenerTodos() { + return ptovtaDiversosDAO.obtenerTodos(); + } + + public PtovtaDiversos obtenerID(Integer id) { + return ptovtaDiversosDAO.obtenerID(id); + } + + @Transactional + public PtovtaDiversos suscribir(PtovtaDiversos entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaDiversosDAO.suscribir(entidad); + } + + @Transactional + public PtovtaDiversos actualizacion(PtovtaDiversos entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaDiversosDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaDiversos entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaDiversosDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaDiversosDAO.buscar(id); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaBloqueadaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaBloqueadaServiceImpl.java new file mode 100644 index 000000000..d76c30745 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaBloqueadaServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaBloqueadaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; +import com.rjconsultores.ventaboletos.service.PtovtaEmpresaBloqueadaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptovtaEmpresaBloqueadaService") +public class PtovtaEmpresaBloqueadaServiceImpl implements PtovtaEmpresaBloqueadaService { + + @Autowired + private PtovtaEmpresaBloqueadaDAO ptovtaEmpresaBloqueadaServiceDAO; + + @Override + public List obtenerTodos() { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerTodos(); + } + + @Override + public PtovtaEmpresaBloqueada obtenerID(Integer id) { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerID(id); + } + + @Override + @Transactional(readOnly=false) + public PtovtaEmpresaBloqueada suscribir(PtovtaEmpresaBloqueada entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.suscribir(entidad); + } + + @Override + @Transactional(readOnly=false) + public PtovtaEmpresaBloqueada actualizacion(PtovtaEmpresaBloqueada entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + + @Override + @Transactional(readOnly=false) + public void borrar(PtovtaEmpresaBloqueada entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaServiceImpl.java new file mode 100644 index 000000000..fb11d64b1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import com.rjconsultores.ventaboletos.service.PtovtaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaEmpresaService") +public class PtovtaEmpresaServiceImpl implements PtovtaEmpresaService { + + @Autowired + private PtovtaEmpresaDAO ptovtaEmpresaDAO; + + public List obtenerTodos() { + return ptovtaEmpresaDAO.obtenerTodos(); + } + + public PtovtaEmpresa obtenerID(Integer id) { + return ptovtaEmpresaDAO.obtenerID(id); + } + + @Transactional + public PtovtaEmpresa suscribir(PtovtaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEmpresaDAO.suscribir(entidad); + } + + @Transactional + public PtovtaEmpresa actualizacion(PtovtaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaEmpresaDAO.actualizacion(entidad); + } + + public List buscar(PtovtaEmpresa ptovtaEmpresa) { + return ptovtaEmpresaDAO.buscar(ptovtaEmpresa); + } + + public void borrarFisico(PtovtaEmpresa pto) { + ptovtaEmpresaDAO.borrarFisico(pto); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEstoqueServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEstoqueServiceImpl.java new file mode 100644 index 000000000..ee8356790 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEstoqueServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaEstoqueDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; +import com.rjconsultores.ventaboletos.service.PtovtaEstoqueService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaEstoqueService") +public class PtovtaEstoqueServiceImpl implements PtovtaEstoqueService { + + @Autowired + private PtovtaEstoqueDAO ptovtaEstoqueDAO; + + public List obtenerTodos() { + return ptovtaEstoqueDAO.obtenerTodos(); + } + + public PtovtaEstoque obtenerID(Integer id) { + return ptovtaEstoqueDAO.obtenerID(id); + } + + @Transactional + public PtovtaEstoque suscribir(PtovtaEstoque entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEstoqueDAO.suscribir(entidad); + } + + @Transactional + public PtovtaEstoque actualizacion(PtovtaEstoque entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEstoqueDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaEstoque entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaEstoqueDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaEstoqueDAO.buscar(id); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaHorarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaHorarioServiceImpl.java new file mode 100644 index 000000000..9b66a5c87 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaHorarioServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + + +import com.rjconsultores.ventaboletos.dao.PtovtaHorarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; +import com.rjconsultores.ventaboletos.service.PtovtaHorarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaHorarioService") +public class PtovtaHorarioServiceImpl implements PtovtaHorarioService { + + @Autowired + private PtovtaHorarioDAO ptovtaHorarioDAO; + + public List obtenerTodos() { + return ptovtaHorarioDAO.obtenerTodos(); + } + + public PtovtaHorario obtenerID(Integer id) { + return ptovtaHorarioDAO.obtenerID(id); + } + + @Transactional + public PtovtaHorario suscribir(PtovtaHorario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaHorarioDAO.suscribir(entidad); + } + + @Transactional + public PtovtaHorario actualizacion(PtovtaHorario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaHorarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaHorario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaHorarioDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaHorarioDAO.buscar(id); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java new file mode 100644 index 000000000..896f21fa1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + + +import com.rjconsultores.ventaboletos.dao.PtovtaTitularDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; +import com.rjconsultores.ventaboletos.service.PtovtaTitularService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaTitularService") +public class PtovtaTitularServiceImpl implements PtovtaTitularService { + + @Autowired + private PtovtaTitularDAO ptovtaTitularDAO; + + public List obtenerTodos() { + return ptovtaTitularDAO.obtenerTodos(); + } + + public PtovtaTitular obtenerID(Integer id) { + return ptovtaTitularDAO.obtenerID(id); + } + + @Transactional + public PtovtaTitular suscribir(PtovtaTitular entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaTitularDAO.suscribir(entidad); + } + + @Transactional + public PtovtaTitular actualizacion(PtovtaTitular entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaTitularDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaTitular entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaTitularDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaTitularDAO.buscar(id); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java new file mode 100644 index 000000000..819006f8c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -0,0 +1,517 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.text.Normalizer; +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.brazilutils.br.cpfcnpj.CpfCnpj; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.IntegracionException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.EstacionService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ws.totvs.service.TotvsService; +import com.rjconsultores.ws.utileria.Atributos; +import com.rjconsultores.ws.utileria.Atributos.CodPaisBanco; +import com.rjconsultores.ws.utileria.Atributos.ContribuinteICMS; +import com.rjconsultores.ws.utileria.Atributos.ContribuinteSimplesNacional; +import com.rjconsultores.ws.utileria.Atributos.InscricaoMunicipal; +import com.rjconsultores.ws.utileria.Atributos.TipoCliente; +import com.rjconsultores.ws.utileria.Atributos.TipoEntidade; +import com.rjconsultores.ws.utileria.Atributos.TipoFornecedor; +import com.rjconsultores.ws.utileria.Atributos.TipoPessoa; +import com.rjconsultores.ws.utileria.RetornoTotvs; +import com.rjconsultores.ws.utileria.RetornoTotvs.TipoRetorno; + +/** + * + * @author Administrador + */ +@Service("puntoVentaService") +public class PuntoVentaServiceImpl implements PuntoVentaService { + + private static Logger log = LoggerFactory.getLogger(PuntoVentaServiceImpl.class); + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + @Autowired + private ConstanteService constanteService; + @Autowired + private EstacionService estacionService; + @Autowired + private UsuarioUbicacionDAO usuarioUbicacionDAO; + + // FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados + @Deprecated + public List obtenerTodos() { + return puntoVentaDAO.obtenerTodos(); + } + + public PuntoVenta obtenerID(Integer id) { + return puntoVentaDAO.obtenerID(id); + } + + @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class }) + public PuntoVenta suscribir(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + Exception respEx = null; + if (ApplicationProperties.getInstance().integracionTotvs()) { + try { + if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor()) + || entidad.getIndIntegracion().equals(TipoRetorno.ERRO.getValor()))) { + String resp = integracionTotvs(entidad); + + TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); + + switch (retornoTotvs) { + case CONCLUIDA: + entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); + break; + + case JA_CADASTRADA: + entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); + break; + + case ERRO: + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); + break; + + default: + break; + } + } else { + respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); + } + } catch (ValidacionCampoException ev) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = ev; + + } catch (Exception e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + log.error(Atributos.MSG_ERRO_GENERICA, e); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); + } + } + entidad = puntoVentaDAO.suscribir(entidad); + + if (respEx != null) { + if (respEx instanceof IntegracionException) { + throw (IntegracionException) respEx; + } else if (respEx instanceof ValidacionCampoException) { + throw (ValidacionCampoException) respEx; + } + } + + return entidad; + } + + @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class }) + public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + Exception respEx = null; + + if (ApplicationProperties.getInstance().integracionTotvs()) { + + try { + if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor()) + || entidad.getIndIntegracion().equals(TipoRetorno.ERRO.getValor()))) { + String resp = integracionTotvs(entidad); + + TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); + + switch (retornoTotvs) { + case CONCLUIDA: + entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); + break; + + case JA_CADASTRADA: + entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); + break; + + case ERRO: + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); + break; + + default: + break; + } + } else { + respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); + } + } catch (ValidacionCampoException e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = e; + + } catch (Exception e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + log.error(Atributos.MSG_ERRO_GENERICA, e); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); + } + } + + entidad = puntoVentaDAO.actualizacion(entidad); + + if (respEx != null) { + if (respEx instanceof IntegracionException) { + throw (IntegracionException) respEx; + } else if (respEx instanceof ValidacionCampoException) { + throw (ValidacionCampoException) respEx; + } + } + + return entidad; + } + + private boolean tienesEstacionEnPuntoVta(PuntoVenta entidad) { + List lsEstaciones = estacionService.buscarEstaciones(entidad); + if(lsEstaciones != null && lsEstaciones.size() > 0 ){ + return true; + } + return false; + } + + @Transactional + public void borrar(PuntoVenta entidad) throws BusinessException{ + + if(tienesEstacionEnPuntoVta(entidad)){ + throw new BusinessException("editarPuntoVentaController.MSG.estacionVinculadaAgenciaOnDelete"); + } + + for (FormaPagoDet forma : entidad.getLsFormaPagoDet()) { + forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + forma.setFecmodif(Calendar.getInstance().getTime()); + forma.setActivo(Boolean.FALSE); + } + + if (entidad.getAgenciaId() != null) { + + entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getAgenciaId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getAgenciaId().setActivo(Boolean.FALSE); + + } + + if (entidad.getComissaoId() != null) { + entidad.getComissaoId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getComissaoId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getComissaoId().setActivo(Boolean.FALSE); + } + + if (entidad.getDiversosId() != null) { + entidad.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getDiversosId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getDiversosId().setActivo(Boolean.FALSE); + } + + if (entidad.getTitularId() != null) { + entidad.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getTitularId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getTitularId().setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + puntoVentaDAO.actualizacion(entidad); + } + + public List buscaLike(String strEstacion) { + return puntoVentaDAO.buscaLike(strEstacion); + } + + public List buscar(String nomPuntoVenta, String numPuntoVenta) { + return puntoVentaDAO.busca(nomPuntoVenta, numPuntoVenta); + } + + public List buscaPuntoVenta(String numPuntoVenta) { + return puntoVentaDAO.buscaPuntoVenta(numPuntoVenta); + } + + public List buscaPuntoVentaParada(Parada paradaId) { + return puntoVentaDAO.buscaPuntoVentaParada(paradaId); + } + + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) { + List lsPuntoVentaSubordinados = puntoVentaDAO.buscarPuntoVentaSubordinados(puntoVenta); + + return lsPuntoVentaSubordinados; + } + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas) { + List puntosVenta = puntoVentaDAO.buscarPuntosVentaMovimentacionBilhetes(empresas); + return puntosVenta; + } + + public List buscarPuntosVentaPorUsuario(Usuario usuario) { + List puntosVenta = usuarioUbicacionDAO.buscarPuntoVentaPorUsuario(usuario); + return puntosVenta; + } + + private void validaCampos(PuntoVenta puntoVenta) throws ValidacionCampoException { + + if (puntoVenta.getNumDoCPuntoVenta() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numDoCPuntoVenta"); + } + + String cpfOrCnpj = puntoVenta.getNumDoCPuntoVenta().replaceAll("[^0-9.]", ""); + + if (!CpfCnpj.isValid(cpfOrCnpj)){ + throw new ValidacionCampoException("editarPuntoVentaController.erro.cpfCnpj"); + } + + if (puntoVenta.getNumIEPuntoVenta() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numIEPuntoVenta"); + } + + if (puntoVenta.getColonia() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.colonia"); + } + + if (puntoVenta.getCodpostal() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.cep"); + } + + if (puntoVenta.getDireccioncalle() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.calle"); + } + + if (puntoVenta.getAgenciaId() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.agenciaId"); + } else { + + if (puntoVenta.getAgenciaId().getNumagencia() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numagencia"); + } + if (puntoVenta.getAgenciaId().getNumconta() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numconta"); + } + if (puntoVenta.getAgenciaId().getDigito() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.digito"); + } + + if (puntoVenta.getAgenciaId().getInstiFinanceiraId() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.instiFinanceiraId"); + } else { + if (puntoVenta.getAgenciaId().getInstiFinanceiraId().getCodigo() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.instiFinanceiraId.codigo"); + } + } + } + } + + private String integracionTotvs(PuntoVenta puntoVenta) throws Exception { + if (ApplicationProperties.getInstance().integracionTotvs()) { + + validaCampos(puntoVenta); + + String endpointFornecedor = getEndpointFornecedor(); + String endpointCliente = getEndpointCliente(); + + String xidsvp = puntoVenta.getNumPuntoVenta(); + + String cnpjEmpresaProtheus = Atributos.CNPJ_EMPRESA_PROTHEUS; + + String nome = puntoVenta.getNombpuntoventa(); + nome = removerAcentosCaracteresEspeciaisTotvs(nome); + + String cgc = puntoVenta.getNumDoCPuntoVenta(); + + String endereco = puntoVenta.getDireccioncalle() + "," + ((puntoVenta.getDireccionnumero() == null) ? "" : puntoVenta.getDireccionnumero()); + endereco = removerAcentosCaracteresEspeciaisTotvs(endereco); + + String complemen = puntoVenta.getCompl() == null ? "" : puntoVenta.getCompl(); + complemen = removerAcentosCaracteresEspeciaisTotvs(complemen); + + String bairro = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getDesccolonia(); + bairro = removerAcentosCaracteresEspeciaisTotvs(bairro); + + String codmun = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getCodmunicipio().toString(); + codmun = (codmun == null) ? "" : StringUtils.leftPad(codmun, 5, '0'); + + String est = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getCveestado(); + String codpais = CodPaisBanco.BRASIL.getValor(); + + String cep = puntoVenta.getCodpostal() != null?puntoVenta.getCodpostal().toString():null; + + String tel = puntoVenta.getNumtelefonouno(); + String ddd = null; + try { + String[] telefone = tel == null ? null : tel.split("\\)"); + ddd = tel == null ? null : telefone[0].replaceAll("\\(", ""); + tel = tel == null ? null : telefone[1].replaceAll("\\(", ""); + } catch (Exception e) { + tel = puntoVenta.getNumtelefonouno(); + } + + String email = puntoVenta.getDescCorreo() == null ? "" : puntoVenta.getDescCorreo(); + email = removerCaracteresInvalidosXml(email); + + String fax = puntoVenta.getNumfax() == null ? "" : puntoVenta.getNumfax(); + String inscr = puntoVenta.getNumIEPuntoVenta(); + String inscrm = InscricaoMunicipal.ISENTO.name(); + + String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa(); + nreduz = removerAcentosCaracteresEspeciaisTotvs(nreduz); + + String simpnac = ContribuinteSimplesNacional.NAO.getValor(); + + String tppessoa = TipoFornecedor.OS.name(); + String tppessoaCliente = TipoCliente.F.name(); + + String tipoPessoa = TipoPessoa.F.name(); + + if (isCNPJ(cgc)) { + tipoPessoa = TipoPessoa.J.name(); + } + + String obs = StringUtils.isBlank(puntoVenta.getComentarios()) ? "sem obs." : puntoVenta.getComentarios(); + + String contaFornecedor = Atributos.CONTA_FORNECEDOR_PROTHEUS; + String contaCliente = Atributos.CONTA_CLIENTE_PROTHEUS; + + String naturez = ""; + String cnae = ""; + String fator = ""; + + String agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia(); + String dgverag = ""; + try { + String[] agenciaComp = agencia == null ? null : agencia.split("-"); + agencia = agencia == null ? null : agenciaComp[0]; + dgverag = agencia == null ? null : agenciaComp[1]; + } catch (Exception e) { + agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia(); + } + + String banco = puntoVenta.getAgenciaId().getInstiFinanceiraId() == null ? "" : puntoVenta.getAgenciaId().getInstiFinanceiraId().getCodigo(); + String ctacorr = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumconta(); + String dgverct = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getDigito(); + + String resp = null; + Exception respEx = null; + + try { + resp = TotvsService.cadastrarFornecedor(endpointFornecedor, bairro, cep, cgc, cnae, codmun, codpais, complemen, contaFornecedor, ddd, email, endereco, + est, inscr, inscrm, naturez, nreduz, nome, simpnac, tel, tipoPessoa, tppessoa, cnpjEmpresaProtheus, xidsvp, agencia, banco, + dgverag, ctacorr, dgverct); + } catch (Exception e) { + log.error("", e); + respEx = e; + } + + String contrib = ContribuinteICMS.NAO.getValor(); + String entid = TipoEntidade.TRANSPORTE_PASSAGEIRO.getValor(); + String pais = "";// segundo orientação da TOTVS, passar em branco + + try { + resp = TotvsService.cadastrarCliente(endpointCliente, bairro, cep, cgc, codmun, codpais, complemen, contaCliente, contrib, ddd, email, cnpjEmpresaProtheus, + endereco, entid, fator, fax, inscr, inscrm, naturez, nreduz, nome, obs, pais, tppessoaCliente, tel, tipoPessoa, est, xidsvp); + } catch (Exception e) { + log.error("", e); + respEx = e; + } + + if (respEx != null) { + throw respEx; + } + + return resp; + } + return null; + } + + private String getEndpointFornecedor() { + Constante constante = constanteService.buscarPorNomeConstante("WS_TOTVS_FORNECEDOR_ENDPOINT"); + if (constante == null) { + return ""; + } + return constante.getValorconstante(); + } + + private String getEndpointCliente() { + Constante constante = constanteService.buscarPorNomeConstante("WS_TOTVS_CLIENTE_ENDPOINT"); + if (constante == null) { + return ""; + } + return constante.getValorconstante(); + } + + private String somenteNumeros(String s) { + if (s == null || StringUtils.isBlank(s)) { + return ""; + } + + s = StringUtils.trim(s); + + return s.replaceAll("[^0-9]", ""); + } + + private boolean isCNPJ(String vlr) { + vlr = somenteNumeros(vlr); + return vlr.length() > 11; + } + + /** + * From xml spec valid chars:
+ * #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
+ * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
+ * + * link artigo:http://stackoverflow.com/questions/9710185/how-to-deal-with-invalid-characters-in-a-ws-output-when-using-cxf + * + * @param text The String to clean + * @param replacement The string to be substituted for each match + * @return The resulting String + */ + private String removerCaracteresInvalidosXml(String s){ + if (s == null){ + return s; + } + + String re = "[^\\x09\\x0A\\x0D\\x20-\\xD7FF\\xE000-\\xFFFD\\x10000-x10FFFF]"; + return s.replaceAll(re, ""); + } + + private String removerAcentosCaracteresEspeciaisTotvs(String s){ + if (StringUtils.isBlank(s)){ + return s; + } + s = StringUtils.trim(s); + s = removerCaracteresInvalidosXml(s); + return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").replaceAll("\\W", " "); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoCtrlServiceImpl.java new file mode 100644 index 000000000..5e67b8bac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoCtrlServiceImpl.java @@ -0,0 +1,86 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RedondeoCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import com.rjconsultores.ventaboletos.service.RedondeoCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("redondeoCtrlService") +public class RedondeoCtrlServiceImpl implements RedondeoCtrlService { + + @Autowired + private RedondeoCtrlDAO redondeoCtrlDAO; + + public List obtenerTodos() { + return redondeoCtrlDAO.obtenerTodos(); + } + + public RedondeoCtrl obtenerID(Integer id) { + return redondeoCtrlDAO.obtenerID(id); + } + + @Transactional + public RedondeoCtrl suscribir(RedondeoCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoCtrlDAO.suscribir(entidad); + } + + @Transactional + public RedondeoCtrl actualizacion(RedondeoCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RedondeoCtrl entidad) { + + entidad = obtenerID(entidad.getRedondeoctrlId()); + + for (Redondeo r : entidad.getRedondeoList()) { + r.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + r.setFecmodif(Calendar.getInstance().getTime()); + r.setActivo(Boolean.FALSE); + } + for (RedondeoMarca rm : entidad.getRedondeoMarcaList()) { + rm.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rm.setFecmodif(Calendar.getInstance().getTime()); + rm.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + redondeoCtrlDAO.actualizacion(entidad); + } + + public List buscar(RedondeoCtrl redondeoCtrl) { + return redondeoCtrlDAO.buscar(redondeoCtrl); + } + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, Boolean indaplicapricing) { + return redondeoCtrlDAO.buscarTraslapa(iDMarcas, valorinicial, valorfinal, indaplicadescuento, indaplicapricing); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoMarcaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoMarcaServiceImpl.java new file mode 100644 index 000000000..dfcbcd661 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoMarcaServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RedondeoMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import com.rjconsultores.ventaboletos.service.RedondeoMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("redondeoMarcaService") +public class RedondeoMarcaServiceImpl implements RedondeoMarcaService { + + @Autowired + private RedondeoMarcaDAO redondeoMarcaDAO; + + public List obtenerTodos() { + return redondeoMarcaDAO.obtenerTodos(); + } + + public RedondeoMarca obtenerID(Integer id) { + return redondeoMarcaDAO.obtenerID(id); + } + + @Transactional + public RedondeoMarca suscribir(RedondeoMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoMarcaDAO.suscribir(entidad); + } + + @Transactional + public RedondeoMarca actualizacion(RedondeoMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RedondeoMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + redondeoMarcaDAO.actualizacion(entidad); + } + + public List buscar(Marca marca) { + return redondeoMarcaDAO.buscar(marca); + } + + public List obtenerTodasMarcas(Short[] iDMarcas) { + return redondeoMarcaDAO.obtenerTodasMarcas(iDMarcas); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoServiceImpl.java new file mode 100644 index 000000000..f3e4e7ce5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RedondeoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RedondeoDAO; +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import com.rjconsultores.ventaboletos.service.RedondeoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("redondeoService") +public class RedondeoServiceImpl implements RedondeoService { + + @Autowired + private RedondeoDAO redondeoDAO; + + public List obtenerTodos() { + return redondeoDAO.obtenerTodos(); + } + + public Redondeo obtenerID(Integer id) { + return redondeoDAO.obtenerID(id); + } + + @Transactional + public Redondeo suscribir(Redondeo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoDAO.suscribir(entidad); + } + + @Transactional + public Redondeo actualizacion(Redondeo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Redondeo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + redondeoDAO.actualizacion(entidad); + } + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo) { + return redondeoDAO.buscar(valorInicial, valorFinal, valorRedondeo); + } + + public List buscarVlrIniVlrFin(BigDecimal valorInicial, BigDecimal valorFinal) { + return redondeoDAO.buscar(valorInicial, valorFinal); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RequisicionBoletoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RequisicionBoletoServiceImpl.java new file mode 100644 index 000000000..20e84f921 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RequisicionBoletoServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RequisicionBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; +import com.rjconsultores.ventaboletos.service.RequisicionBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("requisicionBoletoService") +public class RequisicionBoletoServiceImpl implements RequisicionBoletoService { + + @Autowired + private RequisicionBoletoDAO requisicionBoletoDAO; + + @Override + public List obtenerTodos() { + return requisicionBoletoDAO.obtenerTodos(); + } + + @Override + public RequisicionBoleto obtenerID(Integer id) { + return requisicionBoletoDAO.obtenerID(id); + } + + @Transactional + public RequisicionBoleto suscribir(RequisicionBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return requisicionBoletoDAO.suscribir(entidad); + } + + @Transactional + public RequisicionBoleto actualizacion(RequisicionBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return requisicionBoletoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RequisicionBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + requisicionBoletoDAO.actualizacion(entidad); + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCategoriaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCategoriaServiceImpl.java new file mode 100644 index 000000000..5296f4538 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCategoriaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; +import com.rjconsultores.ventaboletos.service.ReservacionCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionCategoriaService") +public class ReservacionCategoriaServiceImpl implements ReservacionCategoriaService { + + @Autowired + private ReservacionCategoriaDAO reservacionCategoriaDAO; + + public List obtenerTodos() { + return reservacionCategoriaDAO.obtenerTodos(); + } + + public ReservacionCategoria obtenerID(Integer id) { + return reservacionCategoriaDAO.obtenerID(id); + } + + @Transactional + public ReservacionCategoria suscribir(ReservacionCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCategoriaDAO.suscribir(entidad); + } + + @Transactional + public ReservacionCategoria actualizacion(ReservacionCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionCategoriaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionClaseServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionClaseServiceImpl.java new file mode 100644 index 000000000..c85adc937 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionClaseServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; +import com.rjconsultores.ventaboletos.service.ReservacionClaseService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionClaseService") +public class ReservacionClaseServiceImpl implements ReservacionClaseService { + + @Autowired + private ReservacionClaseDAO reservacionClaseDAO; + + public List obtenerTodos() { + return reservacionClaseDAO.obtenerTodos(); + } + + public ReservacionClase obtenerID(Integer id) { + return reservacionClaseDAO.obtenerID(id); + } + + @Transactional + public ReservacionClase suscribir(ReservacionClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionClaseDAO.suscribir(entidad); + } + + @Transactional + public ReservacionClase actualizacion(ReservacionClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionClaseDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionClaseDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCtrlServiceImpl.java new file mode 100644 index 000000000..3f032906d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCtrlServiceImpl.java @@ -0,0 +1,101 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; +import com.rjconsultores.ventaboletos.service.ReservacionCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionCtrlService") +public class ReservacionCtrlServiceImpl implements ReservacionCtrlService { + + @Autowired + private ReservacionCtrlDAO reservacionCtrlDAO; + + public List obtenerTodos() { + return reservacionCtrlDAO.obtenerTodos(); + } + + public ReservacionCtrl obtenerID(Integer id) { + return reservacionCtrlDAO.obtenerID(id); + } + + @Transactional + public ReservacionCtrl suscribir(ReservacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCtrlDAO.suscribir(entidad); + } + + @Transactional + public ReservacionCtrl actualizacion(ReservacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionCtrl entidad) { + for (ReservacionCategoria reservacion : entidad.getReservacionCategoriaList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionClase reservacion : entidad.getReservacionClaseList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionMarca reservacion : entidad.getReservacionMarcaList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionMercado reservacion : entidad.getReservacionMercadoList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionPuntoVenta reservacion : entidad.getReservacionPuntoVentaList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionCtrlDAO.actualizacion(entidad); + } + + public List buscar(ReservacionCtrl reservacionCtrl) { + return reservacionCtrlDAO.buscar(reservacionCtrl); + } + + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrl) { + return reservacionCtrlDAO.buscarFechaTraslapa(reservacionCtrl); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMarcaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMarcaServiceImpl.java new file mode 100644 index 000000000..a6fc1c718 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMarcaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; +import com.rjconsultores.ventaboletos.service.ReservacionMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionMarcaService") +public class ReservacionMarcaServiceImpl implements ReservacionMarcaService { + + @Autowired + private ReservacionMarcaDAO reservacionMarcaDAO; + + public List obtenerTodos() { + return reservacionMarcaDAO.obtenerTodos(); + } + + public ReservacionMarca obtenerID(Integer id) { + return reservacionMarcaDAO.obtenerID(id); + } + + @Transactional + public ReservacionMarca suscribir(ReservacionMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMarcaDAO.suscribir(entidad); + } + + @Transactional + public ReservacionMarca actualizacion(ReservacionMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionMarcaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMercadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMercadoServiceImpl.java new file mode 100644 index 000000000..fe51ac0fb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMercadoServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; +import com.rjconsultores.ventaboletos.service.ReservacionMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionMercadoService") +public class ReservacionMercadoServiceImpl implements ReservacionMercadoService { + + @Autowired + private ReservacionMercadoDAO reservacionMercadoDAO; + + public List obtenerTodos() { + return reservacionMercadoDAO.obtenerTodos(); + } + + public ReservacionMercado obtenerID(Integer id) { + return reservacionMercadoDAO.obtenerID(id); + } + + @Transactional + public ReservacionMercado suscribir(ReservacionMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMercadoDAO.suscribir(entidad); + } + + @Transactional + public ReservacionMercado actualizacion(ReservacionMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionMercadoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionPuntoVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionPuntoVentaServiceImpl.java new file mode 100644 index 000000000..5ac669987 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ReservacionPuntoVentaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; +import com.rjconsultores.ventaboletos.service.ReservacionPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("reservacionPuntoVentaService") +public class ReservacionPuntoVentaServiceImpl implements ReservacionPuntoVentaService { + + @Autowired + private ReservacionPuntoVentaDAO reservacionPuntoVentaDAO; + + public List obtenerTodos() { + return reservacionPuntoVentaDAO.obtenerTodos(); + } + + public ReservacionPuntoVenta obtenerID(Integer id) { + return reservacionPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public ReservacionPuntoVenta suscribir(ReservacionPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public ReservacionPuntoVenta actualizacion(ReservacionPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionPuntoVentaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RestriccionPagoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RestriccionPagoServiceImpl.java new file mode 100644 index 000000000..a01d12877 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RestriccionPagoServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import com.rjconsultores.ventaboletos.service.RestriccionPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("restriccionService") +public class RestriccionPagoServiceImpl implements RestriccionPagoService { + + @Autowired + private RestriccionPagoDAO restriccionDAO; + + public List obtenerTodos() { + return restriccionDAO.obtenerTodos(); + } + + public RestriccionPago obtenerID(Short id) { + return restriccionDAO.obtenerID(id); + } + + @Transactional + public RestriccionPago suscribir(RestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return restriccionDAO.suscribir(entidad); + } + + @Transactional + public RestriccionPago actualizacion(RestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return restriccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RestriccionPago entidad) { + for (ConfigRestriccionPago crp : entidad.getConfigRestriccionPagoList()) { + crp.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + crp.setFecmodif(Calendar.getInstance().getTime()); + crp.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + restriccionDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RhPagoConductorServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RhPagoConductorServiceImpl.java new file mode 100644 index 000000000..cbb6eb51b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RhPagoConductorServiceImpl.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RhPagoConductorDAO; +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; +import com.rjconsultores.ventaboletos.service.RhPagoConductorService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("rhPagoConductorService") +public class RhPagoConductorServiceImpl implements RhPagoConductorService { + + @Autowired + private RhPagoConductorDAO restriccionDAO; + + public List obtenerTodos() { + return restriccionDAO.obtenerTodos(); + } + + public RhPagoConductor obtenerID(Integer id) { + return restriccionDAO.obtenerID(id); + } + + @Transactional + public RhPagoConductor suscribir(RhPagoConductor entidad) { + + + return restriccionDAO.suscribir(entidad); + } + + @Transactional + public RhPagoConductor actualizacion(RhPagoConductor entidad) { + + + return restriccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RhPagoConductor entidad) { + restriccionDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RolOperativoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RolOperativoServiceImpl.java new file mode 100644 index 000000000..d055d2f74 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RolOperativoServiceImpl.java @@ -0,0 +1,81 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.RolOperativoDAO; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.service.RolOperativoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("rolOperativoService") +public class RolOperativoServiceImpl implements RolOperativoService { + + @Autowired + private RolOperativoDAO rolOperativoDAO; + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + + public List obtenerTodos() { + return rolOperativoDAO.obtenerTodos(); + } + + public RolOperativo obtenerID(Integer id) { + return rolOperativoDAO.obtenerID(id); + } + + @Transactional + public RolOperativo suscribir(RolOperativo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rolOperativoDAO.suscribir(entidad); + } + + @Transactional + public RolOperativo actualizacion(RolOperativo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rolOperativoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RolOperativo entidad) throws RegistroConDependenciaException { + if (esquemaCorridaDAO.count("rolOperativo", entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rolOperativoDAO.actualizacion(entidad); + } + + public List pesquisar(DiagramaAutobus diagrama, String rol) { + + return rolOperativoDAO.pesquisar(diagrama, rol); + } + + public List buscar(String descroloperativo) { + return rolOperativoDAO.buscar(descroloperativo); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaCasetaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaCasetaServiceImpl.java new file mode 100644 index 000000000..896e813e7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaCasetaServiceImpl.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RutaCasetaDAO; +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.RutaCasetaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("rutaCasetaService") +public class RutaCasetaServiceImpl implements RutaCasetaService{ + + @Autowired + private RutaCasetaDAO rutaCasetaDAO; + + @Transactional(rollbackFor = BusinessException.class) + public RutaCaseta suscribir(RutaCaseta entidad) throws BusinessException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + entidad = rutaCasetaDAO.suscribir(entidad); + + return entidad; + } + + @Transactional(rollbackFor = BusinessException.class) + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id) { + rutaCasetaDAO.deletarRutaCasetasFromRutaSecuenciaId(id); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java new file mode 100644 index 000000000..6dd3fd911 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java @@ -0,0 +1,446 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaVO; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.util.resource.Labels; + +/** + * + * @author Rafius + */ +@Service("rutaCombinacionaService") +public class RutaCombinacionServiceImpl implements RutaCombinacionService { + + @Autowired + private RutaCombinacionDAO rutaCombinacionDAO; + private static Logger log = Logger.getLogger(RutaCombinacionServiceImpl.class); + private int NUM_LINHA_INICIO = 8; + + public List obtenerTodos() { + return rutaCombinacionDAO.obtenerTodos(); + } + + public RutaCombinacion obtenerID(Integer id) { + return rutaCombinacionDAO.obtenerID(id); + } + + @Transactional + public RutaCombinacion suscribir(RutaCombinacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaCombinacionDAO.suscribir(entidad); + } + + @Transactional + public RutaCombinacion actualizacion(RutaCombinacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaCombinacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RutaCombinacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaCombinacionDAO.actualizacion(entidad); + } + + public boolean busquedaRutaTramo(Ruta ruta, Tramo tramo, Boolean ativo) { + return rutaCombinacionDAO.busquedaRutaTramo(ruta, tramo, ativo); + } + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino) { + return rutaCombinacionDAO.busquedaTramoRutaTramo(ruta, trBuscaOrigemDestino); + } + + public void ativar(RutaCombinacion rcExiste) { + rcExiste.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rcExiste.setFecmodif(Calendar.getInstance().getTime()); + rcExiste.setActivo(Boolean.TRUE); + + rutaCombinacionDAO.actualizacion(rcExiste); + } + + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino) { + return rutaCombinacionDAO.busqueda(ruta, origen, destino); + } + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino) { + return rutaCombinacionDAO.busquedaTramoRutaOrigemDestino(ruta, origem, destino); + } + + public List obtenerPorRuta(Ruta ruta) { + return rutaCombinacionDAO.obtenerPorRuta(ruta); + } + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo) { + return rutaCombinacionDAO.buscarRutaCombinacionExisteTramo(tramo); + } + + public int borrarCombinaciones(Ruta ruta) { + return rutaCombinacionDAO.borrarCombinaciones(ruta); + } + + @Transactional + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino) { + rutaCombinacionDAO.activar(ruta, trBuscaOrigemDestino); + } + + public HSSFWorkbook gerarTarifaEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa) { + + HSSFWorkbook wb = new HSSFWorkbook(); + // fonte em negrito: + HSSFFont fonte = wb.createFont(); + fonte.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + HSSFCellStyle estilo = wb.createCellStyle(); + estilo.setFont(fonte); + + //Bucando todas as Linhas com Clase Marca e Moeda Separadamente + List lsLinhasAgrupadas = rutaCombinacionDAO.pesquisaTarifaGroupObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa); + + + HSSFSheet sheet1 = null; + + int linha = NUM_LINHA_INICIO; + int linhaAnterior = NUM_LINHA_INICIO; + int coluna = 0; + int numAba = 1; + + Object[] rows = new Object[10000]; + + TarifaEscalaVO tarAnterior = null; + for (TarifaEscalaGroupVO teg : lsLinhasAgrupadas) { + try { + + String descRuta = teg.getDESCRUTA(); + Integer rutaId = teg.getRUTA_ID().intValue(); + + //Buscando preços especificos de uma Linha + List lsTarifaEscala = rutaCombinacionDAO.pesquisaTarifaEscalaObj(rutaId.toString(), teg.getMONEDA_ID().toString(), + teg.getVIGENCIATARIFA_ID().toString(), teg.getMARCA_ID().toString()); + //Nome da Aba + String sheetName = ""; + //Se o nome da ruta for muito grande, tem que cortar para caber no noma da aba com seu ID + if (descRuta.toString().length() > 22) { + sheetName = numAba + " ".concat(descRuta.substring(0, 22).concat(" (").concat(rutaId.toString()).concat(")")); + } else { + sheetName = numAba + " ".concat(descRuta.concat(" (").concat(rutaId.toString()).concat(")")); + } + + numAba = numAba + 1; + sheet1 = wb.createSheet(sheetName); + SimpleDateFormat sf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); + + //Montando o Cabeçalho + HSSFRow r0 = sheet1.createRow(0); + r0.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhFeciniciovigencia.label")); + r0.createCell(1).setCellValue(sf.format(teg.getFECINICIOVIGENCIA()) + " - " + sf.format(teg.getFECFINVIGENCIA())); + + HSSFRow r1 = sheet1.createRow(1); + r1.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMoneda.label")); + r1.createCell(1).setCellValue(teg.getDESCMONEDA().toUpperCase()); + + HSSFRow r2 = sheet1.createRow(2); + r2.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMarca.label")); + r2.createCell(1).setCellValue(teg.getDESCMARCA().toUpperCase()); + + HSSFRow r3 = sheet1.createRow(3); + r3.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhClaseServicio.label")); + r3.createCell(1).setCellValue(teg.getDESCCLASE().toUpperCase()); + + HSSFRow r4 = sheet1.createRow(4); + r4.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhRuta.label")); + r4.createCell(1).setCellValue(descRuta.toUpperCase()); + + for (TarifaEscalaVO tar : lsTarifaEscala) { + //Primeira Execucao + //Crias as Linhas + //Coloca o preço do primeiro registro + if (linha == NUM_LINHA_INICIO) { + for (int i = NUM_LINHA_INICIO; i <= lsTarifaEscala.size() + NUM_LINHA_INICIO; i++) { + HSSFRow row = sheet1.createRow(i); + rows[i] = row; + } + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + //Nome e Descrição + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowPrimeiroPrecio = (HSSFRow) rows[linha + 1]; + rowPrimeiroPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + rows[linha + 1] = rowPrimeiroPrecio; + + linha = linha + 1; + tarAnterior = tar; + continue; + } + + //Si mesma origen, se coloca somente o precio + if (tar.getCVEORIGEM().equals(tarAnterior.getCVEORIGEM())) { + HSSFRow rowTarifa = (HSSFRow) rows[linha + 1]; + if (tar.getPRECIO() != null) { + rowTarifa.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + } + rows[linha + 1] = rowTarifa; + + linha = linha + 1; + } else { + + //Se nao mostra proxima Localidade + Preço na linha + linhaAnterior = linhaAnterior + 1; + linha = linhaAnterior; + coluna = coluna + 1; + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowOrigemPrecio = (HSSFRow) rows[linha + 1]; + rowOrigemPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + rows[linha + 1] = rowOrigemPrecio; + + linha = linha + 1; + } + tarAnterior = tar; + } + //Ultima Execucao Coloca o Destino Final + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna + 1).setCellValue(tarAnterior.getCVEDESTINO()); + rowOrigem.createCell(coluna + 2).setCellValue(tarAnterior.getDESCDESTINO()); + rows[linha] = rowOrigem; + linha = NUM_LINHA_INICIO; + linhaAnterior = NUM_LINHA_INICIO; + coluna = 0; + } catch (Exception ex) { + log.error("Exportação Excel Escala: ", ex); + } + } + + return wb; + } + + public HSSFWorkbook gerarTarifaOficialEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa) { + + HSSFWorkbook wb = new HSSFWorkbook(); + // fonte em negrito: + HSSFFont fonte = wb.createFont(); + fonte.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + HSSFCellStyle estilo = wb.createCellStyle(); + estilo.setFont(fonte); + + //Bucando todas as Linhas com Clase Marca e Moeda Separadamente + List lsLinhasAgrupadas = rutaCombinacionDAO.pesquisaTarifaOficialGroupObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvVigenciaTarifa); + + if(lsLinhasAgrupadas == null || lsLinhasAgrupadas.isEmpty()){ + return null; + } + + HSSFSheet sheet1 = null; + + int linha = NUM_LINHA_INICIO; + int linhaAnterior = NUM_LINHA_INICIO; + int coluna = 0; + int numAba = 1; + + Object[] rows = new Object[10000]; + + TarifaOficialEscalaVO tarAnterior = null; + for (TarifaOficialEscalaGroupVO teg : lsLinhasAgrupadas) { + try { + + String descRuta = teg.getDESCRUTA(); + Integer rutaId = teg.getRUTA_ID().intValue(); + + //Buscando preços especificos de uma Linha + List lsTarifaEscala = rutaCombinacionDAO.pesquisaTarifaOficialEscalaObj(rutaId.toString(), teg.getMONEDA_ID().toString(), + null, teg.getMARCA_ID().toString()); + //Nome da Aba + String sheetName = ""; + //Se o nome da ruta for muito grande, tem que cortar para caber no noma da aba com seu ID + if (descRuta.toString().length() > 22) { + sheetName = numAba + " ".concat(descRuta.substring(0, 22).concat(" (").concat(rutaId.toString()).concat(")")); + } else { + sheetName = numAba + " ".concat(descRuta.concat(" (").concat(rutaId.toString()).concat(")")); + } + + numAba = numAba + 1; + sheet1 = wb.createSheet(sheetName); + SimpleDateFormat sf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); + + //Montando o Cabeçalho + HSSFRow r0 = sheet1.createRow(0); +// r0.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhFeciniciovigencia.label")); +// r0.createCell(1).setCellValue(sf.format(teg.getFECINICIOVIGENCIA()) + " - " + sf.format(teg.getFECFINVIGENCIA())); + + HSSFRow r1 = sheet1.createRow(1); + r1.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMoneda.label")); + r1.createCell(1).setCellValue(teg.getDESCMONEDA().toUpperCase()); + + HSSFRow r2 = sheet1.createRow(2); + r2.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMarca.label")); + r2.createCell(1).setCellValue(teg.getDESCMARCA().toUpperCase()); + + HSSFRow r3 = sheet1.createRow(3); + r3.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhClaseServicio.label")); + r3.createCell(1).setCellValue(teg.getDESCCLASE().toUpperCase()); + + HSSFRow r4 = sheet1.createRow(4); + r4.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhRuta.label")); + r4.createCell(1).setCellValue(descRuta.toUpperCase()); + + HSSFRow r6 = sheet1.createRow(6); + r6.createCell(0).setCellValue("Preço - Taxa - Seguro - Pedagio - Outros"); + + + for (TarifaOficialEscalaVO tar : lsTarifaEscala) { + //Primeira Execucao + //Crias as Linhas + //Coloca o preço do primeiro registro + if (linha == NUM_LINHA_INICIO) { + for (int i = NUM_LINHA_INICIO; i <= lsTarifaEscala.size() + NUM_LINHA_INICIO; i++) { + HSSFRow row = sheet1.createRow(i); + rows[i] = row; + } + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + //Nome e Descrição + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowPrimeiroPrecio = (HSSFRow) rows[linha + 1]; + BigDecimal taxa = tar.getTAXAEMBARQUE(); + BigDecimal segu = tar.getSEGURO(); + BigDecimal outros = tar.getOUTROS(); + BigDecimal pedagio = tar.getPEDAGIO(); + rowPrimeiroPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue() + " \n" + + (taxa == null ? " 0 " : taxa.setScale(2).doubleValue()) + " \n" + + (segu == null ? " 0 " : segu.setScale(2).doubleValue()) + " \n" + + (pedagio == null ? " 0 " : pedagio.setScale(2).doubleValue()) + " \n" + + (outros == null ? " 0 " : outros.setScale(2).doubleValue())); + rows[linha + 1] = rowPrimeiroPrecio; + + linha = linha + 1; + tarAnterior = tar; + continue; + } + + //Si mesma origen, se coloca somente o precio + if (tar.getCVEORIGEM().equals(tarAnterior.getCVEORIGEM())) { + HSSFRow rowTarifa = (HSSFRow) rows[linha + 1]; + if (tar.getPRECIO() != null) { + rowTarifa.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + } + rows[linha + 1] = rowTarifa; + + linha = linha + 1; + } else { + + //Se nao mostra proxima Localidade + Preço na linha + linhaAnterior = linhaAnterior + 1; + linha = linhaAnterior; + coluna = coluna + 1; + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowOrigemPrecio = (HSSFRow) rows[linha + 1]; + BigDecimal taxa = tar.getTAXAEMBARQUE(); + BigDecimal segu = tar.getSEGURO(); + BigDecimal pedagio = tar.getPEDAGIO(); + BigDecimal outros = tar.getOUTROS(); + rowOrigemPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue() + " \n" + + (taxa == null ? " 0 " : taxa.setScale(2).doubleValue()) + " \n" + + (segu == null ? " 0 " : segu.setScale(2).doubleValue()) + " \n" + + (pedagio == null ? " 0 " : pedagio.setScale(2).doubleValue()) + " \n" + + (outros == null ? " 0 " : outros.setScale(2).doubleValue())); + rows[linha + 1] = rowOrigemPrecio; + + linha = linha + 1; + } + tarAnterior = tar; + } + //Ultima Execucao Coloca o Destino Final + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna + 1).setCellValue(tarAnterior.getCVEDESTINO()); + rowOrigem.createCell(coluna + 2).setCellValue(tarAnterior.getDESCDESTINO()); + rows[linha] = rowOrigem; + linha = NUM_LINHA_INICIO; + linhaAnterior = NUM_LINHA_INICIO; + coluna = 0; + } catch (Exception ex) { + log.error("Exportação Excel Escala: ", ex); + } + } + + return wb; + } + + public List pesquisaTarifaObj(List lsAddRmvMonedas, List lsAddRmvMarcas, + List lsAddRmvClaseServico, List lsAddRmvCategoria, + List lsAddRmvEmpresas, List lsAddRmvRutas, + List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente) { + return rutaCombinacionDAO.pesquisaTarifaObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa, lsAddRmvOrgaoConcedente); + } + + public List pesquisaTarifaOficialObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa) { + return rutaCombinacionDAO.pesquisaTarifaOficialObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvVigenciaTarifa); + } + + @Override + public boolean existeTramo(Tramo tramo) { + return rutaCombinacionDAO.existeTramo(tramo); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaEmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaEmpresaServiceImpl.java new file mode 100644 index 000000000..4bb1a5535 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaEmpresaServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; +import com.rjconsultores.ventaboletos.service.RutaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("rutaEmpresaService") +public class RutaEmpresaServiceImpl implements RutaEmpresaService { + + @Autowired + private RutaEmpresaDAO rutaEmpresaDAO; + + public List obtenerTodos() { + return rutaEmpresaDAO.obtenerTodos(); + } + + public RutaEmpresa obtenerID(Integer id) { + return rutaEmpresaDAO.obtenerID(id); + } + + @Transactional + public RutaEmpresa suscribir(RutaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaEmpresaDAO.suscribir(entidad); + } + + @Transactional + public RutaEmpresa actualizacion(RutaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RutaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaEmpresaDAO.actualizacion(entidad); + } + + @Override + public List obtenerPorEmpresa(Empresa empresa) { + return rutaEmpresaDAO.obtenerPorEmpresa(empresa); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaSecuenciaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaSecuenciaServiceImpl.java new file mode 100644 index 000000000..53f3dbb8c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaSecuenciaServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RutaSecuenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("rutaSecuenciaService") +public class RutaSecuenciaServiceImpl implements RutaSecuenciaService { + + @Autowired + private RutaSecuenciaDAO rutaSecuenciaDAO; + + public List obtenerTodos() { + return rutaSecuenciaDAO.obtenerTodos(); + } + + public RutaSecuencia obtenerID(Integer id) { + return rutaSecuenciaDAO.obtenerID(id); + } + + @Transactional + public RutaSecuencia suscribir(RutaSecuencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaSecuenciaDAO.suscribir(entidad); + } + + @Transactional + public RutaSecuencia actualizacion(RutaSecuencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaSecuenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RutaSecuencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaSecuenciaDAO.actualizacion(entidad); + } + + public List buscarSecuenciaOrdenado(Ruta ruta) { + return rutaSecuenciaDAO.buscarSecuenciaOrdenado(ruta); + } + public int borrarSecuencias(Ruta ruta) { + return rutaSecuenciaDAO.borrarSecuencias(ruta); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java new file mode 100644 index 000000000..34b56066f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java @@ -0,0 +1,366 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CorridaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("rutaService") +public class RutaServiceImpl implements RutaService { + + @Autowired + private RutaDAO rutaDAO; + @Autowired + private TramoService tramoService; + @Autowired + private RutaCombinacionService rutaCombinacionService; + @Autowired + private RutaSecuenciaService rutaSecuenciaService; + @Autowired + private CorridaDAO corridaDAO; + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private EsquemaCorridaService esquemaCorridaService; + + private static Logger log = Logger.getLogger(RutaServiceImpl.class); + + public List obtenerTodos() { + return rutaDAO.obtenerTodos(); + } + + public Ruta obtenerID(Integer id) { + return rutaDAO.obtenerID(id); + } + + @Transactional(rollbackFor = BusinessException.class) + public Ruta suscribir(Ruta entidad, List lsParadasSequencia) throws BusinessException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getVentaOffLine() == null) { + entidad.setVentaOffLine(false); + } + + Boolean isClone = entidad.getIsClone() != null ? entidad.getIsClone() : Boolean.FALSE; + entidad = rutaDAO.suscribir(entidad); + if (lsParadasSequencia != null) { + if(!isClone) { + generarSecuencias(entidad, lsParadasSequencia); + } + generarCombinacion(entidad); + } + + return entidad; + } + + private void generarSecuencias(Ruta ruta, List lsParadasSequencia) throws BusinessException { + + if (lsParadasSequencia != null) { + List lsRutaSecuencia = new ArrayList(); + + // Desativo todas as secuencias e gero novamente. + rutaSecuenciaService.borrarSecuencias(ruta); + ruta.setRutaSecuenciaList(null); + + log.info("Geração de Secuencia!"); + log.info("Ruta: " + ruta.getRutaId() + " - " + ruta.getDescruta()); + + lsRutaSecuencia.clear(); + StringBuilder sb = new StringBuilder("Tramo(s) inexistente(s):"); + sb.append("\n"); + boolean msg = false; + for (int i = 0; i < lsParadasSequencia.size() - 1; i++) { + Parada ori = lsParadasSequencia.get(i).getParada(); + Via via = lsParadasSequencia.get(i).getVia(); + Integer sec1 = lsParadasSequencia.get(i).getSecuencia().intValue(); + log.info("Secuencia: " + sec1 + " origen " + ori.getDescparada() + " - " + ori.getCveparada() + " Via: " + via.getNombvia()); + + Parada des = lsParadasSequencia.get(i + 1).getParada(); + Integer sec2 = lsParadasSequencia.get(i + 1).getSecuencia().intValue(); + log.info("Secuencia: " + sec2 + " destino " + des.getDescparada() + " - " + des.getCveparada() + " Via: " + via.getNombvia()); + + ClaseServicio claseServicio = ruta.getClaseServicio(); + + Tramo tramo = tramoService.obtenerTramoUnicoRuta(ori, des, via, claseServicio); + + if (tramo != null) { + + RutaSecuencia rutaSecuencia = new RutaSecuencia(); + rutaSecuencia.setRuta(ruta); + rutaSecuencia.setTramo(tramo); + rutaSecuencia.setNumsecuencia(sec1.shortValue()); + rutaSecuencia.setActivo(Boolean.TRUE); + rutaSecuencia.setFecmodif(Calendar.getInstance().getTime()); + rutaSecuencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + rutaSecuencia = rutaSecuenciaService.suscribir(rutaSecuencia); + lsRutaSecuencia.add(rutaSecuencia); + + } else { + throw new BusinessException("rutaServiceImpl.msg.validacionTRamo", new Object[] { ori.getCveparada(), des.getCveparada(), via.getNombvia(), claseServicio.getDescclase() }); + } + } + ruta.setRutaSecuenciaList(lsRutaSecuencia); + } + } + + @Transactional(rollbackFor = BusinessException.class) + public Ruta actualizacion(Ruta ruta, List lsParadasSequencia) throws BusinessException { + if (lsParadasSequencia != null) { + generarSecuencias(ruta, lsParadasSequencia); + generarCombinacion(ruta); + } + + ruta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ruta.setFecmodif(Calendar.getInstance().getTime()); + ruta.setActivo(Boolean.TRUE); + + return rutaDAO.actualizacion(ruta); + } + + @Transactional(rollbackFor = RegistroConDependenciaException.class) + public void borrar(Ruta entidad) throws RegistroConDependenciaException { + if ((corridaDAO.count(entidad) > 0l) || (esquemaCorridaDAO.count("ruta", entidad) > 0l)) { + throw new RegistroConDependenciaException(); + } + + entidad = this.obtenerID(entidad.getRutaId()); + for (RutaCombinacion rutaCombinacion : entidad.getRutaCombinacionList()) { + rutaCombinacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaCombinacion.setFecmodif(Calendar.getInstance().getTime()); + rutaCombinacion.setActivo(Boolean.FALSE); + } + + for (RutaSecuencia rutaSecuencia : entidad.getRutaSecuenciaList()) { + rutaSecuencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaSecuencia.setFecmodif(Calendar.getInstance().getTime()); + rutaSecuencia.setActivo(Boolean.FALSE); + } + + for (RutaEmpresa rutaEmpresa : entidad.getLsRutaEmpresa()) { + rutaEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaEmpresa.setFecmodif(Calendar.getInstance().getTime()); + rutaEmpresa.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaDAO.actualizacion(entidad); + } + + @Transactional(rollbackFor = BusinessException.class) + public void generarCombinacion(Ruta ruta) throws BusinessException { + + rutaCombinacionService.borrarCombinaciones(ruta); + + List listRutaCombinacion = new ArrayList(); + List lsRutaSecuencia = new ArrayList(); + + lsRutaSecuencia = rutaSecuenciaService.buscarSecuenciaOrdenado(ruta); + + StringBuilder sb = new StringBuilder(); + Boolean gerou = true; + + if (ruta.getRutaId() != null) { + ruta.setRutaCombinacionList(rutaCombinacionService.obtenerPorRuta(ruta)); + } + + for (int i = 0; i < lsRutaSecuencia.size(); i++) { + Tramo tramoSecuencia1 = lsRutaSecuencia.get(i).getTramo(); + Parada origem = tramoSecuencia1.getOrigem(); + + for (int x = 0; x < lsRutaSecuencia.size(); x++) { + Tramo tramoSecuencia2 = lsRutaSecuencia.get(x).getTramo(); + Parada destinoOrigem = tramoSecuencia2.getDestino(); + + // Numero secuencia anterior > Numero secuencia atual não deve fazer. + // Essa condição não permiti gerar uma volta. + if (lsRutaSecuencia.get(i).getNumsecuencia().intValue() > lsRutaSecuencia.get(x).getNumsecuencia().intValue()) { + continue; + } + + // IDA - A x B - A x C + if (origem == destinoOrigem) { + continue; + } + + List listTramo = tramoService.obtenerPorOrigemDestinoFetchLazy(origem, destinoOrigem); + + if (listTramo.isEmpty()) { + throw new BusinessException("rutaServiceImpl.msg.validacionTRamoCombinacion", new Object[] { origem.getDescparada(), origem.getCveparada(), destinoOrigem.getDescparada(), destinoOrigem.getCveparada() }); + } + + Tramo trBuscaOrigemDestino = new Tramo(); + for (Tramo tm : listTramo) { + if (tm.getVia().equals(tramoSecuencia2.getVia())) { + trBuscaOrigemDestino = tm; + break; + } else if (tm.getVia().equals(tramoSecuencia1.getVia())) { + trBuscaOrigemDestino = tm; + break; + } else { + trBuscaOrigemDestino = tm; + } + } + + log.debug("Tramo:" + trBuscaOrigemDestino.getDesctramo()); + + + + RutaCombinacion rc = new RutaCombinacion(); + rc.setActivo(Boolean.TRUE); + rc.setFecmodif(Calendar.getInstance().getTime()); + rc.setIndventa(indVenta(ruta, trBuscaOrigemDestino)); + rc.setRuta(ruta); + rc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rc.setTramo(trBuscaOrigemDestino); + + // Verifica se já existe o registro INATIVO para Reativa-lo e manter a configuração se vende. + // if (!rutaCombinacionService.busquedaRutaTramo(ruta, trBuscaOrigemDestino, Boolean.FALSE)) { + rc = rutaCombinacionService.suscribir(rc); + // } else { + // rutaCombinacionService.activar(ruta, trBuscaOrigemDestino); + // } + + } + } + } + + private boolean indVenta(Ruta ruta, Tramo trBuscaOrigemDestino){ + for (RutaCombinacion rc : ruta.getRutaCombinacionList()){ + if (rc.getTramo().equals(trBuscaOrigemDestino)){ + return rc.getIndventa(); + } + } + return true; + } + + public Parada getDestino(Ruta ruta) { + return rutaDAO.buscarDestino(ruta); + } + + public Parada getOrigem(Ruta ruta) { + return rutaDAO.buscarOrigen(ruta); + } + + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa) { + return rutaDAO.buscarPorClaseServicioEmpresa(claseServicio, empresa); + } + + public List buscarPorClaseServicio(ClaseServicio claseServicio) { + return rutaDAO.buscarPorClaseServicio(claseServicio); + } + + public List buscar(String nomeRuta, ClaseServicio claseServicio, Boolean nomeObrigatorio) { + return rutaDAO.buscar(nomeRuta, claseServicio, nomeObrigatorio); + } + + public List obtenerPorEmpresa(Empresa empresa) { + return rutaDAO.obtenerPorEmpresa(empresa); + } + + public List buscarTodosExceto(Integer... idRuta) { + return rutaDAO.buscarTodosExceto(idRuta); + } + + public List buscarTodosEstos(Integer[] idRutas) { + return rutaDAO.buscarTodosEstos(idRutas); + } + + public List buscarNumRuta(String numRuta) { + return rutaDAO.buscarNumRuta(numRuta); + } + + @Override + public boolean paradaExisteEnLaRuta(Parada parada, Ruta ruta) { + ruta = obtenerID(ruta.getRutaId()); + boolean existe = false; + for (int i = 0; (i < ruta.getRutaSecuenciaList().size()) && !existe; i++) { + RutaSecuencia rutaSecuencia = ruta.getRutaSecuenciaList().get(i); + Tramo tramo = rutaSecuencia.getTramo(); + if (tramo != null) { + if (tramo.getOrigem().equals(parada) || tramo.getDestino().equals(parada)) { + existe = true; + } + } + } + return existe; + } + + public List buscaRuta(String palavraPesquisaRuta) { + return rutaDAO.buscaRuta(palavraPesquisaRuta); + } + + public List buscaRutasFromOrgao(OrgaoConcedente orgao){ + return rutaDAO.buscaRutasFromOrgao(orgao); + } + + @Override + public List buscarRutasPorEmpresas(List lsEmp){ + return rutaDAO.buscarPorRutaPorEmpresas(lsEmp); + } + + private class RutaComparator implements Comparator { + @Override + public int compare(Ruta r1, Ruta r2) { + String name1 = r1.getDescruta(); + String name2 = r2.getDescruta(); + return name1.compareTo(name2); + } + } + + @Override + public Integer getNumSecuenciaOrigen(Integer rutaId, Integer origenId){ + return obtenerID(rutaId).numSecuenciaOrigen(origenId); + } + + @Override + public Integer getNumSecuenciaDestino(Integer rutaId, Integer destinoId){ + return obtenerID(rutaId).numSecuenciaDestino(destinoId); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SecretariaEmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SecretariaEmpresaServiceImpl.java new file mode 100644 index 000000000..df68a6782 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SecretariaEmpresaServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.SecretariaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; +import com.rjconsultores.ventaboletos.service.SecretariaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("secretariaEmpresaService") +public class SecretariaEmpresaServiceImpl implements SecretariaEmpresaService { + + @Autowired + private SecretariaEmpresaDAO secretariaEmpresaDAO; + + public List obtenerTodos() { + return secretariaEmpresaDAO.obtenerTodos(); + } + + public SecretariaEmpresa obtenerID(Integer id) { + return secretariaEmpresaDAO.obtenerID(id); + } + + @Transactional + public SecretariaEmpresa suscribir(SecretariaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaEmpresaDAO.suscribir(entidad); + } + + @Transactional + public SecretariaEmpresa actualizacion(SecretariaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SecretariaEmpresa entidad) { + secretariaEmpresaDAO.borrar(entidad); + } + + + @Override + public List buscarPorSecretaria(Secretaria secretaria){ + return secretariaEmpresaDAO.buscarPorSecretaria(secretaria); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SecretariaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SecretariaServiceImpl.java new file mode 100644 index 000000000..a88ba68c8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SecretariaServiceImpl.java @@ -0,0 +1,76 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.SecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.service.SecretariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("secretariaService") +public class SecretariaServiceImpl implements SecretariaService { + + @Autowired + private SecretariaDAO secretariaDAO; + + public List obtenerTodos() { + return secretariaDAO.obtenerTodos(); + } + + public Secretaria obtenerID(Integer id) { + return secretariaDAO.obtenerID(id); + } + + @Transactional + public Secretaria suscribir(Secretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaDAO.suscribir(entidad); + } + + @Transactional + public Secretaria actualizacion(Secretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Secretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + for (CuponSecretaria cd : entidad.getLsCuponSecretaria()) { + cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cd.setFecmodif(Calendar.getInstance().getTime()); + cd.setActivo(Boolean.FALSE); + } + + secretariaDAO.actualizacion(entidad); + } + + public List buscar(String descsecretaria, String cvesecretaria) { + return secretariaDAO.buscar(descsecretaria, cvesecretaria); + } + + public List buscar(String descsecretaria) { + return secretariaDAO.buscar(descsecretaria); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SegVKMServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SegVKMServiceImpl.java new file mode 100644 index 000000000..194675174 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SegVKMServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.SegVKMDAO; +import com.rjconsultores.ventaboletos.entidad.SegVKM; +import com.rjconsultores.ventaboletos.service.SegVKMService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author RJ + */ +@Service("segVKMService") +public class SegVKMServiceImpl implements SegVKMService { + + @Autowired + private SegVKMDAO segVKMDAO; + + public List obtenerTodos() { + return segVKMDAO.obtenerTodos(); + } + + public SegVKM obtenerID(Integer id) { + return segVKMDAO.obtenerID(id); + } + + @Transactional + public SegVKM suscribir(SegVKM entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return segVKMDAO.suscribir(entidad); + } + + @Transactional + public SegVKM actualizacion(SegVKM entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return segVKMDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SegVKM entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + segVKMDAO.actualizacion(entidad); + } + + public List buscar(String serie) { + return segVKMDAO.buscar(serie); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguradoraEmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguradoraEmpresaServiceImpl.java new file mode 100644 index 000000000..deb650616 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguradoraEmpresaServiceImpl.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.SeguradoraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; +import com.rjconsultores.ventaboletos.service.SeguradoraEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("seguradoraEmpresaService") +public class SeguradoraEmpresaServiceImpl implements SeguradoraEmpresaService { + + @Autowired + private SeguradoraEmpresaDAO seguradoraEmpresaDAO; + + public List obtenerTodos() { + return seguradoraEmpresaDAO.obtenerTodos(); + } + + public SeguradoraEmpresa obtenerID(Integer id) { + return seguradoraEmpresaDAO.obtenerID(id); + } + + public boolean existe(Empresa empresa, String serie){ + return seguradoraEmpresaDAO.existe(empresa, serie); + } + + @Transactional + public SeguradoraEmpresa suscribir(SeguradoraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return seguradoraEmpresaDAO.suscribir(entidad); + } + + @Transactional + public SeguradoraEmpresa actualizacion(SeguradoraEmpresa entidad) { + return seguradoraEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SeguradoraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + seguradoraEmpresaDAO.borrar(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguroKmServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguroKmServiceImpl.java new file mode 100644 index 000000000..8f61c2858 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguroKmServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.SeguroKmDAO; +import com.rjconsultores.ventaboletos.service.SeguroKmService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import org.springframework.transaction.annotation.Transactional; + +@Service("seguroKmService") +public class SeguroKmServiceImpl implements SeguroKmService { + + @Autowired + private SeguroKmDAO seguroKmDAO; + + public List buscarPorOrgao(OrgaoConcedente orgao) { + return seguroKmDAO.buscarPorOrgao(orgao); + } + + public List obtenerTodos() { + return seguroKmDAO.obtenerTodos(); + } + + public SeguroKm obtenerID(Integer id) { + return seguroKmDAO.obtenerID(id); + } + + @Transactional + public SeguroKm suscribir(SeguroKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return seguroKmDAO.suscribir(entidad); + } + + @Transactional + public SeguroKm actualizacion(SeguroKm entidad) { + return seguroKmDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SeguroKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + seguroKmDAO.borrar(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguroTarifaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguroTarifaServiceImpl.java new file mode 100644 index 000000000..82c3bf558 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SeguroTarifaServiceImpl.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO; +import com.rjconsultores.ventaboletos.service.SeguroTarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import org.springframework.transaction.annotation.Transactional; + +@Service("seguroTarifaService") +public class SeguroTarifaServiceImpl implements SeguroTarifaService { + + @Autowired + private SeguroTarifaDAO seguroTarifaDAO; + + public List obtenerTodos() { + return seguroTarifaDAO.obtenerTodos(); + } + + public SeguroTarifa obtenerID(Integer id) { + return seguroTarifaDAO.obtenerID(id); + } + + @Transactional + public SeguroTarifa suscribir(SeguroTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return seguroTarifaDAO.suscribir(entidad); + } + + @Transactional + public SeguroTarifa actualizacion(SeguroTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return seguroTarifaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SeguroTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + seguroTarifaDAO.actualizacion(entidad); + } + + public List buscarPorOrgao(OrgaoConcedente orgao) { + return seguroTarifaDAO.buscarPorOrgao(orgao); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SisdapServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SisdapServiceImpl.java new file mode 100644 index 000000000..63a32f56c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SisdapServiceImpl.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.SisdapDAO; +import com.rjconsultores.ventaboletos.service.SisdapService; + +@Service("sisdapService") +public class SisdapServiceImpl implements SisdapService{ + + @Autowired + private SisdapDAO sisdapDAO; + + @Override + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId) { + return sisdapDAO.getMovimentoLinhas(fecInicio, fecFinal, empresaId); + } + + @Override + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId) { + return sisdapDAO.getMovimentoSecoes(fecInicio, fecFinal, empresaId); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SistemaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SistemaServiceImpl.java new file mode 100644 index 000000000..13a8f5b26 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/SistemaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.SistemaDAO; +import com.rjconsultores.ventaboletos.entidad.Sistema; +import com.rjconsultores.ventaboletos.service.SistemaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("sistemaService") +public class SistemaServiceImpl implements SistemaService { + + @Autowired + private SistemaDAO sistemaDAO; + + public List obtenerTodos() { + return sistemaDAO.obtenerTodos(); + } + + public Sistema obtenerID(Integer id) { + return sistemaDAO.obtenerID(id); + } + + @Transactional + public Sistema suscribir(Sistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return sistemaDAO.suscribir(entidad); + } + + @Transactional + public Sistema actualizacion(Sistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return sistemaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Sistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + sistemaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaCategoriaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaCategoriaServiceImpl.java new file mode 100644 index 000000000..bc5abe308 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaCategoriaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import com.rjconsultores.ventaboletos.service.TarifaCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaCategoriaService") +public class TarifaCategoriaServiceImpl implements TarifaCategoriaService { + + @Autowired + private TarifaCategoriaDAO tarifaCategoriaDAO; + + public List obtenerTodos() { + return tarifaCategoriaDAO.obtenerTodos(); + } + + public TarifaCategoria obtenerID(Integer id) { + return tarifaCategoriaDAO.obtenerID(id); + } + + @Transactional + public TarifaCategoria suscribir(TarifaCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaCategoriaDAO.suscribir(entidad); + } + + @Transactional + public TarifaCategoria actualizacion(TarifaCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaCategoriaDAO.actualizacion(entidad); + } + + public List buscar(Categoria categoria) { + return tarifaCategoriaDAO.buscarPorCategoria(categoria); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaHistServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaHistServiceImpl.java new file mode 100644 index 000000000..1cff76433 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaHistServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaHistDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaHist; +import com.rjconsultores.ventaboletos.service.TarifaHistService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaHistService") +public class TarifaHistServiceImpl implements TarifaHistService { + + @Autowired + private TarifaHistDAO tarifaHistDAO; + + public List obtenerTodos() { + return tarifaHistDAO.obtenerTodos(); + } + + public TarifaHist obtenerID(Integer id) { + return tarifaHistDAO.obtenerID(id); + } + + @Transactional + public TarifaHist suscribir(TarifaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaHistDAO.suscribir(entidad); + } + + @Transactional + public TarifaHist actualizacion(TarifaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaHistDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaHistDAO.borrar(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaKmServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaKmServiceImpl.java new file mode 100644 index 000000000..3ce0f5415 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaKmServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaKmDAO; +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueKmDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import com.rjconsultores.ventaboletos.service.TarifaKmService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarifaKmService") +public class TarifaKmServiceImpl implements TarifaKmService { + + @Autowired + private TarifaKmDAO tarifaKmDAO; + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId) { + return tarifaKmDAO.buscarPorOrgaoAndClasse( orgaoconcedenteId, claseId); + + } + + public List obtenerTodos() { + return tarifaKmDAO.obtenerTodos(); + } + + public TarifaKm obtenerID(Integer id) { + return tarifaKmDAO.obtenerID(id); + } + + @Transactional + public TarifaKm actualizacion(TarifaKm entidad) { + return tarifaKmDAO.actualizacion(entidad); + } + + @Transactional + public TarifaKm suscribir(TarifaKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaKmDAO.suscribir(entidad); + } + + @Transactional + public void borrar(TarifaKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaKmDAO.borrar(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java new file mode 100644 index 000000000..ff21492fa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaMinimaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; +import com.rjconsultores.ventaboletos.service.TarifaMinimaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaMinimaService") +public class TarifaMinimaServiceImpl implements TarifaMinimaService { + + @Autowired + private TarifaMinimaDAO tarifaMinimaDAO; + + public List obtenerTodos() { + return tarifaMinimaDAO.obtenerTodos(); + } + + public TarifaMinima obtenerID(Integer id) { + return tarifaMinimaDAO.obtenerID(id); + } + + @Transactional + public TarifaMinima suscribir(TarifaMinima entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaMinimaDAO.suscribir(entidad); + } + + @Transactional + public TarifaMinima actualizacion(TarifaMinima entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaMinimaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaMinima entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaMinimaDAO.actualizacion(entidad); + } + + public List buscarPorPlaza(Plaza plaza) { + return tarifaMinimaDAO.buscarPorPlaza(plaza); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda) { + return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda); + } + + public List pesquisar(BigDecimal valor, Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio) { + return tarifaMinimaDAO.pesquisar(valor, moneda, plaza, marca, origem, + destino, claseServicio); + } + + public List pesquisar( Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, OrgaoConcedente orgaoConcedente) { + return tarifaMinimaDAO.pesquisar( moneda, plaza, marca, origem, + destino, claseServicio, orgaoConcedente); + } + + public List pesquisarEspecifico(Marca marca, Parada origem, + Parada destino, ClaseServicio claseServicio, Moneda moneda) { + return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda); + } + + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda) { + return tarifaMinimaDAO.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + } + + public List buscarPorMarca(Marca marca, Moneda moneda) { + return tarifaMinimaDAO.buscarPorMarcaMoneda(marca, moneda); + } + + public List buscarPorClaseServico(ClaseServicio claseServicio, + Moneda moneda) { + return tarifaMinimaDAO.buscarPorClaseServicioMoneda(claseServicio, moneda); + } + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda) { + return tarifaMinimaDAO.buscarPorPlazaMoneda(plaza, moneda); + } + + @Override + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + tarifaMinimaCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tarifaMinimaCategoria.setFecmodif(new Date()); + tarifaMinimaCategoria.setActivo(Boolean.TRUE); + return tarifaMinimaDAO.adicionarTarifaMinimaCategoria(tarifaMinimaCategoria); + } + + @Override + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + tarifaMinimaCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tarifaMinimaCategoria.setFecmodif(new Date()); + tarifaMinimaCategoria.setActivo(Boolean.FALSE); + tarifaMinimaDAO.removerTarifaMinimaCategoria(tarifaMinimaCategoria); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java new file mode 100644 index 000000000..a845a317c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java @@ -0,0 +1,224 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.dao.SeguroKmDAO; +import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO; +import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.TarifaOficialService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarifaOficialService") +public class TarifaOficialServiceImpl implements TarifaOficialService { + + private static Logger log = LoggerFactory.getLogger(TarifaOficialServiceImpl.class); + + @Autowired + private TarifaOficialDAO tarifaOficialDAO; + @Autowired + private SeguroKmDAO seguroKmDAO; + @Autowired + private SeguroTarifaDAO seguroTarifaDAO; + @Autowired + private OrgaoConcedenteDAO orgaoConcedenteDAO; + + @Override + @Transactional + public Integer gerarTarifaPorCoeficiente(Integer rutaId, Integer orgaoConcedenteId, List idsEmpresas) { + return tarifaOficialDAO.gerarTarifaPorCoeficiente(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + } + + @Override + @Transactional + public Integer atualizarTarifaPorCoeficiente(Integer rutaId, Integer orgaoConcedenteId) { + return tarifaOficialDAO.atualizarTarifaCoeficiente(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId); + } + + @Override + @Transactional + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro) { + tarifaOficialDAO.copiarParaTarifa(vigenciaTarifa, UsuarioLogado.getUsuarioLogado().getUsuarioId(), calculaPegagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void gerarAtualizarTarifa(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException { + + // Limpando a tabela de TARIFA_OFICIAL + tarifaOficialDAO.limparTarifasOficiais(); + + int x = 0; + if(lsRuta != null && !lsRuta.isEmpty()){ + x = lsRuta.size(); + } + + List idsEmpresas = new ArrayList(); + for(Empresa e : lsEmpresaSelected){ + idsEmpresas.add(e.getEmpresaId()); + } + + do{ + Integer rutaId = null; + if(lsRuta != null && !lsRuta.isEmpty()){ + Ruta r = lsRuta.get(x-1); + rutaId = r.getRutaId(); + } + + log.info("gerarAtualizarTarifa= rudaId:"+rutaId+";orgaoConcedenteId:"+orgaoConcedenteId+";empresaId:"+idsEmpresas); + + //Gerando as tarifas pelo coeficiente + if(orgaoConcedenteId ==null || orgaoConcedenteId != OrgaoConcedente.CODIGO_ARTESP){ + Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedenteId, idsEmpresas); + log.info("qtdTarifaCoeficiente="+qtdTarifaCoeficiente); + } + + //Gerando as tarifas para ARTESP + if(orgaoConcedenteId ==null || orgaoConcedenteId == OrgaoConcedente.CODIGO_ARTESP ){ + Integer qtdTarifaArtesp = tarifaOficialDAO.gerarTarifaArtesp(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + log.info("qtdTarifaArtesp="+qtdTarifaArtesp); + } + x--; + }while(x > 0); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException { + // Limpando a tabela de TARIFA_OFICIAL + tarifaOficialDAO.limparTarifasOficiais(); + + int x =0; + if(lsRuta != null && !lsRuta.isEmpty()){ + x = lsRuta.size(); + } + + List idsEmpresas = new ArrayList(); + for(Empresa e : lsEmpresaSelected){ + idsEmpresas.add(e.getEmpresaId()); + } + + do{ + Integer rutaId =null; + if(lsRuta != null && !lsRuta.isEmpty()){ + rutaId = lsRuta.get(x-1).getRutaId(); + } + + //Gerando as tarifas + tarifaOficialDAO.gerarTabelaZerada(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + + x--; + }while(x > 0); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected) throws BusinessException{ + + if (gerarTabelaZerada){ + gerarAtualizarTabelaZerada(lsRuta, orgaoConcedenteId, lsEmpresaSelected); + } + + List idsEmpresas = new ArrayList(); + for(Empresa e : lsEmpresaSelected){ + idsEmpresas.add(e.getEmpresaId()); + } + + tarifaOficialDAO.atualizarTaxaEmbarque(lsRuta, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId) throws BusinessException { + + tarifaOficialDAO.atualizarSeguroPorKm(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException { + tarifaOficialDAO.atualizarSeguroPorTarifa(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguro(List lsRuta, Integer orgaoId) throws BusinessException { + + List lsOrgaoId = new ArrayList(); + + if (orgaoId == null) { + lsOrgaoId.addAll(orgaoConcedenteDAO.obtenerTodosIds()); + } else { + lsOrgaoId.add(orgaoId); + } + + int x = 0; + if(lsRuta != null && !lsRuta.isEmpty()){ + x = lsRuta.size(); + } + + do{ + Integer rutaId = null; + if(lsRuta != null && !lsRuta.isEmpty()){ + rutaId = lsRuta.get(x-1).getRutaId(); + } + //O seguro por km é preferencial em relação ao por tarifa. + for (Integer orgaoConcedenteId : lsOrgaoId) { + if (seguroKmDAO.existe(orgaoConcedenteId)) { + atualizarSeguroPorKm(rutaId, orgaoConcedenteId); + } else if (seguroTarifaDAO.existe(orgaoConcedenteId)) { + atualizarSeguroPorTarifa(rutaId, orgaoConcedenteId); + } + } + x--; + }while(x > 0); + } + + @Override + @Transactional + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Boolean taxaEmbarque) { + tarifaOficialDAO.aplicarArredondamentoTarifa(orgaoConcedenteId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), taxaEmbarque); + } + + @Override + @Transactional + public void actualizacion(TarifaOficial tarifaOficial) { + tarifaOficialDAO.actualizacion(tarifaOficial); + } + + @Override + public TarifaOficial obtenerID(Integer tarifaOficialId) { + return tarifaOficialDAO.obtenerID(tarifaOficialId); + } + + @Override + public void borrar(TarifaOficial tarifaOficial) { + tarifaOficialDAO.borrar(tarifaOficial); + } + + @Override + public long obtenerCount(){ + return tarifaOficialDAO.obtenerCount(); + } + + @Override + @Transactional + public void atualizarPedagio() { + tarifaOficialDAO.atualizarPedagio(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java new file mode 100644 index 000000000..42fa6df64 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java @@ -0,0 +1,283 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import com.rjconsultores.ventaboletos.entidad.TarifaHist; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.MonedaService; +import com.rjconsultores.ventaboletos.service.ParadaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TarifaHistService; +import com.rjconsultores.ventaboletos.service.TarifaMinimaService; +import com.rjconsultores.ventaboletos.service.TarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author rodrigo + */ +@Service("tarifaService") +public class TarifaServiceImpl implements TarifaService { + + @Autowired + private TarifaDAO tarifaDAO; + @Autowired + private TarifaHistService tarifaHistService; + @Autowired + private ConstanteService constanteService; + @Autowired + private MonedaService monedaService; + @Autowired + private TarifaMinimaService tarifaMinimaService; + @Autowired + private ParadaService paradaService; + @Autowired + private RutaService rutaService; + private static Logger log = Logger.getLogger(TarifaServiceImpl.class); + + public List obtenerTodos() { + return tarifaDAO.obtenerTodos(); + } + + @Transactional(readOnly = true) + public Tarifa obtenerID(Integer id) { + return tarifaDAO.obtenerID(id); + } + + private void cadastrarTarifaHistorico(Tarifa entidad) { + TarifaHist th = new TarifaHist(); + th.setActivo(entidad.getActivo()); + th.setClaseServicio(entidad.getClaseServicio()); + th.setFecmodif(entidad.getFecmodif()); + th.setMarca(entidad.getMarca()); + th.setMoneda(entidad.getMoneda()); + th.setPrecio(entidad.getPrecio()); + th.setPreciooriginal(entidad.getPreciooriginal()); + th.setStatustarifa(entidad.getStatustarifa()); + th.setUsuarioId(entidad.getUsuarioId()); + th.setVigenciaTarifa(entidad.getVigenciaTarifa()); + + th = tarifaHistService.suscribir(th); + } + + @Transactional + public Tarifa suscribir(Tarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + if (entidad.getPrecio() != null) { + entidad.setPrecio(entidad.getPrecio().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPreciooriginal() != null) { + entidad.setPreciooriginal(entidad.getPreciooriginal().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPrecioredabierto() != null) { + entidad.setPrecioredabierto(entidad.getPrecioredabierto().setScale(2, RoundingMode.HALF_UP)); + } + cadastrarTarifaHistorico(entidad); + + return tarifaDAO.suscribir(entidad); + } + + @Transactional + public Tarifa actualizacion(Tarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + if (entidad.getPrecio() != null) { + entidad.setPrecio(entidad.getPrecio().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPreciooriginal() != null) { + entidad.setPreciooriginal(entidad.getPreciooriginal().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPrecioredabierto() != null) { + entidad.setPrecioredabierto(entidad.getPrecioredabierto().setScale(2, RoundingMode.HALF_UP)); + } + + // Rafael: Segundo a Letícia, não pode atualizar o DOLAR caso haja uma + // atualização de preço, os dolores somente são gerados na inclusão de preço. + + // Tarifa tarifa = this.obtenerID(entidad.getTarifaId()); + // entidad.setLsTarifaCategoria(tarifa.getLsTarifaCategoria()); + // entidad.setLsTarifaTipoptovta(tarifa.getLsTarifaTipoptovta()); + + cadastrarTarifaHistorico(entidad); + // cadastrarTarifaMonedaEstrangeira(entidad); + + return tarifaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Tarifa entidad) { + for (TarifaCategoria pricing : entidad.getLsTarifaCategoria()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + } + + for (TarifaTipoptovta pricing : entidad.getLsTarifaTipoptovta()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cadastrarTarifaHistorico(entidad); + + tarifaDAO.actualizacion(entidad); + } + + public boolean existe(Marca marca, Tramo tramo, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente) { + return tarifaDAO.existe(marca, tramo, moneda, claseServicio, vigenciaTarifa, ruta, orgaoConcedente); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda, + ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, + Categoria categoria, TipoPuntoVenta tipoPuntoVenta) { + return tarifaDAO.pesquisar(marca, origem, destino, moneda, claseServicio, vigenciaTarifa, + categoria, tipoPuntoVenta); + } + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio, + VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { + return tarifaDAO.buscar(tramo, marca, claseServicio, vigenciaTarifa, moneda, ruta); + } + + public List buscarPorVigencia(VigenciaTarifa vigencia, Empresa empresa) { + return tarifaDAO.buscarTarifasAtivasInativasPorVigencia(vigencia, empresa); + } + + public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem, + Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda) { + + Boolean podeAlterarTarifaMinima = Boolean.TRUE; + + List lsTarifaMinima = tarifaMinimaService.pesquisarEspecifico(marca, origem, destino, claseServicio, moneda); + + if (lsTarifaMinima.isEmpty()) { + lsTarifaMinima = tarifaMinimaService.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + } + + log.debug("Moneda : " + moneda.getDescmoneda()); + log.debug("Preço : " + tarifa.getPrecio()); + + for (TarifaMinima tm : lsTarifaMinima) { + if (tarifa.getPrecio().compareTo(tm.getImportetarifa()) == -1) { + podeAlterarTarifaMinima = Boolean.FALSE; + log.debug("Tarifa Minima ID: " + tm.getTarifaminimaId()); + log.debug("Tarifa Minima Origen : " + tm.getOrigem().getDescparada()); + log.debug("Tarifa Minima Destino: " + tm.getDestino().getDescparada()); + log.debug("Tarifa Minima Marca : " + tm.getMarca().getDescmarca()); + log.debug("Tarifa Minima Clase : " + tm.getClaseServicio().getDescclase()); + log.debug("Tarifa Minima Moneda : " + tm.getMoneda().getDescmoneda()); + log.debug("Tarifa Minima : " + tm.getImportetarifa() + " Valor Alterado: " + tarifa.getPrecio()); + } + } + + return podeAlterarTarifaMinima; + } + + public List buscarExisteVigencia(VigenciaTarifa vigenciaTarifa) { + return tarifaDAO.buscarTarifasAtivasPorVigencia(vigenciaTarifa); + } + + // Metodo para gerar todas as tarifas possiveis + @Transactional + public Boolean generarTarifas(VigenciaTarifa vigencia, Marca marca) { + + // Lista de Rutas + List lsRuta = rutaService.obtenerTodos(); + try { + for (Ruta r : lsRuta) { + Ruta ruta = rutaService.obtenerID(r.getRutaId()); + + // Lista de Combinações + List lsRutaCombinacion = ruta.getRutaCombinacionList(); + for (RutaCombinacion rc : lsRutaCombinacion) { + + Tarifa tarifa = new Tarifa(); + // Valor de 6 Pesos por Default + tarifa.setPrecio(BigDecimal.valueOf(6)); + tarifa.setPreciooriginal(BigDecimal.ZERO); + // Pesos Mexicano + tarifa.setMoneda(monedaService.obtenerID(1)); + // Marca... informado antes + // Vigencia... informado antes + tarifa.setVigenciaTarifa(vigencia); + tarifa.setMarca(marca); + + tarifa.setClaseServicio(r.getClaseServicio()); + tarifa.setTramo(rc.getTramo()); + + // Tramo-Marca-Classe-Vigencia-Moneda + boolean existe = tarifaDAO.existe(tarifa.getMarca(), tarifa.getTramo(), tarifa.getMoneda(), tarifa.getClaseServicio(), tarifa.getVigenciaTarifa(), tarifa.getRuta(), tarifa.getOrgaoConcedente()); + + if (!existe) { + tarifa.setFecmodif(Calendar.getInstance().getTime()); + tarifa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tarifa.setActivo(Boolean.TRUE); + tarifa.setStatustarifa("L"); + + log.debug("Tarifa: Ruta " + ruta.getDescruta() + " - " + ruta.getRutaId() + " Tramo: " + tarifa.getTramo().getTramoId() + + " Marca " + marca + " Vigencia: " + vigencia); + + tarifa = tarifaDAO.suscribir(tarifa); + } + } + } + } catch (Exception e) { + log.debug("ERRO al generar tarifas", e); + return false; + } + return true; + } + + @Override + public boolean buscarTarifaExisteTramo(Tramo tramo) { + return tarifaDAO.buscarTarifaExisteTramo(tramo); + } + + @Override + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { + tarifaDAO.copiarTarifas(vigenciaTarifaOrigem, vigenciaTarifaDestino, empresa, excluirTarifasDestino); + } + + @Override + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa) { + return tarifaDAO.existeTarifas(vigenciaTarifa); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaTipoptovtaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaTipoptovtaServiceImpl.java new file mode 100644 index 000000000..b9f1352b9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarifaTipoptovtaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; +import com.rjconsultores.ventaboletos.service.TarifaTipoptovtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaTipoptovtaService") +public class TarifaTipoptovtaServiceImpl implements TarifaTipoptovtaService { + + @Autowired + private TarifaTipoptovtaDAO tarifaTipoptovtaDAO; + + public List obtenerTodos() { + return tarifaTipoptovtaDAO.obtenerTodos(); + } + + public TarifaTipoptovta obtenerID(Integer id) { + return tarifaTipoptovtaDAO.obtenerID(id); + } + + @Transactional + public TarifaTipoptovta suscribir(TarifaTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaTipoptovtaDAO.suscribir(entidad); + } + + @Transactional + public TarifaTipoptovta actualizacion(TarifaTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaTipoptovtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaTipoptovtaDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaCreditoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaCreditoServiceImpl.java new file mode 100644 index 000000000..28b9c10fa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaCreditoServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarjetaCreditoDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; +import com.rjconsultores.ventaboletos.service.TarjetaCreditoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarjetaCreditoService") +public class TarjetaCreditoServiceImpl implements TarjetaCreditoService { + + @Autowired + private TarjetaCreditoDAO tarjetaCreditoDAO; + + public List obtenerTodos() { + return tarjetaCreditoDAO.obtenerTodos(); + } + + public TarjetaCredito obtenerID(Integer id) { + return tarjetaCreditoDAO.obtenerID(id); + } + + @Transactional + public TarjetaCredito suscribir(TarjetaCredito entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarjetaCreditoDAO.suscribir(entidad); + } + + @Transactional + public TarjetaCredito actualizacion(TarjetaCredito entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarjetaCreditoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaCredito entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarjetaCreditoDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaFidelidadServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaFidelidadServiceImpl.java new file mode 100644 index 000000000..9e0c53fc1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaFidelidadServiceImpl.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarjetaFidelidadDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; +import com.rjconsultores.ventaboletos.service.TarjetaFidelidadService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tarjetaFidelidadService") +public class TarjetaFidelidadServiceImpl implements TarjetaFidelidadService { + + @Autowired + private TarjetaFidelidadDAO fidelidadDAO; + + public List obtenerTodos() { + return fidelidadDAO.obtenerTodos(); + } + + public TarjetaFidelidad obtenerID(Integer id) { + return fidelidadDAO.obtenerID(id); + } + + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta){ + return fidelidadDAO.obtenerNumTarjeta(numTarjeta); + } + + @Transactional + public TarjetaFidelidad suscribir(TarjetaFidelidad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return fidelidadDAO.suscribir(entidad); + } + + @Transactional + public TarjetaFidelidad actualizacion(TarjetaFidelidad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return fidelidadDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaFidelidad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + fidelidadDAO.actualizacion(entidad); + } + + public List obtenerCantDesc() { + return fidelidadDAO.obtenerCantDesc(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaRecaudacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaRecaudacionServiceImpl.java new file mode 100644 index 000000000..357b4c1b1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaRecaudacionServiceImpl.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarjetaRecaudacionDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; +import com.rjconsultores.ventaboletos.service.TarjetaRecaudacionService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tarjetaRecaudacionService") +public class TarjetaRecaudacionServiceImpl implements TarjetaRecaudacionService { + + @Autowired + private TarjetaRecaudacionDAO tarjetaRecaudacionDAO; + + public List obtenerTodos() { + return tarjetaRecaudacionDAO.obtenerTodos(); + } + + public TarjetaRecaudacion obtenerID(TarjetaRecaudacionPK id) { + return tarjetaRecaudacionDAO.obtenerID(id); + } + + @Transactional + public TarjetaRecaudacion suscribir(TarjetaRecaudacion entidad) { + return tarjetaRecaudacionDAO.suscribir(entidad); + } + + @Transactional + public TarjetaRecaudacion actualizacion(TarjetaRecaudacion entidad) { + return tarjetaRecaudacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaRecaudacion entidad) { + tarjetaRecaudacionDAO.borrar(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaViajeServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaViajeServiceImpl.java new file mode 100644 index 000000000..e13a85796 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TarjetaViajeServiceImpl.java @@ -0,0 +1,267 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.zul.Comboitem; + + +import com.rjconsultores.ventaboletos.dao.CorridaTramoDAO; +import com.rjconsultores.ventaboletos.dao.TarjetaViajeDAO; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; +import com.rjconsultores.ventaboletos.service.CorridaService; +import com.rjconsultores.ventaboletos.service.RhPagoConductorService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TarjetaViajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.math.BigInteger; +import org.omg.CORBA.TCKind; + +@Service("tarjetaViajeService") +public class TarjetaViajeServiceImpl implements TarjetaViajeService { + + @Autowired + private TarjetaViajeDAO tarjetaViajeDAO; + @Autowired + private CorridaTramoDAO corridaTramoDAO; + @Autowired + private CorridaService corridaService; + @Autowired + private RhPagoConductorService rhPagoConductorService; + @Autowired + private RutaService rutaService; + private static Logger log = Logger.getLogger(TarjetaViajeServiceImpl.class); + + @Override + public List obtenerTodos() { + return tarjetaViajeDAO.obtenerTodos(); + } + + @Override + public TarjetaViaje obtenerID(Integer id) { + return tarjetaViajeDAO.obtenerID(id); + } + + @Transactional + public TarjetaViaje suscribir(TarjetaViaje entidad) { + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return tarjetaViajeDAO.suscribir(entidad); + } + + @Transactional + public TarjetaViaje actualizacion(TarjetaViaje entidad) { + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return tarjetaViajeDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaViaje entidad) { + if (entidad.getIndstatustarjeta().equals("M")) { + tarjetaViajeDAO.borrar(entidad); + } else { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(false); + entidad.setIndstatustarjeta("B"); + tarjetaViajeDAO.actualizacion(entidad); + } + } + + @Transactional + public void grabarTarjetaViaje(List lsCorridaTramo) { + try { + TarjetaViaje tarjeta = null; + for (CorridaTramo ct : lsCorridaTramo) { + + if (ct.getCorrida() == null) { + log.debug("Corrida Tramo sem Corrida: " + ct.getCorridatramoId()); + continue; + } + + tarjeta = new TarjetaViaje(); + tarjeta.setActivo(true); + if (ct.getCorrida().getCorridaRebote() != null) { + tarjeta.setIndRebote(1); + } else { + tarjeta.setIndRebote(0); + } + tarjeta.setFecenvionomina(null); + tarjeta.setFecmodif(new Date()); + tarjeta.setFoliotarjetaviaje(ct.getFolioTarjeta() == null ? null : ct.getFolioTarjeta().toString());// checar + tarjeta.setIndstatustarjeta("N"); + tarjeta.setNumsecuencia(ct.getNumsecuencia() != null ? Integer.getInteger(ct.getNumsecuencia().toString()) : null); + tarjeta.setUsuarioId(ct.getUsuarioId()); + tarjeta.setAutobus(ct.getAutobus()); + tarjeta.setClaseServicio(ct.getCorrida().getClaseServicio()); + tarjeta.setConductor(ct.getConductor()); + tarjeta.setConductor1(ct.getConductor1()); + tarjeta.setEmpresa(ct.getCorrida().getEmpresa()); + tarjeta.setMarca(ct.getCorrida().getMarca()); + + tarjeta.setFecInicial(ct.getCorrida().getId().getFeccorrida()); + tarjeta.setFecHorSalida(ct.getCorrida().getFechorsalida()); + + tarjeta.setNumCorrida(ct.getCorrida().getId().getCorridaId()); + + BigDecimal kmPagoCondutor = new BigDecimal(BigInteger.ZERO); + BigDecimal kmReal = new BigDecimal(BigInteger.ZERO); +// BigDecimal teste = corridaTramoDAO.buscarSumTarjetaMesmaCorrida(ct); +// tarjeta.setKmPagoConductor(teste); +// tarjeta.setKmReal(teste); +// + List lsCorridasAdicionais = corridaTramoDAO.buscarTarjetaMesmaCorrida(ct); + if (!lsCorridasAdicionais.isEmpty()) { + for (CorridaTramo ct2 : lsCorridasAdicionais) { + if (ct2.getTramo() == null) { + log.debug("Corrida Tramo Sem Tramo: " + ct2.getCorridatramoId().toString()); + continue; + } + if (ct2.getTramo().getKmPagoConductor() != null) { + + log.debug("Corrida Tramo Id: " + ct2.getCorridatramoId().toString()); + kmPagoCondutor = kmPagoCondutor.add(ct2.getTramo().getKmPagoConductor()); + kmReal = kmReal.add(ct2.getTramo().getKmReal()); + } + } + } + + tarjeta.setKmPagoConductor(kmPagoCondutor); + tarjeta.setKmReal(kmReal); + + //Origem Destino Inicial e Final da Corrida + Corrida corrida = ct.getCorrida(); + tarjeta.setOrigen(corrida.getOrigem().getCveparada()); + tarjeta.setDestino(corrida.getDestino().getCveparada()); + + tarjetaViajeDAO.suscribir(tarjeta); + ct.setIndmanttarjeta(true); + corridaTramoDAO.actualizacion(ct); + + } + } catch (Exception e) { + log.error("Geracao de Tarjetas"); + log.error(e); + } + } + + @Override + public void verificaCorridaDuplicada(List lsTarjetaViaje, boolean todasTarjetas) { + + for (TarjetaViaje t : lsTarjetaViaje) { + List ls = tarjetaViajeDAO.buscarTarjetaPorFiltros(t); + if (ls.size() > 1) { + //Vermelho + t.seteCorridaDuplicada(true); + + //Esse teste checa se houve uma volta para o autobus/condutor, + //Se teve volta a TarjetaViaje tem que ser preta + boolean existeCorridaVolta = tarjetaViajeDAO.buscarTarjetaExisteVolta(t); + + //Se não existe corrida de volta Vermelho + t.seteCorridaDuplicada(!existeCorridaVolta); + } + } + + } + + @Override + public List buscarTarjetaPorFiltros(Integer autoIni, + Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa) { + + return tarjetaViajeDAO.buscarTarjetaPorFiltros(autoIni, autoFin, + dataIni, dataFin, empresa); + } + + @Override + public List generarArchivoNomina(Date fecIni, Date fecFin) { + Calendar c = Calendar.getInstance(); + c.setTime(fecFin); + c.add(Calendar.HOUR, 23); + c.add(Calendar.MINUTE, 59); + c.add(Calendar.SECOND, 59); + fecFin = c.getTime(); + List lsTarjetas = tarjetaViajeDAO.buscarTarjetasParaEnvioNomina(fecIni, fecFin); + + try { + for (TarjetaViaje tv : lsTarjetas) { + RhPagoConductor rh = new RhPagoConductor(); + + Corrida.Id id = new Corrida.Id(); + id.setCorridaId(tv.getNumCorrida()); + id.setFeccorrida(tv.getFecInicial()); + Corrida corrida = corridaService.obtenerID(id); + + if (tv.getAutobus() != null) { + rh.setNumautobus(Integer.parseInt(tv.getAutobus().getNumautobus())); + } + rh.setNumcorrida(tv.getNumCorrida()); + rh.setFechorsalida(tv.getFecHorSalida()); + + rh.setCantkmsoperador1(tv.getKmPagoConductor()); + rh.setCantkmsoperador2(tv.getKmPagoConductor()); + + if (tv.getConductor() != null) { + if (tv.getConductor().getEmpleado() != null) { + rh.setCveoperador1(tv.getConductor().getEmpleado().getCveEmpleado()); + rh.setNombreoperador1(tv.getConductor().getEmpleado().getNombEmpleado()); + } + } + if (tv.getConductor1() != null) { + if (tv.getConductor1().getEmpleado() != null) { + rh.setCveoperador2(tv.getConductor1().getEmpleado().getCveEmpleado()); + rh.setNombreoperador2(tv.getConductor1().getEmpleado().getNombEmpleado()); + } + } + if (tv.getMarca() != null) { + rh.setMarca(tv.getMarca().getMarcaId()); + } + if (corrida != null) { + if (corrida.getRuta() != null) { + rh.setRuta(corrida.getRuta().getRutaId()); + String descRuta = corrida.getRuta().getDescruta(); + rh.setDescruta(descRuta.length() > 29 ? descRuta.substring(0, 30) : descRuta); + rh.setCveOrigen(rutaService.getOrigem(corrida.getRuta()).getCveparada()); + rh.setCveDestino(rutaService.getDestino(corrida.getRuta()).getCveparada()); + } + + boolean pisoExtra = (corrida.getNumPiso() == null) ? false + : corrida.getNumPiso() == 2 ? true : false; + rh.setIndextra(pisoExtra); + } + log.debug("RH_SALIDAS: NUMAUTOBUS: " + rh.getNumautobus() + " NUMCORRIDA: " + rh.getNumcorrida() + + " DESCRUTA: " + rh.getDescruta() + " FECHORSALIDA: " + rh.getFechorsalida() + + " CVEOPERADOR1: " + rh.getCveoperador1() + " NOMBREOPERADOR1: " + rh.getNombreoperador1() + " CANTKMSOPERADOR1: " + rh.getCantkmsoperador1() + + " CVEOPERADOR2: " + rh.getCveoperador2() + " NOMBREOPERADOR2: " + rh.getNombreoperador2() + " CANTKMSOPERADOR2: " + rh.getCantkmsoperador2() + + " INDEXTRA: " + rh.getIndextra() + " CVEORIGEN: " + rh.getCveOrigen() + " CVEDESTINO: " + rh.getCveDestino() + " RUTA_ID: " + rh.getRuta()); + rhPagoConductorService.suscribir(rh); + } + + } catch (Exception e) { + log.error(e); + return null; + } + + return lsTarjetas; + } + + @Transactional + public void actulizarTarjetasEnviadas(List lsTarjetas) { + for (TarjetaViaje tarjeta : lsTarjetas) { + tarjeta.setFecenvionomina(new Date()); + tarjetaViajeDAO.actualizacion(tarjeta); + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbLevanteCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbLevanteCtrlServiceImpl.java new file mode 100644 index 000000000..83ad221c9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbLevanteCtrlServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbLevanteCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; +import com.rjconsultores.ventaboletos.service.TaxaEmbLevanteCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("taxaEmbLevanteCtrlService") +public class TaxaEmbLevanteCtrlServiceImpl implements TaxaEmbLevanteCtrlService { + + @Autowired + private TaxaEmbLevanteCtrlDAO taxaEmbLevanteCtrlDAO; + + @Override + public List obtenerTodos() { + return taxaEmbLevanteCtrlDAO.obtenerTodos(); + } + + @Override + public TaxaEmbLevanteCtrl obtenerID(Integer id) { + return taxaEmbLevanteCtrlDAO.obtenerID(id); + } + + @Transactional + public TaxaEmbLevanteCtrl suscribir(TaxaEmbLevanteCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbLevanteCtrlDAO.suscribir(entidad); + } + + @Transactional + public TaxaEmbLevanteCtrl actualizacion(TaxaEmbLevanteCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbLevanteCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TaxaEmbLevanteCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + taxaEmbLevanteCtrlDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueKmServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueKmServiceImpl.java new file mode 100644 index 000000000..0584ff027 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueKmServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueKmDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import com.rjconsultores.ventaboletos.service.TaxaEmbarqueKmService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("taxaEmbarqueKmService") +public class TaxaEmbarqueKmServiceImpl implements TaxaEmbarqueKmService { + + @Autowired + private TaxaEmbarqueKmDAO taxaEmbarqueKmDAO; + + public List obtenerTodos() { + return taxaEmbarqueKmDAO.obtenerTodos(); + } + + public TaxaEmbarqueKm obtenerID(Integer id) { + return taxaEmbarqueKmDAO.obtenerID(id); + } + + @Transactional + public TaxaEmbarqueKm suscribir(TaxaEmbarqueKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbarqueKmDAO.suscribir(entidad); + } + + @Transactional + public TaxaEmbarqueKm actualizacion(TaxaEmbarqueKm entidad) { + return taxaEmbarqueKmDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TaxaEmbarqueKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + taxaEmbarqueKmDAO.borrar(entidad); + } + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId) { + return taxaEmbarqueKmDAO.buscarPorOrgao(orgaoconcedenteId); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueParadaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueParadaServiceImpl.java new file mode 100644 index 000000000..ce802c482 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueParadaServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueParadaDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import com.rjconsultores.ventaboletos.service.TaxaEmbarqueParadaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("taxaEmbarqueParadaService") +public class TaxaEmbarqueParadaServiceImpl implements TaxaEmbarqueParadaService { + + @Autowired + private TaxaEmbarqueParadaDAO taxaEmbarqueParadaDAO; + + public List obtenerTodos() { + return taxaEmbarqueParadaDAO.obtenerTodos(); + } + + public TaxaEmbarqueParada obtenerID(Integer id) { + return taxaEmbarqueParadaDAO.obtenerID(id); + } + + @Transactional + public TaxaEmbarqueParada suscribir(TaxaEmbarqueParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbarqueParadaDAO.suscribir(entidad); + } + + @Transactional + public TaxaEmbarqueParada actualizacion(TaxaEmbarqueParada entidad) { + return taxaEmbarqueParadaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TaxaEmbarqueParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + taxaEmbarqueParadaDAO.borrar(entidad); + } + + public List buscarPorLocalidade(Parada parada) { + return taxaEmbarqueParadaDAO.buscarPorLocalidade(parada); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCiudadServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCiudadServiceImpl.java new file mode 100644 index 000000000..95a68d6f8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCiudadServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCiudadDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; +import com.rjconsultores.ventaboletos.service.TipoCambioCiudadService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoCambioCiudadService") +public class TipoCambioCiudadServiceImpl implements TipoCambioCiudadService { + + @Autowired + private TipoCambioCiudadDAO tipoCambioCiudadDAO; + + public List obtenerTodos() { + return tipoCambioCiudadDAO.obtenerTodos(); + } + + public TipoCambioCiudad obtenerID(Integer id) { + return tipoCambioCiudadDAO.obtenerID(id); + } + + @Transactional + public TipoCambioCiudad suscribir(TipoCambioCiudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCiudadDAO.suscribir(entidad); + } + + @Transactional + public TipoCambioCiudad actualizacion(TipoCambioCiudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCiudadDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCambioCiudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCambioCiudadDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCtrlServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCtrlServiceImpl.java new file mode 100644 index 000000000..0f4ffa092 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCtrlServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; +import com.rjconsultores.ventaboletos.service.TipoCambioCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoCambioCtrlService") +public class TipoCambioCtrlServiceImpl implements TipoCambioCtrlService { + + @Autowired + private TipoCambioCtrlDAO tipoCambioCtrlDAO; + + public List obtenerTodos() { + return tipoCambioCtrlDAO.obtenerTodos(); + } + + public TipoCambioCtrl obtenerID(Integer id) { + return tipoCambioCtrlDAO.obtenerID(id); + } + + @Transactional + public TipoCambioCtrl suscribir(TipoCambioCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCtrlDAO.suscribir(entidad); + } + + @Transactional + public TipoCambioCtrl actualizacion(TipoCambioCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCambioCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + for (TipoCambioCiudad tcc : entidad.getTipoCambioCiudadList()) { + tcc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tcc.setFecmodif(Calendar.getInstance().getTime()); + tcc.setActivo(Boolean.FALSE); + } + + tipoCambioCtrlDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoConvenioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoConvenioServiceImpl.java new file mode 100644 index 000000000..be9301e07 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoConvenioServiceImpl.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import com.rjconsultores.ventaboletos.service.TipoConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tipoConvenioService") +public class TipoConvenioServiceImpl implements TipoConvenioService{ + + @Autowired + private TipoConvenioDAO tcdao; + + public List obtenerTodos() { + return tcdao.obtenerTodos(); + } + + public TipoConvenio obtenerID(Integer id) { + return tcdao.obtenerID(id); + } + + @Transactional + public TipoConvenio suscribir(TipoConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tcdao.suscribir(entidad); + } + + @Transactional + public TipoConvenio actualizacion(TipoConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tcdao.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tcdao.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCorteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCorteServiceImpl.java new file mode 100644 index 000000000..64f8fbdd8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCorteServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCorteDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import com.rjconsultores.ventaboletos.service.TipoCorteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoCorteService") +public class TipoCorteServiceImpl implements TipoCorteService { + + @Autowired + private TipoCorteDAO tipoCorteDAO; + + public List obtenerTodos() { + return tipoCorteDAO.obtenerTodos(); + } + + public TipoCorte obtenerID(Integer id) { + return tipoCorteDAO.obtenerID(id); + } + + @Transactional + public TipoCorte suscribir(TipoCorte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCorteDAO.suscribir(entidad); + } + + @Transactional + public TipoCorte actualizacion(TipoCorte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCorteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCorte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCorteDAO.actualizacion(entidad); + } + + public List buscar(String desctipo) { + return tipoCorteDAO.buscar(desctipo); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaDescuentoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaDescuentoServiceImpl.java new file mode 100644 index 000000000..56c6dc915 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaDescuentoServiceImpl.java @@ -0,0 +1,94 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import com.rjconsultores.ventaboletos.service.TipoCortesiaDescuentoService; +import com.rjconsultores.ventaboletos.service.TipoCortesiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tipoCortesiaDService") +public class TipoCortesiaDescuentoServiceImpl implements TipoCortesiaDescuentoService { + + @Autowired + private TipoCortesiaDescuentoDAO tipoCortesiaDescuentoDAO; + @Autowired + private TipoCortesiaService tcDAO; + + public List obtenerTodos() { + return tipoCortesiaDescuentoDAO.obtenerTodos(); + } + + public TipoCortesiaDescuento obtenerID(Integer id) { + return tipoCortesiaDescuentoDAO.obtenerID(id); + } + + @Transactional + public TipoCortesiaDescuento suscribir(TipoCortesiaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDescuentoDAO.suscribir(entidad); + } + + @Transactional + public TipoCortesiaDescuento actualizacion(TipoCortesiaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDescuentoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCortesiaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCortesiaDescuentoDAO.actualizacion(entidad); + } + + public List pesquisar(TipoCortesia tipoCortesia) { + + return tipoCortesiaDescuentoDAO.pesquisar(tipoCortesia); + + } + + public List Onchangue(TipoCortesia tp) { + List tc = tcDAO.obtenerTodos(); + TipoCortesia Tcselec = null; + for (TipoCortesia tpc : tc) { + + if (tpc.getTipocortesiaId().equals(tp.getTipocortesiaId())) { + Tcselec = tpc; + } + } + + return tipoCortesiaDescuentoDAO.Onchangue(Tcselec); + } + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia) { + return tipoCortesiaDescuentoDAO.buscar(porcentaje, tipoCortesia); + } + + public List obtenerTipoCortesia(int i) { + return tipoCortesiaDescuentoDAO.obtenerTipoCortesia(i); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaServiceImpl.java new file mode 100644 index 000000000..ce104fbb6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.service.TipoCortesiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tipoCortesiaService") +public class TipoCortesiaServiceImpl implements TipoCortesiaService { + + @Autowired + private TipoCortesiaDAO tipoCortesiaDAO; + + public List obtenerTodos() { + return tipoCortesiaDAO.obtenerTodos(); + } + + public TipoCortesia obtenerID(Integer id) { + return tipoCortesiaDAO.obtenerID(id); + } + + @Transactional + public TipoCortesia suscribir(TipoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDAO.suscribir(entidad); + } + + @Transactional + public TipoCortesia actualizacion(TipoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCortesiaDAO.actualizacion(entidad); + } + + public List buscar(String descTipo) { + return tipoCortesiaDAO.buscar(descTipo); + } + + public List obtenerGrupoCortesia(int i) { + return tipoCortesiaDAO.obtenerGrupoCortesia(i); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java new file mode 100644 index 000000000..0cc3136a1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoDocAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; +import com.rjconsultores.ventaboletos.service.TipoDocAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoDocAutobusService") +public class TipoDocAutobusServiceImpl implements TipoDocAutobusService { + + @Autowired + private TipoDocAutobusDAO tipoDocAutobusDAO; + + @Override + public List obtenerTodos() { + return tipoDocAutobusDAO.obtenerTodos(); + } + + @Override + public TipoDocAutobus obtenerID(Integer id) { + return tipoDocAutobusDAO.obtenerID(id); + } + + @Transactional + public TipoDocAutobus suscribir(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDocAutobusDAO.suscribir(entidad); + } + + @Transactional + public TipoDocAutobus actualizacion(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDocAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoDocAutobusDAO.actualizacion(entidad); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoDomicilioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoDomicilioServiceImpl.java new file mode 100644 index 000000000..3df08d768 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoDomicilioServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoDomicilioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import com.rjconsultores.ventaboletos.service.TipoDomicilioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoDomicilioService") +public class TipoDomicilioServiceImpl implements TipoDomicilioService { + + @Autowired + private TipoDomicilioDAO tipoDomicilioDAO; + + public List obtenerTodos() { + return tipoDomicilioDAO.obtenerTodos(); + } + + public TipoDomicilio obtenerID(Integer id) { + return tipoDomicilioDAO.obtenerID(id); + } + + @Transactional + public TipoDomicilio suscribir(TipoDomicilio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDomicilioDAO.suscribir(entidad); + } + + @Transactional + public TipoDomicilio actualizacion(TipoDomicilio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDomicilioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoDomicilio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoDomicilioDAO.actualizacion(entidad); + } + + public List buscar(String desctipo, String cvetipodomicilio) { + return tipoDomicilioDAO.buscar(desctipo, cvetipodomicilio); + } + + public List buscarClave(String cvetipodomicilio) { + return tipoDomicilioDAO.buscarClave(cvetipodomicilio); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEmpleadoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEmpleadoServiceImpl.java new file mode 100644 index 000000000..91433f7a0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEmpleadoServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.TipoEmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; +import com.rjconsultores.ventaboletos.service.TipoEmpleadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoEmpleadoService") +public class TipoEmpleadoServiceImpl implements TipoEmpleadoService { + + @Autowired + private TipoEmpleadoDAO tipoEmpleadoDAO; + + @Override + public List obtenerTodos() { + return tipoEmpleadoDAO.obtenerTodos(); + } + + @Override + public TipoEmpleado obtenerID(Integer id) { + return tipoEmpleadoDAO.obtenerID(id); + } + + @Override + public TipoEmpleado suscribir(TipoEmpleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEmpleadoDAO.suscribir(entidad); + } + + @Override + public TipoEmpleado actualizacion(TipoEmpleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEmpleadoDAO.actualizacion(entidad); + } + + @Override + public void borrar(TipoEmpleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoEmpleadoDAO.actualizacion(entidad); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraEmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraEmpresaServiceImpl.java new file mode 100644 index 000000000..2325d60aa --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraEmpresaServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoEventoExtraEmpresaService") +public class TipoEventoExtraEmpresaServiceImpl implements TipoEventoExtraEmpresaService { + @Autowired + private TipoEventoExtraEmpresaDAO tipoEventoExtraEmpresaDAO; + + @Override + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra) { + return tipoEventoExtraEmpresaDAO.buscarPorTipoEventoExtra(tipoeventoextra); + } + + @Transactional + public TipoEventoExtraEmpresa suscribir(TipoEventoExtraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEventoExtraEmpresaDAO.suscribir(entidad); + } + + @Override + public List obtenerTodos() { + return tipoEventoExtraEmpresaDAO.obtenerTodos(); + } + + @Override + public TipoEventoExtraEmpresa obtenerID(Integer id) { + return tipoEventoExtraEmpresaDAO.obtenerID(id); + } + + @Transactional + public TipoEventoExtraEmpresa actualizacion(TipoEventoExtraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEventoExtraEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoEventoExtraEmpresa entidad) { + tipoEventoExtraEmpresaDAO.borrar(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java new file mode 100644 index 000000000..48000e0ab --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java @@ -0,0 +1,99 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; +import com.rjconsultores.ventaboletos.service.EventoExtraService; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("tipoEventoExtraService") +public class TipoEventoExtraServiceImpl implements TipoEventoExtraService { + + @Autowired + private TipoEventoExtraDAO tipoEventoExtraDAO; + @Autowired + private EventoExtraService eventoExtraService; + + public List obtenerTodos() { + return tipoEventoExtraDAO.obtenerTodos(); + } + + public TipoEventoExtra obtenerID(Integer id) { + return tipoEventoExtraDAO.obtenerID(id); + } + + @Transactional + public TipoEventoExtra suscribir(TipoEventoExtra entidad) throws ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (ApplicationProperties.getInstance().integracionTotvs()) { + validaCampos(entidad); + } + + return tipoEventoExtraDAO.suscribir(entidad); + } + + @Transactional + public TipoEventoExtra actualizacion(TipoEventoExtra entidad) throws ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (ApplicationProperties.getInstance().integracionTotvs()) { + validaCampos(entidad); + } + + return tipoEventoExtraDAO.actualizacion(entidad); + } + + @Transactional(rollbackFor = BusinessException.class) + public void borrar(TipoEventoExtra entidad) throws BusinessException { + + if (!eventoExtraService.obtenerPorTipo(entidad).isEmpty()) { + throw new BusinessException("editarTipoEventoExtraController.MSG.evento"); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoEventoExtraDAO.actualizacion(entidad); + } + + @Override + public List buscar(String descingreso) { + return tipoEventoExtraDAO.buscar(descingreso); + } + + private void validaCampos(TipoEventoExtra entidad) throws ValidacionCampoException { + + if (entidad.getNatureza() == null) { + throw new ValidacionCampoException("editarTipoEventoExtraController.MSG.natureza"); + } + + // o campo contacontabil não é obrigatório +// if (entidad.getContaContabil() == null) { +// throw new ValidacionCampoException("editarTipoEventoExtraController.MSG.contaContabil"); +// } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoIdentificacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoIdentificacionServiceImpl.java new file mode 100644 index 000000000..bee4e57c4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoIdentificacionServiceImpl.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.TipoIdentificacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; +import com.rjconsultores.ventaboletos.service.TipoIdentificacionService; + +@Service("tipoIdentificacionService") +public class TipoIdentificacionServiceImpl implements TipoIdentificacionService { + + @Autowired + private TipoIdentificacionDAO tipoIdentificacionDAO; + + @Override + public List obtenerTodos() { + return tipoIdentificacionDAO.obtenerTodos(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoMovimientoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoMovimientoServiceImpl.java new file mode 100644 index 000000000..8cae6820d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoMovimientoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoMovimientoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import com.rjconsultores.ventaboletos.service.TipoMovimientoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoMovimientoService") +public class TipoMovimientoServiceImpl implements TipoMovimientoService { + + @Autowired + private TipoMovimientoDAO tipoMovimientoDAO; + + public List obtenerTodos() { + return tipoMovimientoDAO.obtenerTodos(); + } + + public TipoMovimiento obtenerID(Integer id) { + return tipoMovimientoDAO.obtenerID(id); + } + + @Transactional + public TipoMovimiento suscribir(TipoMovimiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoMovimientoDAO.suscribir(entidad); + } + + @Transactional + public TipoMovimiento actualizacion(TipoMovimiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoMovimientoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoMovimiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoMovimientoDAO.actualizacion(entidad); + } + + public List buscar(String descmovimiento) { + return tipoMovimientoDAO.buscar(descmovimiento); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java new file mode 100644 index 000000000..4ce1ccad7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import com.rjconsultores.ventaboletos.service.TipoOcupacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoOcupacionService") +public class TipoOcupacionServiceImpl implements TipoOcupacionService { + + @Autowired + private TipoOcupacionDAO tipoOcupacionDAO; + + public List obtenerTodos() { + return tipoOcupacionDAO.obtenerTodos(); + } + + public TipoOcupacion obtenerID(Integer id) { + return tipoOcupacionDAO.obtenerID(id); + } + + @Transactional + public TipoOcupacion suscribir(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoOcupacionDAO.suscribir(entidad); + } + + @Transactional + public TipoOcupacion actualizacion(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoOcupacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoOcupacionDAO.actualizacion(entidad); + } + + public List buscar(String desctipo, String cvetipoocupacion) { + return tipoOcupacionDAO.buscar(desctipo, cvetipoocupacion); + } + + public List buscarClave(String cvetipoocupacion) { + return tipoOcupacionDAO.buscarClave(cvetipoocupacion); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoParadaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoParadaServiceImpl.java new file mode 100644 index 000000000..713696520 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoParadaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParadaDAO; +import com.rjconsultores.ventaboletos.dao.TipoParadaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.service.TipoParadaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoParadaService") +public class TipoParadaServiceImpl implements TipoParadaService { + + @Autowired + private TipoParadaDAO tipoParadaDAO; + @Autowired + private ParadaDAO paradaDAO; + + public List obtenerTodos() { + return tipoParadaDAO.obtenerTodos(); + } + + public TipoParada obtenerID(Integer id) { + return tipoParadaDAO.obtenerID(id); + } + + @Transactional + public TipoParada suscribir(TipoParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoParadaDAO.suscribir(entidad); + } + + @Transactional + public TipoParada actualizacion(TipoParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoParadaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoParada entidad) throws RegistroConDependenciaException{ + if (paradaDAO.count(entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoParadaDAO.actualizacion(entidad); + } + + public List buscar(String desctipo) { + return tipoParadaDAO.buscar(desctipo); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoPuntoVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoPuntoVentaServiceImpl.java new file mode 100644 index 000000000..624ea1098 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoPuntoVentaServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoPuntoVentaService") +public class TipoPuntoVentaServiceImpl implements TipoPuntoVentaService { + + @Autowired + private TipoPuntoVentaDAO tipoPuntoVentaDAO; + + public List obtenerTodos() { + return tipoPuntoVentaDAO.obtenerTodos(); + } + + public TipoPuntoVenta obtenerID(Short id) { + return tipoPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public TipoPuntoVenta suscribir(TipoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public TipoPuntoVenta actualizacion(TipoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoPuntoVentaDAO.actualizacion(entidad); + } + + public List buscar(String desctipo) { + return tipoPuntoVentaDAO.buscar(desctipo); + } + + @Override + public List obtenerTodosExceto(Short... id) { + return tipoPuntoVentaDAO.obtenerTodosExceto(id); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoServicioServiceImpl.java new file mode 100644 index 000000000..445efeb88 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoServicioServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import com.rjconsultores.ventaboletos.service.TipoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("tipoServicioService") +public class TipoServicioServiceImpl implements TipoServicioService { + + @Autowired + private TipoServicioDAO tipoServicioDAO; + + public List obtenerTodos() { + return tipoServicioDAO.obtenerTodos(); + } + + public TipoServicio obtenerID(Integer id) { + return tipoServicioDAO.obtenerID(id); + } + + @Transactional + public TipoServicio suscribir(TipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoServicioDAO.suscribir(entidad); + } + + @Transactional + public TipoServicio actualizacion(TipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoServicioDAO.actualizacion(entidad); + } + + public List buscar(String descservicio) { + return tipoServicioDAO.buscar(descservicio); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoTarifaPacoteServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoTarifaPacoteServiceImpl.java new file mode 100644 index 000000000..d98797aec --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoTarifaPacoteServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoTarifaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; +import com.rjconsultores.ventaboletos.service.TipoTarifaPacoteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoTarifaPacoteService") +public class TipoTarifaPacoteServiceImpl implements TipoTarifaPacoteService { + + @Autowired + private TipoTarifaPacoteDAO tipoTarifaPacoteDAO; + + @Override + public List obtenerTodos() { + return tipoTarifaPacoteDAO.obtenerTodos(); + } + + @Override + public TipoTarifaPacote obtenerID(Integer id) { + return tipoTarifaPacoteDAO.obtenerID(id); + } + + @Transactional + @Override + public TipoTarifaPacote suscribir(TipoTarifaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoTarifaPacoteDAO.suscribir(entidad); + } + + @Transactional + @Override + public TipoTarifaPacote actualizacion(TipoTarifaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoTarifaPacoteDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(TipoTarifaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoTarifaPacoteDAO.actualizacion(entidad); + } + + @Override + public List buscaTipoTarifaPacote(Pacote pacote) { + return tipoTarifaPacoteDAO.buscaTipoTarifaPacote(pacote); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoVentaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoVentaServiceImpl.java new file mode 100644 index 000000000..b4a81f639 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TipoVentaServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import com.rjconsultores.ventaboletos.service.TipoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("tipoVentaService") +public class TipoVentaServiceImpl implements TipoVentaService { + + @Autowired + private TipoVentaDAO tipoVentaDAO; + + public List obtenerTodos() { + return tipoVentaDAO.obtenerTodos(); + } + + public TipoVenta obtenerID(Integer id) { + return tipoVentaDAO.obtenerID(id); + } + + @Transactional + public TipoVenta suscribir(TipoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoVentaDAO.suscribir(entidad); + } + + @Transactional + public TipoVenta actualizacion(TipoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoVentaDAO.actualizacion(entidad); + } + + public List buscar(String desctipoventa) { + return tipoVentaDAO.buscar(desctipoventa); + } + + public TipoVenta obtenerID(Short tipoventaId) { + return tipoVentaDAO.obtenerID(tipoventaId); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoKmServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoKmServicioServiceImpl.java new file mode 100644 index 000000000..20fd1c281 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoKmServicioServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TramoKmServicioDAO; +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import com.rjconsultores.ventaboletos.service.TramoKmServicioService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("tramoKmServicioService") +public class TramoKmServicioServiceImpl implements TramoKmServicioService { + + @Autowired + private TramoKmServicioDAO tramoKmServicioDAO; + @Autowired + private TramoService tramoService; + + public List obtenerTodos() { + return tramoKmServicioDAO.obtenerTodos(); + } + + public TramoKmServicio obtenerID(Integer id) { + return tramoKmServicioDAO.obtenerID(id); + } + + @Transactional + public TramoKmServicio suscribir(TramoKmServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoKmServicioDAO.suscribir(entidad); + } + + @Transactional + public TramoKmServicio actualizacion(TramoKmServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoKmServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TramoKmServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoKmServicioDAO.actualizacion(entidad); + } + + public List buscar(TramoKmServicio tramoKmServicio) { + return tramoKmServicioDAO.buscar(tramoKmServicio); + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java new file mode 100644 index 000000000..9864839f3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java @@ -0,0 +1,451 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.service.RutaEmpresaService; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TramoRutaService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.service.TramoServicioService; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.RutaTramoVO; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoCoeficienteVO; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoVO; + +@Service("tramoRutaService") +public class TramoRutaServiceImpl implements TramoRutaService { + + private static Logger log = Logger.getLogger(TramoRutaServiceImpl.class); + @Autowired + private RutaService rutaService; + @Autowired + private RutaCombinacionService rutaCombinacionService; + @Autowired + private RutaSecuenciaService rutaSecuenciaService; + @Autowired + private RutaEmpresaService rutaEmpresaService; + @Autowired + private TramoService tramoService; + @Autowired + private TramoServicioService tramoServicioService; + @Autowired + private RutaDAO rutaDAO; + @Autowired + private OrgaoTramoDAO orgaoTramoDAO; + @Autowired + private TramoServicioDAO tramoServicioDAO; + @Autowired + private TramoDAO tramoDAO; + + /** + * Hace la validación de los datos del rutaTramoVO + * + * @param rutaTramoVO + * @throws BusinessException + */ + private void validarGenerarTramosRutas(RutaTramoVO rutaTramoVO) throws BusinessException { + if (rutaTramoVO.getLsSecuenciaRutaTramoVO().isEmpty()) { + throw new BusinessException("tramoRutaServiceImpl.msg.secuenciaObligatorio"); + } + if ((rutaTramoVO.getPrefixo() == null) || (rutaTramoVO.getPrefixo().isEmpty())) { + throw new BusinessException("tramoRutaServiceImpl.msg.prefixoObligatorio"); + } + if (rutaTramoVO.getLsEmpresa().isEmpty()) { + throw new BusinessException("tramoRutaServiceImpl.msg.empresaObligatoria"); + } + + if (rutaTramoVO.getLsCombinacionRutaTramoVO().isEmpty()) { + throw new BusinessException("tramoRutaServiceImpl.msg.combinacionObligatorio"); + } + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + if (s.getTramoId() != null) { + continue; + } + if ((s.getOrigen() == null) || (s.getDestino() == null) || (s.getVia() == null) + || (s.getKmReal() == null) || (s.getSecuencia() == null) || (s.getTiempoRecorrido() == null) + || (!rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId().equals(21) && ((s.getCoeficienteTarifa1() == null) || (s.getKmCoeficiente1() == null) || (s.getKmCoeficiente1() == BigDecimal.ZERO)))) { + + throw new BusinessException("tramoRutaServiceImpl.msg.cambosObligatoriosCombinacion", new Object[] { s.getOrigen(), s.getDestino() }); + } + } + for (SecuenciaRutaTramoVO s : rutaTramoVO.getLsSecuenciaRutaTramoVO()) { + if (s.getTramoId() != null) { + continue; + } + if ((s.getOrigen() == null) || (s.getDestino() == null) || (s.getVia() == null) + || (s.getKmReal() == null) || (s.getSecuencia() == null) || (s.getTiempoRecorrido() == null)) { + throw new BusinessException("tramoRutaServiceImpl.msg.cambosObligatoriosSecuencia", new Object[] { s.getOrigen(), + s.getDestino() }); + } + } + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public Ruta generarTramosRutas(RutaTramoVO rutaTramoVO) throws BusinessException { + + this.validarGenerarTramosRutas(rutaTramoVO); + + // Genero los tramos y tramos servicios de la combinacion que no existen + // Aqui si genera tambien los tramos de la secuencia + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + log.debug("Origen:" + s.getOrigen() + ";Destino:" + s.getDestino() + ";Via:" + s.getVia()); + boolean fueGenerado = generarDatos(s, rutaTramoVO.getClaseServicio(), rutaTramoVO.getOrgaoConcedente()); + log.debug("Fue Generado:" + fueGenerado); + } + + // Genero la ruta + Ruta ruta = new Ruta(); + ruta.setDescruta(rutaTramoVO.getDescRuta()); + ruta.setClaseServicio(rutaTramoVO.getClaseServicio()); + ruta.setOrgaoConcedente(rutaTramoVO.getOrgaoConcedente()); + ruta.setIndNombreObligatorio(rutaTramoVO.getSolicitaNombrePasajero()); + ruta.setIndSentidoIda(rutaTramoVO.getIndSentidoIda()); + if (rutaTramoVO.getVentaHandHeld() == null) { + ruta.setVentaOffLine(false); + } else { + ruta.setVentaOffLine(rutaTramoVO.getVentaHandHeld()); + } + + ruta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ruta.setActivo(Boolean.TRUE); + ruta.setFecmodif(new java.util.Date()); + ruta.setPrefixo(rutaTramoVO.getPrefixo()); + ruta.setNumRuta(rutaTramoVO.getNumRuta()); + //valores de tributação para ecf + ruta.setIndTribPedagio(Boolean.FALSE); + ruta.setIndTribTarifa(Boolean.TRUE); + ruta.setIndTribTaxaEmbarque(Boolean.FALSE); + + ruta = rutaDAO.suscribir(ruta); + + // Genero la secuencia de la ruta + for (SecuenciaRutaTramoVO s : rutaTramoVO.getLsSecuenciaRutaTramoVO()) { + RutaSecuencia rutaSecuencia = new RutaSecuencia(); + rutaSecuencia.setNumsecuencia(s.getSecuencia().shortValue()); + rutaSecuencia.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); + rutaSecuencia.setRuta(ruta); + rutaSecuencia = rutaSecuenciaService.suscribir(rutaSecuencia); + } + + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + RutaCombinacion rutaCombinacion = new RutaCombinacion(); + rutaCombinacion.setIndventa(s.getPermiteVenda() == null ? true : s.getPermiteVenda()); + rutaCombinacion.setRuta(ruta); + rutaCombinacion.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); + + rutaCombinacion = rutaCombinacionService.suscribir(rutaCombinacion); + } + + for (Empresa e : rutaTramoVO.getLsEmpresa()) { + RutaEmpresa rutaEmpresa = new RutaEmpresa(); + rutaEmpresa.setEmpresa(e); + rutaEmpresa.setActivo(Boolean.TRUE); + rutaEmpresa.setFecmodif(Calendar.getInstance().getTime()); + rutaEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaEmpresa.setRuta(ruta); + + rutaEmpresa = rutaEmpresaService.suscribir(rutaEmpresa); + } + + return ruta; + } + + @Override + public RutaTramoVO generarRutaRegreso(RutaTramoVO rutaTramoVO) { + RutaTramoVO rutaTramoRegresoVO = new RutaTramoVO(); + rutaTramoRegresoVO.setClaseServicio(rutaTramoVO.getClaseServicio()); + rutaTramoRegresoVO.setOrgaoConcedente(rutaTramoVO.getOrgaoConcedente()); + rutaTramoRegresoVO.setSolicitaNombrePasajero(rutaTramoVO.getSolicitaNombrePasajero()); + rutaTramoRegresoVO.setVentaHandHeld(rutaTramoVO.getVentaHandHeld() == null ? true : rutaTramoVO.getVentaHandHeld()); + rutaTramoRegresoVO.setLsEmpresa(rutaTramoVO.getLsEmpresa()); + + if (rutaTramoVO.getIndSentidoIda()) { + rutaTramoRegresoVO.setIndSentidoIda(Boolean.FALSE); + } else { + rutaTramoRegresoVO.setIndSentidoIda(Boolean.TRUE); + } + rutaTramoRegresoVO.setNumRuta(rutaTramoVO.getNumRuta()); + rutaTramoRegresoVO.setPrefixo(rutaTramoVO.getPrefixo()); + if (rutaTramoVO.getDescRuta() != null) { + rutaTramoRegresoVO.setDescRuta(rutaTramoVO.getDescRuta()); + } else { + rutaTramoRegresoVO.setDescRuta("-"); + } + + List lsSecuenciaRutaTramoRegresoVO = new ArrayList(); + List lsSecuenciaRutaTramoIdaVO = new ArrayList(rutaTramoVO.getLsSecuenciaRutaTramoVO()); + // Reordena a lista + Collections.sort(lsSecuenciaRutaTramoIdaVO, new Comparator() { + + @Override + public int compare(SecuenciaRutaTramoVO o1, SecuenciaRutaTramoVO o2) { + return o2.getSecuencia().compareTo(o1.getSecuencia()); + } + }); + + int secuencia = 0; + + for (SecuenciaRutaTramoVO s : lsSecuenciaRutaTramoIdaVO) { + TramoServicio tramoServicio = tramoServicioService.buscar(s.getDestino(), s.getOrigen(), s.getVia(), rutaTramoVO.getClaseServicio()); + if (tramoServicio != null) { + s.setTramoId(tramoServicio.getTramo().getTramoId()); + s.setTramoServicioId(tramoServicio.getTramoservicioId()); + + lsSecuenciaRutaTramoRegresoVO.add(new SecuenciaRutaTramoVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), + s.getTramoId(), s.getTramoServicioId(), rutaTramoRegresoVO.getNumRuta(), rutaTramoRegresoVO.getIndSentidoIda())); + } else { + lsSecuenciaRutaTramoRegresoVO.add(new SecuenciaRutaTramoVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), rutaTramoRegresoVO.getNumRuta(), rutaTramoRegresoVO.getIndSentidoIda())); + } + } + rutaTramoRegresoVO.setLsSecuenciaRutaTramoVO(lsSecuenciaRutaTramoRegresoVO); + + List lsCombinacionRutaTramoRegresoVO = new ArrayList(); + List lsCombinacionTramoIdaVO = new ArrayList(rutaTramoVO.getLsCombinacionRutaTramoVO()); + Collections.sort(lsCombinacionTramoIdaVO, new Comparator() { + + @Override + public int compare(SecuenciaRutaTramoCoeficienteVO o1, SecuenciaRutaTramoCoeficienteVO o2) { + return o2.getSecuencia().compareTo(o1.getSecuencia()); + } + }); + + secuencia = 0; + for (SecuenciaRutaTramoCoeficienteVO s : lsCombinacionTramoIdaVO) { + TramoServicio tramoServicio = tramoServicioService.buscar(s.getDestino(), s.getOrigen(), s.getVia(), rutaTramoVO.getClaseServicio()); + if (tramoServicio != null) { + s.setTramoId(tramoServicio.getTramo().getTramoId()); + s.setTramoServicioId(tramoServicio.getTramoservicioId()); + + SecuenciaRutaTramoCoeficienteVO secuenciaRutaTramoCoeficienteVO = new SecuenciaRutaTramoCoeficienteVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), + s.getTramoId(), s.getTramoServicioId(), rutaTramoRegresoVO.getNumRuta()); + + OrgaoTramo orgaoTramo = orgaoTramoDAO.buscar(s.getDestino().getParadaId(), s.getOrigen().getParadaId(), s.getVia().getViaId(), rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId(), rutaTramoVO.getClaseServicio().getClaseservicioId()); + + if (orgaoTramo != null) { + secuenciaRutaTramoCoeficienteVO.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1(orgaoTramo.getCoeficienteTarifa1()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente1(orgaoTramo.getKmCoeficiente1()); + + if (orgaoTramo.getCoeficienteTarifa2() != null) { + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2(orgaoTramo.getCoeficienteTarifa2()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente2(orgaoTramo.getKmCoeficiente2()); + } + } + + secuenciaRutaTramoCoeficienteVO.setPermiteVenda(s.getPermiteVenda()); + lsCombinacionRutaTramoRegresoVO.add(secuenciaRutaTramoCoeficienteVO); + } else { + SecuenciaRutaTramoCoeficienteVO secuenciaRutaTramoCoeficienteVO = new SecuenciaRutaTramoCoeficienteVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), rutaTramoRegresoVO.getNumRuta()); + + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1(s.getCoeficienteTarifa1()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente1(s.getKmCoeficiente1()); + + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2(s.getCoeficienteTarifa2()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente2(s.getKmCoeficiente2()); + secuenciaRutaTramoCoeficienteVO.setPermiteVenda(s.getPermiteVenda()); + + lsCombinacionRutaTramoRegresoVO.add(secuenciaRutaTramoCoeficienteVO); + } + + } + rutaTramoRegresoVO.setLsCombinacionRutaTramoVO(lsCombinacionRutaTramoRegresoVO); + + return rutaTramoRegresoVO; + } + + @Override + public List generarCombinacion(RutaTramoVO rutaTramoVO) { + // una nueva lista que va a ser ordenada. Con eso, no afecta la lista original + List lsSecuenciaRutaTramoVO = new ArrayList(rutaTramoVO.getLsSecuenciaRutaTramoVO()); + List lsSecuenciaCombinacionRutaTramoVO = new ArrayList(); + + Collections.sort(lsSecuenciaRutaTramoVO, new Comparator() { + + @Override + public int compare(SecuenciaRutaTramoVO o1, SecuenciaRutaTramoVO o2) { + return o1.getSecuencia().compareTo(o2.getSecuencia()); + } + }); + + int qtdTramos = lsSecuenciaRutaTramoVO.size(); + int secuencia = 0; + for (int i = 0; i < qtdTramos; i++) { + SecuenciaRutaTramoVO secuenciaInicial = lsSecuenciaRutaTramoVO.get(i); + Parada origen = secuenciaInicial.getOrigen(); + BigDecimal totalKmsReal = secuenciaInicial.getKmReal(); + HoraSistema totalTiempoRecorrido = secuenciaInicial.getTiempoRecorrido(); + + int j = i + 1; + for (; j < (qtdTramos); j++) { + Parada destino = lsSecuenciaRutaTramoVO.get(j).getOrigen(); + + Via via = secuenciaInicial.getVia(); + + SecuenciaRutaTramoCoeficienteVO nuevaSecuencia = new SecuenciaRutaTramoCoeficienteVO(origen, destino, via, ++secuencia, + totalKmsReal, totalTiempoRecorrido, rutaTramoVO.getNumRuta()); + + if (via != null) { + TramoServicio tramoServicio = tramoServicioService.buscar(origen, destino, via, rutaTramoVO.getClaseServicio()); + if (tramoServicio != null) { + log.debug("TRAMO EXISTE"); + + nuevaSecuencia.setKmReal(tramoServicio.getTramo().getKmReal()); + nuevaSecuencia.setTiempoRecorrido(new HoraSistema(tramoServicio.getTiemporecorrido())); + nuevaSecuencia.setTramoId(tramoServicio.getTramo().getTramoId()); + nuevaSecuencia.setTramoServicioId(tramoServicio.getTramoservicioId()); + + } + OrgaoTramo orgaoTramo = orgaoTramoDAO.buscar(origen.getParadaId(), destino.getParadaId(), via.getViaId(), rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId(), rutaTramoVO.getClaseServicio().getClaseservicioId()); + if (orgaoTramo != null) { + nuevaSecuencia.setCoeficienteTarifa1(orgaoTramo.getCoeficienteTarifa1()); + nuevaSecuencia.setKmCoeficiente1(orgaoTramo.getKmCoeficiente1()); + nuevaSecuencia.setCoeficienteTarifa2(orgaoTramo.getCoeficienteTarifa2()); + nuevaSecuencia.setKmCoeficiente2(orgaoTramo.getKmCoeficiente2()); + nuevaSecuencia.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + } + } + + if (nuevaSecuencia.getKmCoeficiente1() == null) { + nuevaSecuencia.setKmCoeficiente1(nuevaSecuencia.getKmReal()); + } + + lsSecuenciaCombinacionRutaTramoVO.add(nuevaSecuencia); + + totalKmsReal = totalKmsReal.add(lsSecuenciaRutaTramoVO.get(j).getKmReal()); + totalTiempoRecorrido = totalTiempoRecorrido.sumar(lsSecuenciaRutaTramoVO.get(j).getTiempoRecorrido()); + + log.debug("Origen:" + nuevaSecuencia.getOrigen() + ";Destino:" + nuevaSecuencia.getDestino() + ";Via:" + + nuevaSecuencia.getVia() + ";KmsReal:" + nuevaSecuencia.getKmReal() + ";hora:" + nuevaSecuencia.getTiempoRecorrido()); + + } + + Parada destino = lsSecuenciaRutaTramoVO.get(qtdTramos - 1).getDestino(); + + Via via = secuenciaInicial.getVia(); + + SecuenciaRutaTramoCoeficienteVO nuevaSecuencia = new SecuenciaRutaTramoCoeficienteVO(origen, destino, via, ++secuencia, + totalKmsReal, totalTiempoRecorrido, rutaTramoVO.getNumRuta()); + if (via != null) { + TramoServicio tramoServicio = tramoServicioService.buscar(origen, destino, via, rutaTramoVO.getClaseServicio()); + if (tramoServicio != null) { + log.debug("TRAMO EXISTE"); + + nuevaSecuencia.setKmReal(tramoServicio.getTramo().getKmReal()); + nuevaSecuencia.setTiempoRecorrido(new HoraSistema(tramoServicio.getTiemporecorrido())); + nuevaSecuencia.setTramoId(tramoServicio.getTramo().getTramoId()); + nuevaSecuencia.setTramoServicioId(tramoServicio.getTramoservicioId()); + } + OrgaoTramo orgaoTramo = orgaoTramoDAO.buscar(origen.getParadaId(), destino.getParadaId(), via.getViaId(), rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId(), rutaTramoVO.getClaseServicio().getClaseservicioId()); + if (orgaoTramo != null) { + nuevaSecuencia.setCoeficienteTarifa1(orgaoTramo.getCoeficienteTarifa1()); + nuevaSecuencia.setKmCoeficiente1(orgaoTramo.getKmCoeficiente1()); + nuevaSecuencia.setCoeficienteTarifa2(orgaoTramo.getCoeficienteTarifa2()); + nuevaSecuencia.setKmCoeficiente2(orgaoTramo.getKmCoeficiente2()); + nuevaSecuencia.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + } + } + if (nuevaSecuencia.getKmCoeficiente1() == null) { + nuevaSecuencia.setKmCoeficiente1(nuevaSecuencia.getKmReal()); + } + nuevaSecuencia.setNumRuta(rutaTramoVO.getNumRuta()); + lsSecuenciaCombinacionRutaTramoVO.add(nuevaSecuencia); + log.debug("Origen:" + nuevaSecuencia.getOrigen() + ";Destino:" + nuevaSecuencia.getDestino() + ";Via:" + + nuevaSecuencia.getVia() + ";KmsReal:" + nuevaSecuencia.getKmReal() + ";hora:" + nuevaSecuencia.getTiempoRecorrido()); + + } + + return lsSecuenciaCombinacionRutaTramoVO; + } + + /** + * Genera los datos de tramo, tramo tiempo e coeficiente tarifa sino existen los datos + * + * @param secuencia + * @param claseServicio + * @param orgaoConcedente + * @return + */ + private boolean generarDatos(SecuenciaRutaTramoCoeficienteVO secuencia, ClaseServicio claseServicio, OrgaoConcedente orgaoConcedente) { + TramoServicio tramoServicio = tramoServicioDAO.buscar(secuencia.getOrigen(), secuencia.getDestino(), secuencia.getVia(), claseServicio); + + Tramo tramo = null; + if (tramoServicio == null) { + tramo = tramoService.buscar(secuencia.getOrigen(), secuencia.getDestino(), secuencia.getVia()); + if (tramo == null) { + tramo = new Tramo(); + tramo.setDesctramo(tramoService.gerarDescripcionTramo(secuencia.getOrigen(), secuencia.getDestino(), secuencia.getVia())); + tramo.setOrigem(secuencia.getOrigen()); + tramo.setDestino(secuencia.getDestino()); + tramo.setKmReal(secuencia.getKmReal()); + tramo.setVia(secuencia.getVia()); + tramo.setActivo(Boolean.TRUE); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(new java.util.Date()); + + tramo = tramoDAO.suscribir(tramo); + } + tramoServicio = new TramoServicio(); + tramoServicio.setClaseServicio(claseServicio); + tramoServicio.setTramo(tramo); + tramoServicio.setTiemporecorrido(secuencia.getTiempoRecorrido().getFecha()); + + tramoServicio = tramoServicioService.suscribir(tramoServicio); + + if (secuencia.getOrgaoTramoId() == null) { + OrgaoTramo orgaoTramo = new OrgaoTramo(); + orgaoTramo.setClaseServicio(claseServicio); + orgaoTramo.setOrgaoConcedente(orgaoConcedente); + orgaoTramo.setTramo(tramo); + + orgaoTramo.setActivo(Boolean.TRUE); + orgaoTramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + orgaoTramo.setFecmodif(new java.util.Date()); + orgaoTramo.setCoeficienteTarifa1(secuencia.getCoeficienteTarifa1()); + orgaoTramo.setKmCoeficiente1(secuencia.getKmCoeficiente1()); + + if (secuencia.getCoeficienteTarifa2() != null) { + orgaoTramo.setCoeficienteTarifa2(secuencia.getCoeficienteTarifa2()); + orgaoTramo.setKmCoeficiente2(secuencia.getKmCoeficiente2()); + } + + orgaoTramo = orgaoTramoDAO.suscribir(orgaoTramo); + } + + return true; + } + + return false; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoServiceImpl.java new file mode 100644 index 000000000..d2ddd3cf0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoServiceImpl.java @@ -0,0 +1,274 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; +import com.rjconsultores.ventaboletos.service.TarifaService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("tramoService") +public class TramoServiceImpl implements TramoService { + + @Autowired + private TramoDAO tramoDAO; + @Autowired + private RutaCombinacionDAO rutaCombinacionDAO; + @Autowired + private EsquemaCorridaService esquemaCorridaService; + @Autowired + private TarifaService tarifaService; + + public List obtenerTodos() { + return tramoDAO.obtenerTodos(); + } + + public Tramo obtenerID(Integer id) { + return tramoDAO.obtenerID(id); + } + + @Transactional(rollbackFor = BusinessException.class) + public void borrar(Tramo entidad) throws BusinessException { + + + boolean rutaOcupaTramo = rutaCombinacionDAO.existeTramo(entidad); + if (rutaOcupaTramo){ + throw new BusinessException("editarTramosController.MSG.borrarFalse"); + } + + boolean existeEsquemaCorrida = esquemaCorridaService.buscarEsquemaCorridaExisteTramo(entidad); + if (existeEsquemaCorrida){ + throw new BusinessException("editarTramosController.MSG.borrarFalse"); + } + + boolean existeTarifa = tarifaService.buscarTarifaExisteTramo(entidad); + if (existeTarifa){ + throw new BusinessException("editarTramosController.MSG.borrarFalse"); + } + + entidad = tramoDAO.obtenerID(entidad.getTramoId()); + if (entidad.getLsTramoTiempo() != null) { + for (TramoTiempo tramo : entidad.getLsTramoTiempo()) { + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setActivo(Boolean.FALSE); + } + } + + if (entidad.getTramoServicioList() != null) { + for (TramoServicio tramo : entidad.getTramoServicioList()) { + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setActivo(Boolean.FALSE); + } + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoDAO.actualizacion(entidad); + } + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino) { + return tramoDAO.obtenerPorOrigemDestino(origem, destino); + } + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino) { + return tramoDAO.obtenerListPorOrigemDestino(origem, destino); + } + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via via) { + return tramoDAO.obtenerTramotPorOrigemDestinoVia(origem, destino, via); + } + + public Tramo buscar(Parada origem, Parada destino, Via via) { + return tramoDAO.busca(origem, destino, via); + } + + @Override + public String gerarDescripcionTramo(Parada origen,Parada destino,Via via){ + String descTramo = origen.getCveparada() + "-" + destino.getCveparada() + "(" + via.getNombvia() + ")"; + if (descTramo.length() > 20) { + descTramo = descTramo.substring(0, 20); + } + return descTramo; + } + + public List buscarCveParada(String origen, String destino, String via) { + return tramoDAO.buscarCveParada(origen, destino, via); + } + + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, ClaseServicio claseServicio) { + return tramoDAO.obtenerTramoUnicoRuta(origem, destino, via, claseServicio); + } + + public List buscar(List lsParadas, Via via) { + List respuesta = new ArrayList(); + + Parada origen = lsParadas.get(0); + Parada destino = null; + + + for (int i = 1; i < lsParadas.size(); i++) { + destino = lsParadas.get(i); + Tramo busca = tramoDAO.busca(origen, destino, via); + + if (busca!= null) { + respuesta.add(busca); + } + } + + return respuesta; + } + + @Transactional + public void guardarTramosKm(List lsTramos, Via via) { + for (Tramo tramo : lsTramos) { + Tramo busca = tramoDAO.busca(tramo.getOrigem(), tramo.getDestino(), via); + if (busca==null) { + tramo.setVia(via); + tramo.setActivo(Boolean.TRUE); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setDesctramo(tramo.getOrigem().getCveparada().trim()+"-"+tramo.getDestino().getCveparada().trim()); + tramoDAO.suscribir(tramo); + + } else { + Tramo tramoExiste = busca; + tramoExiste.setKmPagoConductor(tramo.getKmPagoConductor()); + tramoExiste.setKmReal(tramo.getKmReal()); + tramoExiste.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramoExiste.setFecmodif(Calendar.getInstance().getTime()); + } + } + } + public List obtenerViasOrigemDestino(Parada origem, Parada destino) { + return tramoDAO.obtenerViasOrigemDestino(origem, destino); + } + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) { + return tramoDAO.obtenerPorOrigemDestinoFetchLazy(origem, destino); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public Tramo suscribirActualizar(Tramo tramo) throws BusinessException { + + + Tramo tramoBusqueda = buscar(tramo.getOrigem(), tramo.getDestino(), tramo.getVia()); + + if (tramo.getOrigem().equals(tramo.getDestino())) { + throw new BusinessException("editarTramosController.MSG.OrigemDestinoIguais"); + } + + if ((tramoBusqueda != null) && (tramo.getTramoId() == null)) { + throw new BusinessException("MSG.Registro.Existe.Origem.Destino.Via"); + } + + if ((tramoBusqueda != null) && (!tramo.equals(tramoBusqueda))) { + throw new BusinessException("MSG.Registro.Existe.Origem.Destino.Via"); + } + + + if (tramo.getTramoId() != null) { + boolean rutaOcupaTramo = rutaCombinacionDAO.existeTramo(tramo); + + if (rutaOcupaTramo) { + Tramo tramoOriginal = tramoDAO.obtenerID(tramo.getTramoId()); + + if (!tramo.getVia().equals(tramoOriginal.getVia())) { + throw new BusinessException("TramoServiceImpl.msg.validacionVia"); + } + + if (!tramo.getOrigem().equals(tramoOriginal.getOrigem())) { + throw new BusinessException("TramoServiceImpl.msg.validacionOrigen"); + } + + if (!tramo.getDestino().equals(tramoOriginal.getDestino())) { + throw new BusinessException("TramoServiceImpl.msg.validacionDestino"); + } + + // Validación: No es posible quitar ClaseServicio de un tramo que esta asociado a una ruta e esa ruta tenga la misma clase de servicio + // Esa validación tambien permite que el usuario quite una clase y la agregue de nuevo con otro tiempo de recorrido + List lsTramoServicioOriginal = tramoOriginal.getTramoServicioList(); + for (final TramoServicio ts : lsTramoServicioOriginal) { + boolean existe = CollectionUtils.exists(tramo.getTramoServicioList(), new Predicate() { + + @Override + public boolean evaluate(Object o) { + TramoServicio t = (TramoServicio) o; + if (t.getActivo()) { + return t.getClaseServicio().equals(ts.getClaseServicio()); + } + return false; + } + }); + + if (!existe) { + if (rutaCombinacionDAO.existeTramo(tramo, ts.getClaseServicio())) { + throw new BusinessException("TramoServiceImpl.msg.validacionTramoServicio"); + } + } + } + + List lsTramoTiempoOriginal = tramoOriginal.getLsTramoTiempo(); + for (final TramoTiempo tt : lsTramoTiempoOriginal) { + boolean existe = CollectionUtils.exists(tramo.getLsTramoTiempo(), new Predicate() { + + @Override + public boolean evaluate(Object o) { + TramoTiempo t = (TramoTiempo) o; + if (t.getActivo()) { + return t.getClaseServicio().equals(tt.getClaseServicio()); + } + return false; + } + }); + + if (!existe) { + if (rutaCombinacionDAO.existeTramo(tramo, tt.getClaseServicio())) { + throw new BusinessException("TramoServiceImpl.msg.validacionTramoTiempo"); + } + } + } + + } + } + + tramo.setDesctramo(gerarDescripcionTramo(tramo.getOrigem(), tramo.getDestino(), tramo.getVia())); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setActivo(Boolean.TRUE); + + if (tramo.getTramoId() == null) { + return tramoDAO.suscribir(tramo); + } else { + return tramoDAO.actualizacion(tramo); + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoServicioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoServicioServiceImpl.java new file mode 100644 index 000000000..9c14c22a9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoServicioServiceImpl.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.service.TramoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("tramoServicioService") +public class TramoServicioServiceImpl implements TramoServicioService { + + @Autowired + private TramoServicioDAO tramoServicioDAO; + @Autowired + private TramoService tramoService; + @Autowired + private TramoDAO tramoDAO; + + public List obtenerTodos() { + return tramoServicioDAO.obtenerTodos(); + } + + public TramoServicio obtenerID(Integer id) { + return tramoServicioDAO.obtenerID(id); + } + + @Transactional + public TramoServicio suscribir(TramoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoServicioDAO.suscribir(entidad); + } + + @Transactional + public TramoServicio actualizacion(TramoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TramoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoServicioDAO.actualizacion(entidad); + } + + public List buscarPorTramo(Tramo tramo) { + return tramoServicioDAO.buscarPorTramo(tramo); + } + + public List buscarPorTramoServico(Tramo tramo, ClaseServicio clase) { + return tramoServicioDAO.buscarPorTramo(tramo, clase); + } + + @Override + public TramoServicio buscar(Parada origen, Parada destino, Via via, ClaseServicio clase) { + return tramoServicioDAO.buscar(origen, destino, via, clase); + } + + @Override + @Transactional + public boolean generarTramoTiempo(Parada origen, Parada destino, Via via, BigDecimal kmsReal,Date tiempoRecorrido, ClaseServicio claseServicio) { + + TramoServicio tramoServicio = tramoServicioDAO.buscar(origen, destino, via, claseServicio); + + Tramo tramo = null; + if (tramoServicio == null) { + tramo = tramoService.buscar(origen, destino, via); + if (tramo == null) { + tramo = new Tramo(); + tramo.setDesctramo(tramoService.gerarDescripcionTramo(origen, destino, via)); + tramo.setOrigem(origen); + tramo.setDestino(destino); + tramo.setKmReal(kmsReal); + tramo.setVia(via); + tramo.setActivo(Boolean.TRUE); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(new java.util.Date()); + + tramo = tramoDAO.suscribir(tramo); + } + tramoServicio = new TramoServicio(); + tramoServicio.setClaseServicio(claseServicio); + tramoServicio.setTramo(tramo); + tramoServicio.setTiemporecorrido(tiempoRecorrido); + + tramoServicio = this.suscribir(tramoServicio); + + return true; + } + + return false; + } + + @Override + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId) { + return tramoServicioDAO.existenTiemposTramosEsquema(esquemaCorridaId); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoTiempoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoTiempoServiceImpl.java new file mode 100644 index 000000000..8c528eb3f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TramoTiempoServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TramoTiempoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.service.TramoTiempoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("tramoTiempoService") +public class TramoTiempoServiceImpl implements TramoTiempoService { + + @Autowired + private TramoTiempoDAO tramoTiempoDAO; + @Autowired + private TramoService tramoService; + + + public List obtenerTodos() { + return tramoTiempoDAO.obtenerTodos(); + } + + public TramoTiempo obtenerID(Integer id) { + return tramoTiempoDAO.obtenerID(id); + } + + @Transactional + public TramoTiempo suscribir(TramoTiempo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoTiempoDAO.suscribir(entidad); + } + + @Transactional + public TramoTiempo actualizacion(TramoTiempo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoTiempoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TramoTiempo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoTiempoDAO.actualizacion(entidad); + } + + public List buscarPorTramo(Tramo tramo) { + return tramoTiempoDAO.buscarPorTramo(tramo); + } + + public List buscarPorTramo(Tramo tramo,ClaseServicio clase) { + return tramoTiempoDAO.buscarPorTramo(tramo, clase); + } + + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TurnoServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TurnoServiceImpl.java new file mode 100644 index 000000000..c8509c966 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/TurnoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TurnoDAO; +import com.rjconsultores.ventaboletos.entidad.Turno; +import com.rjconsultores.ventaboletos.service.TurnoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("turnoService") +public class TurnoServiceImpl implements TurnoService { + + @Autowired + private TurnoDAO turnoDAO; + + public List obtenerTodos() { + return turnoDAO.obtenerTodos(); + } + + public Turno obtenerID(Integer id) { + return turnoDAO.obtenerID(id); + } + + @Transactional + public Turno suscribir(Turno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return turnoDAO.suscribir(entidad); + } + + @Transactional + public Turno actualizacion(Turno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return turnoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Turno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + turnoDAO.actualizacion(entidad); + } + + public List buscar(String descturno) { + return turnoDAO.buscar(descturno); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioBancarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioBancarioServiceImpl.java new file mode 100644 index 000000000..436c2c27e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioBancarioServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.UsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; +import com.rjconsultores.ventaboletos.service.UsuarioBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("usuarioBancarioService") +public class UsuarioBancarioServiceImpl implements UsuarioBancarioService { + + @Autowired + private UsuarioBancarioDAO usuarioBancarioDAO; + + public List obtenerTodos() { + return usuarioBancarioDAO.obtenerTodos(); + } + + public UsuarioBancario obtenerID(Integer id) { + return usuarioBancarioDAO.obtenerID(id); + } + + @Transactional + public UsuarioBancario suscribir(UsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioBancarioDAO.suscribir(entidad); + } + + @Transactional + public UsuarioBancario actualizacion(UsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioBancarioDAO.actualizacion(entidad); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java new file mode 100644 index 000000000..fca54cd5c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +import com.rjconsultores.ventaboletos.dao.UsuarioEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; +import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("usuarioEmpresaService") +public class UsuarioEmpresaServiceImpl implements UsuarioEmpresaService { + + @Autowired + private UsuarioEmpresaDAO usuarioEmpresaDAO; + + public List obtenerTodos() { + return usuarioEmpresaDAO.obtenerTodos(); + } + + public UsuarioEmpresa obtenerID(Integer id) { + return usuarioEmpresaDAO.obtenerID(id); + } + + @Transactional + public UsuarioEmpresa suscribir(UsuarioEmpresa entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioEmpresaDAO.suscribir(entidad); + } + + @Transactional + public UsuarioEmpresa actualizacion(UsuarioEmpresa entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioEmpresa entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioEmpresaDAO.actualizacion(entidad); + } + + public List obtenerPorUsuario(Usuario usuario) { + return usuarioEmpresaDAO.obtenerPorUsuario(usuario); + } + + public List obtenerEmpresa(Usuario usuario) { + return usuarioEmpresaDAO.obtenerEmpresa(usuario); + } + + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { + return usuarioEmpresaDAO.obtenerPorEmpresaUsuario( empresa, usuario); + } + +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioPerfilServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioPerfilServiceImpl.java new file mode 100644 index 000000000..9eadb8fa9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioPerfilServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import com.rjconsultores.ventaboletos.service.UsuarioPerfilService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("usuarioPerfilService") +public class UsuarioPerfilServiceImpl implements UsuarioPerfilService { + + @Autowired + private UsuarioPerfilDAO usuarioPerfilDAO; + + public List obtenerTodos() { + return usuarioPerfilDAO.obtenerTodos(); + } + + public UsuarioPerfil obtenerID(Integer id) { + return usuarioPerfilDAO.obtenerID(id); + } + + @Transactional + public UsuarioPerfil suscribir(UsuarioPerfil entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioPerfilDAO.suscribir(entidad); + } + + @Transactional + public UsuarioPerfil actualizacion(UsuarioPerfil entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioPerfilDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioPerfil entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioPerfilDAO.actualizacion(entidad); + } + + public List obtenerPorUsuario(Usuario usuario) { + return usuarioPerfilDAO.obtenerPorUsuario(usuario); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java new file mode 100644 index 000000000..5cd585ce9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java @@ -0,0 +1,219 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.security.authentication.CredentialsExpiredException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.UsuarioDAO; +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.UsuarioService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.seguridad.ContrasenaUtileria; + +/** + * + * @author Administrador + */ +@Service("usuarioService") +public class UsuarioServiceImpl implements UsuarioService, UserDetailsService { + + @Autowired + private UsuarioDAO usuarioDAO; + @Autowired + private UsuarioPerfilDAO usuarioPerfilDAO; + + public List buscarPeloNome(String nome) { + return usuarioDAO.buscarPeloNome(nome); + } + + public List obtenerTodos() { + return usuarioDAO.obtenerTodos(); + } + + public Usuario obtenerID(Integer id) { + return usuarioDAO.obtenerID(id); + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public Usuario suscribirActualizar(Usuario entidad, String senha, Perfil perfil) throws BusinessException { + + // validación duplicado + List lsUsuario = this.buscarPelaCveUsuario(entidad.getClaveUsuario()); + boolean podeSalvar = false; + if (lsUsuario.isEmpty()) { + podeSalvar = true; + } else { + if (entidad.getUsuarioId() != null) { + for (Usuario u : lsUsuario) { + if (u.getUsuarioId().equals(entidad.getUsuarioId())) { + podeSalvar = true; + } + } + } + } + + if (!podeSalvar) { + throw new BusinessException("MSG.Registro.Existe"); + } + if (senha != null) { + // validación complejidad contrasena + if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) { + ContrasenaUtileria.validarContrasenaCompleja(senha); + } + + // encriptación contrasena + entidad.setSenha(ContrasenaUtileria.encriptarContrasena(senha)); + } + + // Perfil + UsuarioPerfil up = new UsuarioPerfil(); + up.setUsuario(entidad); + up.setPerfil(perfil); + up.setActivo(Boolean.TRUE); + up.setFecmodif(Calendar.getInstance().getTime()); + up.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + if (entidad.getUsuarioId() != null) { + List lsUsuarioPerfil = usuarioPerfilDAO.obtenerPorUsuario(entidad); + for (UsuarioPerfil up2 : lsUsuarioPerfil) { + usuarioPerfilDAO.borrar(up2); + } + } + List lsUp = new ArrayList(); + lsUp.add(up); + entidad.setUsuarioPerfilList(lsUp); + + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getUsuarioId() == null) { + return usuarioDAO.suscribir(entidad); + } else { + return usuarioDAO.actualizacion(entidad); + } + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public Usuario cambiarContrasena(Usuario entidad, String senha) throws BusinessException { + + // validación duplicado + List lsUsuario = this.buscarPelaCveUsuario(entidad.getClaveUsuario()); + boolean podeSalvar = false; + if (lsUsuario.isEmpty()) { + podeSalvar = true; + } else { + if (entidad.getUsuarioId() != null) { + for (Usuario u : lsUsuario) { + if (u.getUsuarioId().equals(entidad.getUsuarioId())) { + podeSalvar = true; + } + } + } + } + + if (!podeSalvar) { + throw new BusinessException("MSG.Registro.Existe"); + } + if (senha != null) { + // validación complejidad contrasena + if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) { + ContrasenaUtileria.validarContrasenaCompleja(senha); + } + + // encriptación contrasena + entidad.setSenha(ContrasenaUtileria.encriptarContrasena(senha)); + } + + entidad.setFecContrasena(Calendar.getInstance().getTime()); + entidad.setUsuariomodifId(entidad.getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getUsuarioId() != null) { + return usuarioDAO.actualizacion(entidad); + } else { + throw new BusinessException("MSG.Registro.Existe"); + } + } + + @Transactional + public void borrar(Usuario entidad) { + + entidad = obtenerID(entidad.getUsuarioId()); + + for (UsuarioPerfil up : entidad.getUsuarioPerfilList()) { + up.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + up.setFecmodif(Calendar.getInstance().getTime()); + up.setActivo(Boolean.FALSE); + } + + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioDAO.actualizacion(entidad); + } + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha) { + senha = ContrasenaUtileria.encriptarContrasena(senha); + return usuarioDAO.buscarPeloNomeSenha(stUsuario, senha); + } + + @Override + public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException, DataAccessException, CredentialsExpiredException { + if (login == null) { + throw new UsernameNotFoundException("Usuario não encontrado"); + } + List list = usuarioDAO.buscarPelaCveUsuario(login.toUpperCase()); + + if (list.isEmpty()) { + throw new UsernameNotFoundException("Usuario não encontrado"); + } + + Usuario user = list.get(0); + + if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) { + if (!user.isCredentialsNonExpired()) { + throw new CredentialsExpiredException("Senha Expirada"); + } + } + + return user; + } + + public List buscarPorEmpleado(Empleado empleado) { + return usuarioDAO.buscarPorEmpleado(empleado); + } + + public List buscarPelaCveUsuario(String cveUsuario) { + return usuarioDAO.buscarPelaCveUsuario(cveUsuario); + } + + @Override + public List buscarPeloNomeLike(String nome) { + return usuarioDAO.buscarPeloNomeLike(nome); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioSesionImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioSesionImpl.java new file mode 100644 index 000000000..4c99e8d65 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioSesionImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.UsuarioSesionDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; +import com.rjconsultores.ventaboletos.service.UsuarioSesionService; + +/** + * + * @author RJ Consultores + */ +@Service("usuarioSesionService") +public class UsuarioSesionImpl implements UsuarioSesionService { + + @Autowired + private UsuarioSesionDAO usuarioSesionDAO; + + public List obtenerTodos() { + return usuarioSesionDAO.obtenerTodos(); + } + + public UsuarioSesion obtenerID(Integer id) { + return usuarioSesionDAO.obtenerID(id); + } + + @Transactional + public UsuarioSesion suscribir(UsuarioSesion entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioSesionDAO.suscribir(entidad); + } + + @Transactional + public UsuarioSesion actualizacion(UsuarioSesion entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioSesionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioSesion entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioSesionDAO.actualizacion(entidad); + } + + @Override + public List buscar(Usuario usuario) { + return usuarioSesionDAO.buscar(usuario); + } + + @Transactional + @Override + public void liberarUsuario(Usuario usuario) { + usuarioSesionDAO.liberarUsuario(usuario); + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioUbicacionServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioUbicacionServiceImpl.java new file mode 100644 index 000000000..13ff272cd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/UsuarioUbicacionServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; +import com.rjconsultores.ventaboletos.service.UsuarioUbicacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import org.springframework.stereotype.Service; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("usuarioUbicacionService") +public class UsuarioUbicacionServiceImpl implements UsuarioUbicacionService { + + @Autowired + private UsuarioUbicacionDAO usuarioUbicacionDAO; + + public List obtenerTodos() { + return usuarioUbicacionDAO.obtenerTodos(); + } + + public UsuarioUbicacion obtenerID(Integer id) { + return usuarioUbicacionDAO.obtenerID(id); + } + + @Transactional + public UsuarioUbicacion suscribir(UsuarioUbicacion entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioUbicacionDAO.suscribir(entidad); + } + + @Transactional + public UsuarioUbicacion actualizacion(UsuarioUbicacion entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioUbicacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioUbicacion entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioUbicacionDAO.actualizacion(entidad); + } + + public List buscarPorUsuario(Usuario usuario) { + return usuarioUbicacionDAO.buscarPorUsuario(usuario); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/VendaEmbarcadaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/VendaEmbarcadaServiceImpl.java new file mode 100644 index 000000000..dc84a7730 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/VendaEmbarcadaServiceImpl.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.constantes.ConstantesVendaEmbarcada; +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.dao.hibernate.CajaHibernateDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaFormapagoException; +import com.rjconsultores.ventaboletos.service.VendaEmbarcadaService; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; + +@Service("VendaEmbarcadaService") +public class VendaEmbarcadaServiceImpl implements VendaEmbarcadaService { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(CajaHibernateDAO.class); + + @Autowired + CajaDAO cajaDao; + + @Override + public int gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws BusinessException { + try { + cajaDao.gerarVendaEmbarcada(vendaEmbarcada); + + return ConstantesVendaEmbarcada.VENDA_GERADA; + } catch (VendaEmbarcadaBoletoException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_BOLETO_ERROR; + } catch (VendaEmbarcadaBoletoFormapagoException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_BOLETO_FORMAPAGO_ERROR; + } catch (VendaEmbarcadaCajaException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_CAJA_ERROR; + } catch (VendaEmbarcadaCajaFormapagoException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_CAJA_FORMAPAGO_ERROR; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ViaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ViaServiceImpl.java new file mode 100644 index 000000000..64c6024e0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/ViaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.dao.ViaDAO; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.service.ViaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("viaService") +public class ViaServiceImpl implements ViaService { + + @Autowired + private ViaDAO viaDAO; + @Autowired + private TramoDAO tramoDAO; + + public List obtenerTodos() { + return viaDAO.obtenerTodos(); + } + + public Via obtenerID(Integer id) { + return viaDAO.obtenerID(id); + } + + @Transactional + public Via suscribir(Via entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return viaDAO.suscribir(entidad); + } + + @Transactional + public Via actualizacion(Via entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return viaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Via entidad) throws RegistroConDependenciaException { + if (tramoDAO.count("via", entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + viaDAO.actualizacion(entidad); + } + + public List buscar(String nombvia) { + return viaDAO.buscar(nombvia); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/VigenciaTarifaServiceImpl.java b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/VigenciaTarifaServiceImpl.java new file mode 100644 index 000000000..0a119855e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/service/impl/VigenciaTarifaServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.VigenciaTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.service.VigenciaTarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("vigenciaTarifaService") +public class VigenciaTarifaServiceImpl implements VigenciaTarifaService { + + @Autowired + private VigenciaTarifaDAO vigenciaTarifaDAO; + + public List obtenerTodos() { + return vigenciaTarifaDAO.obtenerTodos(); + } + + public VigenciaTarifa obtenerID(Integer id) { + return vigenciaTarifaDAO.obtenerID(id); + } + + @Transactional + public VigenciaTarifa suscribir(VigenciaTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return vigenciaTarifaDAO.suscribir(entidad); + } + + @Transactional + public VigenciaTarifa actualizacion(VigenciaTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return vigenciaTarifaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(VigenciaTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + vigenciaTarifaDAO.actualizacion(entidad); + } + + public List pesquisar(Date inicio, Date fim) { + return vigenciaTarifaDAO.pesquisar(inicio, fim); + } + + + public List buscarVigenciasIntervalo(VigenciaTarifa vigenciaTarifa) { + return vigenciaTarifaDAO.buscarVigenciasIntervalo(vigenciaTarifa); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ActivoUtil.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ActivoUtil.java new file mode 100644 index 000000000..d9d1d44a9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ActivoUtil.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.utilerias; + +public class ActivoUtil { + + public static final Integer ATIVO = 1; + public static final Integer INATIVO = 2; + public static final Integer EXCLUIDO = 0; + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java new file mode 100644 index 000000000..bda64b8e2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java @@ -0,0 +1,178 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import org.apache.log4j.Logger; +import org.springframework.core.io.ClassPathResource; + +/** + * Clase con las propriedad especificas de los clientes + * + * @author Administrador + */ +public class ApplicationProperties { + + private static Logger log = Logger.getLogger(ApplicationProperties.class); + private static ApplicationProperties INSTANCE; + private static Properties p; + + private ApplicationProperties() { + p = new Properties(); + this.readConfiguration(); + } + + private void readConfiguration() { + try { + + InputStream is = new ClassPathResource("/com/rjconsultores/ventaboletos/web/cliente/conf/application.properties").getInputStream(); + p.load(is); + is.close(); + } catch (IOException e) { + log.error(e); + } + } + + public static ApplicationProperties getInstance() { + if (INSTANCE == null) { + INSTANCE = new ApplicationProperties(); + } + + return INSTANCE; + } + + /** + * Indica se la informacion de equivalencia es visible + * + * @return + */ + public boolean mostrarEquivalencia() { + String property = p.getProperty("equivalencia.mostrar", "0"); + return property.equals("1"); + } + + /** + * Indica se es gerado o campo equivalencia corrida na tabela de corrida + * + * @return + */ + public boolean gerarCampoEquivalenciaCorrida() { + String property = p.getProperty("corrida.gerarCampoEquivalencia", "0"); + return property.equals("1"); + } + + /** + * Indica exibe o combo de Division na Gera��o de Corridas do Esquema Operacional. + * + * @return + */ + public boolean exibirDivisionConfiguracionCorrida() { + String property = p.getProperty("esquemaOperacional.configuracionCorrida.exibeDivision", "0"); + return property.equals("1"); + } + + /** + * Indica se va a exhibir la cuenta contable en el catalogo de tipos de eventos + * + * @return + */ + public boolean exhibirCuentaContableTiposEventos() { + String property = p.getProperty("eventosExtras.tiposEventos.exhibirCuentaContable", "1"); + return property.equals("1"); + } + + /** + * Indica se va a exhibir la "aba" de excepciones de tramo_km en la pantalla de tramos + * + * @return + */ + public boolean exhibirExcepcionesTramoKm() { + String property = p.getProperty("tramos.exhibirExcepcionesTramoKm", "0"); + return property.equals("1"); + } + + /** + * Indica se vai exibir botão na modificação massiva de tarifa de geração automatica de tarifas + * + * @return + */ + public boolean generarTarifasAutomatica() { + String property = p.getProperty("tarifa.generarTarifasAutomatica", "0"); + return property.equals("1"); + } + + public boolean generarRotinaFolios() { + String property = p.getProperty("no.cheque.folio", "0"); + return property.equals("1"); + } + + public boolean habilitarPricingCategoria() { + String property = p.getProperty("pricing.categoria.habilitar", "0"); + return property.equals("1"); + } + + public boolean rutaConMasDeUnaClase() { + String property = p.getProperty("ruta.masdeunaclase", "0"); + return property.equals("1"); + } + + public boolean diagramaAutobusDosPestana() { + String property = p.getProperty("diagramaautobus.dospestana", "0"); + return property.equals("1"); + } + + public boolean contrasenaValidaComplejidad() { + String property = p.getProperty("contrasena.validaComplejidad", "0"); + return property.equals("1"); + } + + public boolean pafActivo() { + String property = p.getProperty("paf.activo", "0"); + return property.equals("1"); + } + + public boolean habilitarCustomSequence() { + String property = p.getProperty("custom.sequence", "0"); + return property.equals("1"); + } + + public boolean integracionTotvs() { + String property = p.getProperty("integracion.totvs", "0"); + return property.equals("1"); + } + + public boolean integracionRioCard() { + String property = p.getProperty("integracion.riocard", "0"); + return property.equals("1"); + } + + public boolean diagramaAutobusTrem() { + String property = p.getProperty("layoutdiagramaautobus.trem", "0"); + return property.equals("1"); + } + + public boolean validaEstadoNoNomeLocalidade() { + String property = p.getProperty("validaEstadoNomeLocalidade", "0"); + return property.equals("1"); + } + + public boolean podeEditarClienteFidelidade() { + String property = p.getProperty("podeEditarClienteFidelidade", "0"); + return property.equals("1"); + } + + public Integer maxSizeNumCorrida(){ + String property = p.getProperty("maxSizeNumCorrida", "-1"); + return Integer.parseInt(property); + } + + public boolean criarTarifaApenasTrechoVendido() { + String property = p.getProperty("criarTarifaApenasTrechoVendido", "0"); + return property.equals("1"); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/BigDecimalUtil.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/BigDecimalUtil.java new file mode 100644 index 000000000..bbb4335a1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/BigDecimalUtil.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.util.Locale; + +import org.apache.commons.lang.StringUtils; + +/** + * + * @author Wilian + * + */ +public class BigDecimalUtil { + + public static BigDecimal getStringToBigDecimal(String value, Locale locale) throws ParseException { + if(value != null && StringUtils.isNotBlank(value)) { + NumberFormat nf = NumberFormat.getInstance(locale); + return new BigDecimal(nf.parse(value).toString()); + } + + return null; + } + + public static String getBigDecimalToStringDouble2CasasDecimaisFormatado(BigDecimal value, Locale locale) { + if(value != null) { + NumberFormat nf = NumberFormat.getInstance(locale); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + nf.setRoundingMode(RoundingMode.HALF_UP); + return nf.format(value.doubleValue()); + } + + return null; + } + + public static BigDecimal getStringToBigDecimal(String value, int qtdeCasasDecimais, Locale locale) throws ParseException { + if(value != null && StringUtils.isNotBlank(value)) { + DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(locale); + df.setMinimumFractionDigits(qtdeCasasDecimais); + df.setMaximumFractionDigits(qtdeCasasDecimais); + value = value.substring(0, value.length() - qtdeCasasDecimais).concat(df.getDecimalFormatSymbols().getDecimalSeparator()+"").concat(value.substring(value.length() - qtdeCasasDecimais, value.length())); + return new BigDecimal(df.parse(value).toString()); + } + + return null; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java new file mode 100644 index 000000000..00e956c91 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java @@ -0,0 +1,628 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Set; +import java.util.TreeSet; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.commons.lang.StringUtils; + +public final class DateUtil { + + public static Integer DIA = Integer.valueOf(1000 * 60 * 60 * 24); + public static Integer UM_DIA = Integer.valueOf(1); + + /** + * No need for an instance + */ + private DateUtil() { + } + + /** + * Elapsed days based on current time + * + * @param date + * Date + * + * @return int number of days + */ + public static int getElapsedDias(Date date) { + return elapsed(date, Calendar.DATE); + } + + /** + * Elapsed days based on two Date objects + * + * @param d1 + * Date + * @param d2 + * Date + * + * @return int number of days + */ + public static int getElapsedDias(Date d1, Date d2) { + return elapsed(d1, d2, Calendar.DATE); + } + + /** + * Elapsed months based on current time + * + * @param date + * Date + * + * @return int number of months + */ + public static int getElapsedMeses(Date date) { + return elapsed(date, Calendar.MONTH); + } + + /** + * Elapsed months based on two Date objects + * + * @param d1 + * Date + * @param d2 + * Date + * + * @return int number of months + */ + public static int getElapsedMeses(Date d1, Date d2) { + return elapsed(d1, d2, Calendar.MONTH); + } + + /** + * Elapsed years based on current time + * + * @param date + * Date + * + * @return int number of years + */ + public static int getElapsedAnos(Date date) { + return elapsed(date, Calendar.YEAR); + } + + /** + * Elapsed years based on two Date objects + * + * @param d1 + * Date + * @param d2 + * Date + * + * @return int number of years + */ + public static int getElapsedAnos(Date d1, Date d2) { + return elapsed(d1, d2, Calendar.YEAR); + } + + /** + * All elaspsed types + * + * @param g1 + * GregorianCalendar + * @param g2 + * GregorianCalendar + * @param type + * int (Calendar.FIELD_NAME) + * + * @return int number of elapsed "type" + */ + private static int elapsed(GregorianCalendar g1, GregorianCalendar g2, int type) { + GregorianCalendar gc1, gc2; + int elapsed = 0; + // Create copies since we will be clearing/adding + if (g2.after(g1)) { + gc2 = (GregorianCalendar) g2.clone(); + gc1 = (GregorianCalendar) g1.clone(); + } else { + gc2 = (GregorianCalendar) g1.clone(); + gc1 = (GregorianCalendar) g2.clone(); + } + if (type == Calendar.MONTH || type == Calendar.YEAR) { + gc1.clear(Calendar.DATE); + gc2.clear(Calendar.DATE); + } + if (type == Calendar.YEAR) { + gc1.clear(Calendar.MONTH); + gc2.clear(Calendar.MONTH); + } + while (gc1.before(gc2)) { + gc1.add(type, 1); + elapsed++; + } + return elapsed; + } + + /** + * All elaspsed types based on date and current Date + * + * @param date + * Date + * @param type + * int (Calendar.FIELD_NAME) + * + * @return int number of elapsed "type" + */ + private static int elapsed(Date date, int type) { + return elapsed(date, new Date(), type); + } + + /** + * All elaspsed types + * + * @param d1 + * Date + * @param d2 + * Date + * @param type + * int (Calendar.FIELD_NAME) + * + * @return int number of elapsed "type" + */ + private static int elapsed(Date d1, Date d2, int type) { + Calendar cal = Calendar.getInstance(); + cal.setTime(d1); + GregorianCalendar g1 = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); + cal.setTime(d2); + GregorianCalendar g2 = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); + return elapsed(g1, g2, type); + } + + public static Date getDateFromString(String data, String formato) throws java.text.ParseException { + Date d = new Date(); + DateFormat df = new SimpleDateFormat(formato); + + d = df.parse(data); + return d; + } + + public static int compareDate(java.util.Date d1) { + return compareDate(d1, new java.util.Date()); + } + + /** + * Compara a data atual com d1 de forma que a chama fica compareOnlyDate(d1, new java.util.Date()); + * + * {@link #compareOnlyDate(Date, Date)} + */ + public static int compareOnlyDate(java.util.Date d1) { + return compareOnlyDate(d1, new java.util.Date()); + } + + /** + * Não leva em consideração os segundos/minutos. Só é considerado o dia/mes/ano
+ * + * Retorno igual a {@link #compareDate(Date, Date)} + */ + public static int compareOnlyDate(java.util.Date d1, java.util.Date d2) { + java.util.Calendar cal = Calendar.getInstance(); + cal.setTime(d1); + GregorianCalendar g1 = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); + + java.util.Calendar cal2 = Calendar.getInstance(); + cal2.setTime(d2); + GregorianCalendar g2 = new GregorianCalendar(cal2.get(Calendar.YEAR), cal2.get(Calendar.MONTH), cal2.get(Calendar.DATE)); + return g1.compareTo(g2); + // return cal.compareTo(cal2); + } + + /** + * Retorna : - 0 se igual
+ * - < 0 se d1 < d2
+ * - > 0 se d1 > d2
+ */ + public static int compareDate(java.util.Date d1, java.util.Date d2) { + java.util.Calendar cal = Calendar.getInstance(); + cal.setTime(d1); + java.util.Calendar cal2 = Calendar.getInstance(); + cal2.setTime(d2); + + return cal.compareTo(cal2); + } + + public static Integer getIntegerDate(java.util.Date d, String formato) { + if (formato.contains("/")) { + throw new IllegalArgumentException("O formato não deve conter o simbolo \\ "); + } + + String s = getStringDate(d, formato); + return Integer.parseInt(s); + } + + public static String getStringDate(java.util.Date d, String formato) { + if(d != null) { + DateFormat df = new SimpleDateFormat(formato); + return df.format(d); + } + return null; + } + + public static String getStringDate(java.util.Date d) { + return getStringDate(d, "dd/MM/yyyy"); + } + + public static String getStringDate(java.sql.Date d) { + return getStringDate(new java.util.Date(d.getTime())); + } + + public static String getStringCurrentDate(String formato) { + return getStringDate(new java.util.Date(), formato); + } + + public static String changeFormatStringDate(String date, String currentFormat, String newFormat) { + + try { + return DateUtil.getStringDate(DateUtil.getDateFromString(date, currentFormat), newFormat); + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + public static Integer changeFormatIntDate(Integer date, String currentFormat, String newFormat) { + + try { + return DateUtil.getIntegerDate(DateUtil.getDateFromString(String.valueOf(date), currentFormat), newFormat); + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + /** + * Retorna uma array onde [0] é hora, [1] é minuto + * + * @param hora + * @return + */ + private static int[] getArrayHora(Integer hora) { + + String strHora = String.valueOf(hora); + + int[] array = new int[2]; + + if (strHora.length() <= 2) { + array[0] = 0; + array[1] = Integer.parseInt(strHora); + } else if (strHora.length() == 3) { + array[0] = Integer.parseInt(strHora.substring(0, 1)); + array[1] = Integer.parseInt(strHora.substring(1)); + } else if (strHora.length() == 4) { + array[0] = Integer.parseInt(strHora.substring(0, 2)); + array[1] = Integer.parseInt(strHora.substring(2)); + } + + return array; + } + + public static java.util.Date changeFormatIntDate(Integer date, String currentFormat, Integer hora) { + + try { + if (currentFormat.equals("yMMdd") || currentFormat.equals("yyMMdd")) { + + currentFormat = "yyyyMMdd"; + String strData = String.valueOf(date); + + if (strData.length() == 5) { + strData = "200" + strData; + } else if (strData.length() == 6) { + strData = "20" + strData; + } + + date = Integer.parseInt(strData); + } + Date data = DateUtil.getDateFromString(String.valueOf(date), currentFormat); + + if (hora == null) { + return data; + } + + int horaArray[] = DateUtil.getArrayHora(hora); + Calendar c = Calendar.getInstance(); + c.setTime(data); + c.set(Calendar.HOUR_OF_DAY, horaArray[0]); + c.set(Calendar.MINUTE, horaArray[1]); + + return c.getTime(); + + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + public static java.util.Date changeFormatStringDate(String date, String currentFormat, Integer hora) { + + try { + if (currentFormat.equals("yMMdd") || currentFormat.equals("yyMMdd")) { + + currentFormat = "yyyyMMdd"; + + if (date.length() == 5) { + date = "200" + date; + } else if (date.length() == 6) { + date = "20" + date; + } + } + Date data = DateUtil.getDateFromString(String.valueOf(date), currentFormat); + + if (hora == null) { + return data; + } + + int horaArray[] = DateUtil.getArrayHora(hora); + Calendar c = Calendar.getInstance(); + c.setTime(data); + c.set(Calendar.HOUR_OF_DAY, horaArray[0]); + c.set(Calendar.MINUTE, horaArray[1]); + + return c.getTime(); + + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + public static int getIntHoraSRVP(Date data) { + Calendar c = Calendar.getInstance(); + c.setTime(data); + + String hora = String.valueOf(c.get(Calendar.HOUR_OF_DAY)); + hora = (hora.length() < 2) ? "0" + hora : hora; + + String minuto = String.valueOf(c.get(Calendar.MINUTE)); + minuto = (minuto.length() < 2) ? "0" + minuto : minuto; + + return Integer.parseInt(hora + minuto); + } + + public static long getElapsedHoras(Date dtInic, Date dtFim) { + return (dtFim.getTime() - dtInic.getTime()) / (1000 * 60 * 60); + } + + public static long getElapsedMinutos(Date dtInic, Date dtFim) { + return (dtFim.getTime() - dtInic.getTime()) / (1000 * 60); + } + + /** + * Regresa los minutos pela hora inicial del sistema + * + * @param dtInic + * @param dtFim + * @return + */ + public static HoraSistema getHorasMinutosByInicio(Date dtFim) { + return new HoraSistema(dtFim); + } + + /** + * Verifica se o intervalo de datas dtStartCompare e dtEndCompare estão dentro do intervalo dtStart dtEnd + * + * @param dtStart + * @param dtEnd + * @param dtStartCompare + * @param dtEndCompare + * @return + */ + public static boolean intersectDate(Date dtStart, Date dtEnd, Date dtStartCompare, Date dtEndCompare) { + return TraslaparUtil.intersectDate(dtStart, dtEnd, dtStartCompare, dtEndCompare); + } + + public static void main(String ar[]) { + // System.out.println(DateUtil.intersectNum(0, 100, 50, 150)); + } + + public static void main2(String args[]) { + java.util.Date agora = new java.util.Date(); + + System.out.println(agora); + + Calendar c = Calendar.getInstance(); + c.setTime(agora); + + System.out.println(DateUtil.getIntHoraSRVP(agora)); + // c.add(Calendar.MINUTE, 60); + + System.out.println("final " + c.getTime()); + System.out.println("1 " + c.get(Calendar.HOUR_OF_DAY)); + + } + + /** + * Es la fecInicial del sistema para campos de horas + * + * @return + */ + public static Calendar getFecInicio() { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + + return c; + } + + /** + * Es la fecInicial del sistema con los campos de hora y minutos del parametro informado + * + * @return + */ + public static Calendar getFecInicio(Date horaMinuto) { + Calendar tmp = Calendar.getInstance(); + tmp.setTime(horaMinuto); + Calendar c = getFecInicio(); + c.set(Calendar.HOUR_OF_DAY, tmp.get(Calendar.HOUR_OF_DAY)); + c.set(Calendar.MINUTE, tmp.get(Calendar.MINUTE)); + + return c; + } + + /** + * Es la fecInicial del sistema con los campos de hora y minutos del parametro informado + * + * @return + */ + public static Calendar getFecInicio(Integer hora, Integer minuto) { + + Calendar c = getFecInicio(); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + return c; + } + + /** + * Quita los segundos y milesegundos de la fecha + * + * @param fecha + * @return + */ + public static Date normalizar(Date fecha) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + + return gcalendar.getTime(); + } + + /** + * Quita los segundos, milesegundos, hora y minuto de la fecha + * + * @param fecha + * @return + */ + public static Date normalizarToFecha(Date fecha) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + gcalendar.set(Calendar.HOUR_OF_DAY, 0); + gcalendar.set(Calendar.MINUTE, 0); + + return gcalendar.getTime(); + } + + public static Date inicioFechaPeriodoMeses(Date periodo) { + return inicioFecha(periodo, true); + } + + public static Date fimFechaPeriodoMeses(Date periodo) { + return fimFecha(periodo, true); + } + + private static Date inicioFecha(Date fecha, boolean diaInicial) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + int date = gcalendar.get(Calendar.DATE); + if (diaInicial) { + date = gcalendar.getActualMinimum(Calendar.DAY_OF_MONTH); + } + int month = gcalendar.get(Calendar.MONTH); + int year = gcalendar.get(Calendar.YEAR); + int hourOfDay = 00; + int minute = 00; + int second = 00; + + gcalendar.set(year, month, date, hourOfDay, minute, second); + return gcalendar.getTime(); + } + + private static Date fimFecha(Date fecha, boolean diaFinal) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + + int date = gcalendar.get(Calendar.DATE); + if (diaFinal) { + date = gcalendar.getActualMaximum(Calendar.DAY_OF_MONTH); + } + int month = gcalendar.get(Calendar.MONTH); + int year = gcalendar.get(Calendar.YEAR); + int hourOfDay = 23; + int minute = 59; + int second = 59; + + gcalendar.set(year, month, date, hourOfDay, minute, second); + return gcalendar.getTime(); + } + + public static Date inicioFecha(Date fecha) { + return inicioFecha(fecha, false); + } + + public static Date fimFecha(Date fecha) { + return fimFecha(fecha, false); + } + + public static Date somarDias(Date data, int quantidadeDias) { + Integer dias = UM_DIA * quantidadeDias; + Calendar c = Calendar.getInstance(); + c.setTime(data); + c.add(Calendar.DAY_OF_MONTH, dias); + return c.getTime(); + } + + /** + * Formato competencia: MM/YYYY + * @param competencia + * @return + */ + public static Set carregarDiasCompetencia(String competencia) { + Set diasCompetencia = new TreeSet(); + + String[] vetCompetencia = competencia.split("/"); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.MONTH, Integer.valueOf(vetCompetencia[0]) - 1); + cal.set(Calendar.YEAR, Integer.valueOf(vetCompetencia[1])); + + for (int i = 1; i <= cal.getActualMaximum(Calendar.DAY_OF_MONTH); i++) { + diasCompetencia.add(i); + } + + return diasCompetencia; + } + + public static boolean isCompetenciaValida(String competencia) { + if(StringUtils.isNotBlank(competencia)) { + Integer mes = Integer.valueOf(competencia.split("/")[0]); + Integer minMes = Calendar.JANUARY + 1; + Integer maxMes = Calendar.DECEMBER + 1; + return mes >= minMes && mes <= maxMes; + } + + return false; + } + + public static Date getDataFinalCompetencia(String competencia) throws ParseException { + if(isCompetenciaValida(competencia)) { + Date dataInicio = getDateFromString("01/"+competencia, "dd/MM/yyyy"); + Calendar cal = Calendar.getInstance(LocaleUtil.getLocale()); + cal.setTime(dataInicio); + return getDateFromString(cal.getActualMaximum(Calendar.DAY_OF_MONTH)+"/"+competencia, "dd/MM/yyyy"); + } + return null; + } + public static Date getDataInicialCompetencia(String competencia) throws ParseException { + if(isCompetenciaValida(competencia)) { + return getDateFromString("01/"+competencia, "dd/MM/yyyy"); + } + return null; + } + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/FeriadoCache.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/FeriadoCache.java new file mode 100644 index 000000000..cbe609f8b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/FeriadoCache.java @@ -0,0 +1,110 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.FeriadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; + +@Service("feriadoCache") +@Scope(value = "prototype") +public class FeriadoCache { + + private static Logger log = LoggerFactory.getLogger(FeriadoCache.class); + + @Autowired + private FeriadoDAO feriadoDAO; + private Map mapFeriado; + + public FeriadoCache() { + mapFeriado = new LinkedHashMap(); + } + + public boolean ehFeriado(Date dataFeriado, Empresa empresa, Estado estadoOrigem) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + String strDataFeriado = sdf.format(dataFeriado); + KeyFeriadoMap key = new KeyFeriadoMap(strDataFeriado, empresa.getEmpresaId(), estadoOrigem.getEstadoId()); + + Boolean ehFeriado = mapFeriado.get(key); + + if (ehFeriado == null) { + ehFeriado = feriadoDAO.ehFeriado(new java.sql.Date(dataFeriado.getTime()), empresa, estadoOrigem); + + mapFeriado.put(key, ehFeriado); + } + + log.debug("data feriado = " + strDataFeriado + "; empresa = " + empresa.getNombempresa() + "; estado = " + estadoOrigem.getNombestado() + "; eh feriado = " + ehFeriado); + + return ehFeriado; + } + + public void limpar() { + mapFeriado.clear(); + } + + class KeyFeriadoMap { + private String dataFeriado; + private Integer empresaId; + private Integer estadoOrigemId; + + public KeyFeriadoMap(String dataFeriado, Integer empresaId, Integer estadoOrigemId) { + super(); + this.dataFeriado = dataFeriado; + this.empresaId = empresaId; + this.estadoOrigemId = estadoOrigemId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((dataFeriado == null) ? 0 : dataFeriado.hashCode()); + result = prime * result + ((empresaId == null) ? 0 : empresaId.hashCode()); + result = prime * result + ((estadoOrigemId == null) ? 0 : estadoOrigemId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + KeyFeriadoMap other = (KeyFeriadoMap) obj; + if (!getOuterType().equals(other.getOuterType())) + return false; + if (dataFeriado == null) { + if (other.dataFeriado != null) + return false; + } else if (!dataFeriado.equals(other.dataFeriado)) + return false; + if (empresaId == null) { + if (other.empresaId != null) + return false; + } else if (!empresaId.equals(other.empresaId)) + return false; + if (estadoOrigemId == null) { + if (other.estadoOrigemId != null) + return false; + } else if (!estadoOrigemId.equals(other.estadoOrigemId)) + return false; + return true; + } + + private FeriadoCache getOuterType() { + return FeriadoCache.this; + } + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/HoraSistema.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/HoraSistema.java new file mode 100644 index 000000000..59f3c6ad6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/HoraSistema.java @@ -0,0 +1,101 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.Calendar; +import java.util.Date; + +/** + * Classe criada para realizar operações sobre a hora inicial do sistema.
+ * + * A hora inicial do sistema pode ser obtida pelo método DateUtil.getFecInicio() e retorna : YEAR, 1970; DAY_OF_MONTH, 1; MONTH, 0; HOUR_OF_DAY, 0;MINUTE, 0;
+ * MILLISECOND, 0; SECOND, 0.
+ * + * + * Assim é possível armazenar e somar tempos como 24:30 + 36:00 = 60 horas e 30 minutos + * + * @author gleimar + * + */ +public class HoraSistema { + private Integer hora; + private Integer minuto; + + public HoraSistema() { + this.hora = 0; + this.minuto = 0; + } + + public HoraSistema(Date fecha) { + conf(fecha); + } + + private void conf(Date fecha) { + Long tempo = DateUtil.getElapsedMinutos(DateUtil.getFecInicio().getTime(), fecha); + + long minutos = (tempo % 60); + int horas = (tempo.intValue() / 60); + + hora = horas; + minuto = (int) minutos; + + } + + @Override + public String toString() { + + return (hora + ":" + ((String.valueOf(minuto).length() < 2) ? "0" + minuto : minuto)); + } + + public Integer getHora() { + return hora; + } + + public Integer getMinuto() { + return minuto; + } + + public void setMinuto(Integer minuto) { + this.minuto = minuto; + } + + public void setHora(Integer hora) { + this.hora = hora; + } + + public Date getFecha() { + Calendar c = DateUtil.getFecInicio(); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + return c.getTime(); + } + + /** + * Realiza a soma da hora/minuto atual com o informado no parametro + * + * @param horaAdicao + * @return + */ + public HoraSistema sumar(HoraSistema horaAdicao) { + Calendar horaAtual = Calendar.getInstance(); + horaAtual.setTime(getFecha()); + + Calendar horaSomar = Calendar.getInstance(); + horaSomar.setTime(horaAdicao.getFecha()); + + int horaTotal = horaAtual.get(Calendar.HOUR_OF_DAY) + horaSomar.get(Calendar.HOUR_OF_DAY); + int minutoTotal = horaAtual.get(Calendar.MINUTE) + horaSomar.get(Calendar.MINUTE); + + int cantDiasAtual = DateUtil.getElapsedDias(DateUtil.getFecInicio().getTime(), horaAtual.getTime()); + int cantDiasSumar = DateUtil.getElapsedDias(DateUtil.getFecInicio().getTime(), horaSomar.getTime()); + + Calendar fecInicio = DateUtil.getFecInicio(); + fecInicio.add(Calendar.HOUR_OF_DAY, horaTotal); + fecInicio.add(Calendar.MINUTE, minutoTotal); + + fecInicio.add(Calendar.DATE, cantDiasAtual); + fecInicio.add(Calendar.DATE, cantDiasSumar); + + return new HoraSistema(fecInicio.getTime()); + } + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/LocaleUtil.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/LocaleUtil.java new file mode 100644 index 000000000..31e94c2b4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/LocaleUtil.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.Locale; + +import org.zkoss.util.Locales; + +/** + * Retorna o locale atual, caso o locale não seja suportado pelo sistema,
+ * será retornado o locale pt_br + * @author Wilian + */ +public class LocaleUtil { + + + private static Locale LOCALE_PT_BR = new Locale("pt", "br"); + private static Locale LOCALE_ES_MX = new Locale("es", "mx"); + + private static Locale [] LOCALES = new Locale[]{LOCALE_PT_BR, LOCALE_ES_MX}; + + /** + * Retorna o locale atual, caso o locale não seja suportado pelo sistema,
+ * será retornado o locale pt_br + * @return + */ + public static Locale getLocale() { + Locale localeCurrent = Locales.getCurrent(); + for (Locale locale : LOCALES) { + if(localeCurrent.getLanguage().equals(locale.getLanguage())) { + return localeCurrent; + } + } + + return LOCALE_PT_BR; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/RegistroConDependenciaException.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/RegistroConDependenciaException.java new file mode 100644 index 000000000..a05ef8e06 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/RegistroConDependenciaException.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import org.zkoss.util.resource.Labels; + +/** + * + * @author gleimar + */ +public class RegistroConDependenciaException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public RegistroConDependenciaException() { + super(Labels.getLabel("MSG.exception.RegistroConDependenciaException")); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java new file mode 100644 index 000000000..df48da043 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java @@ -0,0 +1,316 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.activation.FileDataSource; +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.util.ByteArrayDataSource; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.rjconsultores.ventaboletos.enums.MimeType; + +public class SendMail { + private static Logger log = LoggerFactory.getLogger(SendMail.class); + + private String smtpHost; + private String smtpUser; + private String smtpPassword; + private String smtpPort; + private String emailFrom; + private String emailTo; + private String emailToCO; + private List emailCopy = new ArrayList(); + private String localhost; + private String auth; + private String subject; + private String text; + private Map anexosBytes; + private Map anexosArquivos; + private Map mimeTypes; + + public SendMail(){ + this.smtpHost = ""; + this.smtpUser = ""; + this.smtpPassword = ""; + this.smtpPort = ""; + this.emailFrom = ""; + this.localhost = ""; + this.auth = "true"; + this.emailTo = ""; + this.emailToCO = ""; + } + + public SendMail(String smtpHost, String smtpUser, String smtpPassword, String smtpPort, + String emailFrom, String emailTo, List emailCopy, String localhost, + String auth, String subject, String text) { + this.smtpHost = smtpHost; + this.smtpUser = smtpUser; + this.smtpPassword = smtpPassword; + this.smtpPort = smtpPort; + this.emailFrom = emailFrom; + this.emailTo = emailTo; + this.emailCopy = emailCopy; + this.localhost = localhost; + this.auth = auth; + this.subject = subject; + this.text = text; + } + + public String[] removeNull(String[] a) { + List removed = new ArrayList(); + for (String str : a) + if (!StringUtils.isBlank(str) && !str.equals("null")) + removed.add(str); + return removed.toArray(new String[0]); + } + + public void send() { + try { + String[] to = {}; + String[] bcc = {}; + + if (emailTo.contains(";")){ + to = emailTo.split(";"); + } else if (!StringUtils.isBlank(emailTo)){ + to = new String[1]; + to[0] = emailTo; + } + + if (emailToCO.contains(";")){ + bcc = emailToCO.split(";"); + } else if (!StringUtils.isBlank(emailToCO)){ + bcc = new String[1]; + bcc[0] = emailToCO; + } + + to = removeNull(to); + bcc = removeNull(bcc); + + Boolean vAuth = (auth == null ? Boolean.TRUE : Boolean.valueOf(auth)); + + Properties props = System.getProperties(); + props.put("mail.smtp.host", smtpHost); + + if (localhost != null) { + props.put("mail.smtp.localhost", localhost); + } + + if (vAuth) { + props.setProperty("mail.smtp.starttls.enable", "true"); + props.setProperty("mail.smtp.auth", "true"); + } + + props.setProperty("mail.smtp.port", smtpPort); + props.setProperty("mail.smtp.user", smtpUser); + + Session session = Session.getInstance(props, null); + + Message message = new MimeMessage(session); + message.setFrom(new InternetAddress(emailFrom)); + + InternetAddress[] toAddress = new InternetAddress[to.length]; + + for (int i = 0; i < to.length; i++) { + toAddress[i] = new InternetAddress(to[i]); + } + + message.setRecipients(Message.RecipientType.TO, toAddress); + + InternetAddress[] toBccAddress = new InternetAddress[bcc.length]; + + for (int i = 0; i < bcc.length; i++) { + toBccAddress[i] = new InternetAddress(bcc[i]); + } + + message.setRecipients(Message.RecipientType.BCC, toBccAddress); + + InternetAddress[] copyAddress = new InternetAddress[emailCopy.size()]; + int i = 0; + for (String eCopy : emailCopy) { + copyAddress[i] = new InternetAddress(eCopy); + i++; + } + if (copyAddress.length > 0) { + message.setRecipients(Message.RecipientType.CC, copyAddress); + } + + message.setSubject(subject); + + BodyPart messageBodyPart = new MimeBodyPart(); + messageBodyPart.setText(text); + + Multipart multipart = new MimeMultipart(); + multipart.addBodyPart(messageBodyPart); + message.setContent(multipart); + + adicionarAnexos(multipart); + + Transport t = session.getTransport("smtp"); + t.connect(smtpUser, smtpPassword); + t.sendMessage(message, message.getAllRecipients()); + t.close(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + private void adicionarAnexos(Multipart multipart) throws MessagingException, IOException { + anexarArquivosBytes(multipart); + anexarArquivos(multipart); + } + + private void anexarArquivosBytes(Multipart multipart) throws MessagingException, IOException { + if(anexosBytes != null) { + for (Entry anexo : anexosBytes.entrySet()) { + BodyPart bodyPart = new MimeBodyPart(); + com.rjconsultores.ventaboletos.enums.MimeType mimeType = mimeTypes.get(anexo.getKey()); + DataSource bds = new ByteArrayDataSource(new ByteArrayInputStream(anexo.getValue().toByteArray()), mimeType.toString()); + bodyPart.setDataHandler(new DataHandler(bds)); + bodyPart.setFileName(anexo.getKey()); + + multipart.addBodyPart(bodyPart); + } + } + } + + private void anexarArquivos(Multipart multipart) throws MessagingException { + if(anexosArquivos != null) { + for (Entry anexo : anexosArquivos.entrySet()) { + BodyPart bodyPart = new MimeBodyPart(); + DataSource bds = new FileDataSource(anexo.getValue()); + bodyPart.setDataHandler(new DataHandler(bds)); + bodyPart.setFileName(anexo.getKey()); + multipart.addBodyPart(bodyPart); + } + } + } + + public String getSmtpHost() { + return smtpHost; + } + + public void setSmtpHost(String smtpHost) { + this.smtpHost = smtpHost; + } + + public String getSmtpUser() { + return smtpUser; + } + + public void setSmtpUser(String smtpUser) { + this.smtpUser = smtpUser; + } + + public String getSmtpPassword() { + return smtpPassword; + } + + public void setSmtpPassword(String smtpPassword) { + this.smtpPassword = smtpPassword; + } + + public String getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(String smtpPort) { + this.smtpPort = smtpPort; + } + + public String getEmailFrom() { + return emailFrom; + } + + public void setEmailFrom(String emailFrom) { + this.emailFrom = emailFrom; + } + + public String getEmailTo() { + return emailTo; + } + + public void setEmailTo(String emailTo) { + this.emailTo = emailTo; + } + + public List getEmailCopy() { + return emailCopy; + } + + public void setEmailCopy(List emailCopy) { + this.emailCopy = emailCopy; + } + + public String getLocalhost() { + return localhost; + } + + public void setLocalhost(String localhost) { + this.localhost = localhost; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getEmailToCO() { + return emailToCO; + } + + public void setEmailToCO(String emailToCO) { + this.emailToCO = emailToCO; + } + + public void addAnexo(String nome, ByteArrayOutputStream anexo, MimeType mimeType) { + if(anexosBytes == null) { + anexosBytes = new HashMap(); + } + if(mimeTypes == null) { + mimeTypes = new HashMap(); + } + anexosBytes.put(nome, anexo); + mimeTypes.put(nome, mimeType); + } + + public void addAnexo(String nome, String anexo) { + if(anexosArquivos== null) { + anexosArquivos = new HashMap(); + } + anexosArquivos.put(nome, anexo); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/StringHelper.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/StringHelper.java new file mode 100644 index 000000000..c086c0d9a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/StringHelper.java @@ -0,0 +1,148 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.lang.StringUtils; + +public class StringHelper { + + public static final String QUEBRA_LINHA = "\r\n"; + + private static String[] REPLACES = { "a", "e", "i", "o", "u", "c", "A", "E", "I", "O", "U", "C" }; + private static Pattern[] PATTERNS = null; + + private StringHelper() { + } + + private static void compilePatterns() { + PATTERNS = new Pattern[REPLACES.length]; + PATTERNS[0] = Pattern.compile("[âãáàä]"); + PATTERNS[1] = Pattern.compile("[éèêë]"); + PATTERNS[2] = Pattern.compile("[íìîï]"); + PATTERNS[3] = Pattern.compile("[óòôõö]"); + PATTERNS[4] = Pattern.compile("[úùûü]"); + PATTERNS[5] = Pattern.compile("[ç]"); + PATTERNS[6] = Pattern.compile("[ÂÃÁÀÄ]"); + PATTERNS[7] = Pattern.compile("[ÉÈÊË]"); + PATTERNS[8] = Pattern.compile("[ÍÌÎÏ]"); + PATTERNS[9] = Pattern.compile("[ÓÒÔÕÖ]"); + PATTERNS[10] = Pattern.compile("[ÚÙÛÜ]"); + PATTERNS[11] = Pattern.compile("[Ç]"); + } + + public static String replaceAcento(String text) { + if (PATTERNS == null) { + compilePatterns(); + } + + String result = text; + for (int i = 0; i < PATTERNS.length; i++) { + Matcher matcher = PATTERNS[i].matcher(result); + result = matcher.replaceAll(REPLACES[i]); + } + return result; + } + + public static String retornaSomenteNumeros(String str) { + if (str != null) { + return str.replaceAll("[^0123456789]", ""); + } else { + return ""; + } + } + + public static String removeStringEsquerda(String str, String strRemover) { + if (str != null) { + str = StringUtils.stripStart(str, strRemover); + return str; + } else { + return ""; + } + } + + public static String preencherStringEspacoDireita(String str, int tamanho) { + return preencherStringDireita(str, tamanho, StringUtils.EMPTY); + } + + public static String preencherStringEspacoEsquerda(String str, int tamanho) { + return preencherStringEsquerda(str, tamanho, StringUtils.EMPTY); + } + + public static String preencherZeroDireita(String str, int tamanho) { + return preencherStringDireita(str, tamanho, "0"); + } + + public static String preencherZeroEsquerda(String str, int tamanho) { + return preencherStringEsquerda(str, tamanho, "0"); + } + + public static String preencherStringDireita(String str, int tamanho, String preenchimento) { + if (str != null) { + if (str.length() > tamanho) { + str = str.substring(0, tamanho); + } else { + str = StringUtils.rightPad(str, tamanho, preenchimento); + } + return str; + } else { + return StringUtils.rightPad(StringUtils.EMPTY, tamanho, preenchimento); + } + } + + public static String preencherStringEsquerda(String str, int tamanho, String preenchimento) { + if (str != null) { + if (str.length() > tamanho) { + str = str.substring(0, tamanho); + } else { + str = StringUtils.leftPad(str, tamanho, preenchimento); + } + return str; + } else { + return StringUtils.leftPad(StringUtils.EMPTY, tamanho, preenchimento); + } + } + + public static String preencherPipeDireita(String str, int tamanho) { + if (str != null && !StringUtils.isEmpty(str)) { + if (str.length() > tamanho) { + str = str.substring(0, tamanho); + } + str = StringUtils.rightPad(str, str.length() + 1, "|"); + return str; + } else { + return "|"; + } + } + + public static String preencherPipeDireita(String str) { + if (str != null && !StringUtils.isEmpty(str)) { + str = StringUtils.rightPad(str, str.length() + 1, "|"); + return str; + } else { + return "|"; + } + } + + public static String divideEFormata(String str) { + + DecimalFormatSymbols symbols = new DecimalFormatSymbols(); + symbols.setDecimalSeparator(','); + DecimalFormat formatador = new DecimalFormat("0.00", symbols); + + String valor = "0"; + if (str != null) { + valor = new BigDecimal(str).divide(new BigDecimal(100)).toString(); + } + return formatador.format(new BigDecimal(valor)); + + } + + public static Boolean isNumeric(String str) { + return StringUtils.isNumeric(str); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/TraslaparUtil.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/TraslaparUtil.java new file mode 100644 index 000000000..19f1594e7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/TraslaparUtil.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * Classe que ajuda na verificação se os dados se sobrepõe + * @author gleimar + */ +public class TraslaparUtil { + /** + * Verifica se o intervalo de datas dtStartCompare e dtEndCompare estão dentro do intervalo dtStart dtEnd + * + * @param dtStart + * @param dtEnd + * @param dtStartCompare + * @param dtEndCompare + * @return + */ + public static boolean intersectDate(Date dtStart, Date dtEnd, Date dtStartCompare, Date dtEndCompare) { + if (((DateUtil.compareDate(dtStart, dtStartCompare) >= 0) && (DateUtil.compareDate(dtEnd, dtEndCompare) <= 0)) + || ((DateUtil.compareDate(dtEnd, dtStartCompare) >= 0) && (DateUtil.compareDate(dtEnd, dtEndCompare) <= 0)) + || ((DateUtil.compareDate(dtStart, dtStartCompare) >= 0) && (DateUtil.compareDate(dtStart, dtEndCompare) <= 0)) + || ((DateUtil.compareDate(dtStart, dtStartCompare) <= 0) && (DateUtil.compareDate(dtEnd, dtEndCompare) >= 0))) { + + return true; + } + + return false; + } + + /** + * + * @param numStart + * @param numEnd + * @param numStartCompare + * @param numEndCompare + * @return + */ + public static boolean intersectNum(Long numStart, Long numEnd, Long numStartCompare, Long numEndCompare) { + if (((numStart.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numEnd.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) >= 0) && (numStart.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) <= 0) && (numEnd.compareTo(numEndCompare) >= 0))) { + + return true; + } + + return false; + } + public static boolean intersectNum(BigDecimal numStart, BigDecimal numEnd, BigDecimal numStartCompare, BigDecimal numEndCompare) { + if (((numStart.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numEnd.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) >= 0) && (numStart.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) <= 0) && (numEnd.compareTo(numEndCompare) >= 0))) { + + return true; + } + + return false; + } + public static boolean intersectNum(Integer numStart, Integer numEnd, Integer numStartCompare, Integer numEndCompare) { + return intersectNum(numStart.longValue(), numEnd.longValue(), numStartCompare.longValue(), numEndCompare.longValue()); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/UsuarioLogado.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/UsuarioLogado.java new file mode 100644 index 000000000..bd10bd4ea --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/UsuarioLogado.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.context.ApplicationContext; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.context.ContextLoaderListener; + +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; + +/** + * + * @author rodrigo + */ +public class UsuarioLogado { + + private static Logger log = Logger.getLogger(UsuarioLogado.class); + + public static Usuario getUsuarioLogado() { + Usuario usuario = null; + SecurityContext sc = SecurityContextHolder.getContext(); + if (sc != null) { + Authentication authentication = (Authentication) sc.getAuthentication(); + + if ((authentication != null) && (authentication.getPrincipal() instanceof Usuario)) { + usuario = (Usuario) authentication.getPrincipal(); + + if(usuario.getListClavesPermisos() == null) { + cargaPermisoClave(usuario); + } + } else { + usuario = null; + } + } + + return usuario; + } + + private static void cargaPermisoClave(Usuario usuario) { + try { + if(usuario != null && usuario.getListClavesPermisos() == null || usuario.getListClavesPermisos().isEmpty()) { + ApplicationContext context = ContextLoaderListener.getCurrentWebApplicationContext(); + + if(context != null) { + + UsuarioPerfilDAO usuarioPerfilDAO = context.getBean(UsuarioPerfilDAO.class); + if(usuarioPerfilDAO != null) { + usuario.setListClavesPermisos(new ArrayList()); + List listUsuarioPerfil = usuarioPerfilDAO.obtenerPorUsuario(usuario); + for (UsuarioPerfil up : listUsuarioPerfil) { + List listPerfilFuncion = up.getPerfil().getPerfilFuncionList(); + for (PerfilFuncion pf : listPerfilFuncion) { + usuario.getListClavesPermisos().add(pf.getFuncionSistema().getDescruta()); + } + } + } + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/UtiliteriasFiscal.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/UtiliteriasFiscal.java new file mode 100644 index 000000000..4beae6f56 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/UtiliteriasFiscal.java @@ -0,0 +1,284 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; + +public class UtiliteriasFiscal { + + private static int DECIMALS = 2; + private static int ROUNDING_MODE = BigDecimal.ROUND_HALF_EVEN; + + public static final String DATE_FORMAT_FISCAL = "yyyyMMdd"; + public static final BigDecimal CEM = BigDecimal.valueOf(100); + public static final String QUEBRA_LINHA = "\r\n"; + + public static BigDecimal divideEFormata(BigDecimal valor) { + String vlrFormatado = StringHelper.divideEFormata(valor.toString()); + return new BigDecimal(vlrFormatado); + } + + public static String defineCodigoProduto(Integer idOrigemCorrida, Integer idDestinoCorrida, Integer idLinha) { + int tamanhoMaximo = 12; + + String codOrigem = Integer.toHexString(idOrigemCorrida); + String codDestino = Integer.toHexString(idDestinoCorrida); + String codLinha = Integer.toHexString(idLinha); + + codOrigem = codOrigem.toUpperCase() + StringUtils.repeat("X", 4 - codOrigem.length()); + codDestino = codDestino.toUpperCase() + StringUtils.repeat("X", 4 - codDestino.length()); + codLinha = codLinha.toUpperCase() + StringUtils.repeat("X", 3 - codLinha.length()); + + String codProduto = codOrigem + codDestino + codLinha + "-"; + + if (codProduto.length() > tamanhoMaximo) { + codProduto = codProduto.substring(1, tamanhoMaximo + 1); + } + + return codProduto; + } + + public static void main(String args[]) { + System.out.println(formataZeroDecimal(new BigDecimal("3870.00"), 2, 14)); + } + + public static String formataNumerico(final String valor, final int tamanho) { + return formataNumerico(valor, false, tamanho); + } + + public static String formataNumerico(final String valor, final boolean removeMascara, final int tamanho) { + String retorno = StringUtils.trim(valor); + + if (retorno == null) { + retorno = ""; + } + + if (removeMascara) { + retorno = retorno.replace("-", "").replace(".", "").replace("/", ""); + } + + retorno = retorno.replace(".", "").replace(",", ""); + + if (tamanho > 0) { + if (retorno.length() > tamanho) { + retorno = retorno.substring(retorno.length() - tamanho, retorno.length()); + } + + return StringUtils.leftPad(retorno, tamanho, "0"); + } + + return retorno; + } + + public static String formataZeroDecimal(final BigDecimal valor, final int tamanho) { + String valorFommat = valor == null ? "" : valor.toString(); + valorFommat = valorFommat.toString().replace(".", "").replace(",", ""); + valorFommat = formataNumerico(valorFommat, valorFommat.length()); + valorFommat = StringUtils.leftPad(valorFommat, (tamanho), "0"); + return valorFommat; + } + + public static String formataEspacosDecimalEsquerda(final BigDecimal valor, final int tamanho) { + String valorFommat = valor == null ? "" : valor.toString(); + valorFommat = valorFommat.toString().replace(".", "").replace(",", ""); + valorFommat = UtiliteriasFiscal.formataNumerico(valorFommat, valorFommat.length()); + valorFommat = StringUtils.leftPad(valorFommat, (tamanho), " "); + return valorFommat; + } + + public static String formataEspacosDecimalDireita(final BigDecimal valor, final int tamanho) { + String valorFommat = valor == null ? "" : valor.toString(); + valorFommat = valorFommat.toString().replace(".", "").replace(",", ""); + valorFommat = UtiliteriasFiscal.formataNumerico(valorFommat, valorFommat.length()); + valorFommat = StringUtils.rightPad(valorFommat, (tamanho), " "); + return valorFommat; + } + + public static BigDecimal arredondar(BigDecimal aNumber) { + return aNumber.setScale(DECIMALS, ROUNDING_MODE); + } + + public static String formataZeroDecimal(final BigDecimal valor, final int casasDecimais, final int tamanho) { + NumberFormat df = DecimalFormat.getInstance(); + df.setMinimumFractionDigits(casasDecimais); + df.setMaximumFractionDigits(casasDecimais); + + String valorFommat = valor == null ? "" : df.format(valor).replaceAll("[^0-9]", ""); + valorFommat = formataNumerico(valorFommat, tamanho); + return valorFommat; + } + + public static BigDecimal valorTotalItensECF(ImportacionFiscalVO item) { + BigDecimal valorTotal = BigDecimal.ZERO; + + BigDecimal valorPedagio = item.getValorPedagio() == null ? BigDecimal.ZERO : item.getValorPedagio(); + BigDecimal valorEmbarque = item.getValorEmbarque() == null ? BigDecimal.ZERO : item.getValorEmbarque(); + BigDecimal valorTarifa = item.getValorTarifa() == null ? BigDecimal.ZERO : item.getValorTarifa(); + BigDecimal valorSeguro = item.getValorSeguro() == null ? BigDecimal.ZERO : item.getValorSeguro(); + if (valorTarifa.equals(BigDecimal.ZERO)) + valorTarifa = BigDecimal.ONE.divide(CEM); + + valorTotal = valorTotal.add(valorTarifa).add(valorPedagio).add(valorEmbarque).add(valorSeguro); + + return valorTotal; + } + + public static String aberturaDeArquivo(String identificador, String data, String cnpjFilial, String brancos372, + String sequencial) { + + StringBuilder abertura = new StringBuilder(); + abertura.append(identificador); + abertura.append(data); + abertura.append(cnpjFilial); + abertura.append(brancos372); + abertura.append(sequencial); + + return abertura.toString(); + } + + public static String headerDocumentoFiscal(String identificador, String data, String cnpjImpressora, String coo, + String serie, String especie, String codigoCliente, String filialCliente, String condicaoPagamento, + String valorTotalDocumanto, String valorItens, String aliquota, String imposto, String valorPIS, + String valorCofins, String valorCSLL, String totalICMSIsento, String totalICMSNaotributado, String origenUf, + String origen, String destinoUf, String destino, String subSerie, String aidf, String status, + String motivocancelacion, String valorMulta, String brancos, String claseServicio, String sequencial) { + + StringBuilder header = new StringBuilder(); + header.append(identificador); + header.append(data); + header.append(cnpjImpressora); + header.append(coo); + header.append(serie); + header.append(especie); + header.append(codigoCliente); + header.append(filialCliente); + header.append(condicaoPagamento); + header.append(valorTotalDocumanto); + header.append(valorItens); + header.append(aliquota); + header.append(imposto); + header.append(valorPIS); + header.append(valorCofins); + header.append(valorCSLL); + header.append(totalICMSIsento); + header.append(totalICMSNaotributado); + header.append(origenUf); + header.append(origen); + header.append(destinoUf); + header.append(destino); + header.append(subSerie == null ? "" : subSerie); + header.append(aidf == null ? "" : aidf); + header.append(status); + header.append(motivocancelacion == null ? "" : motivocancelacion); + header.append(valorMulta == null ? "" : valorMulta); + header.append(brancos); + header.replace(226, 256, claseServicio); + + header.append(sequencial); + + return header.toString(); + } + + public static String itensDocumentoFiscal(String identificador, String numItem, String cfop, String codigoTES, + String codProduto, String unidade, String quantidade, String valorUnitario, String valorTotal, + String aliquotaItem, String impostoItem, String valorPIS, String aliquotaPIS, String aliquotaCofins, + String valorCofins, String aliquotaCSLL, String valorCSLL, String aliquotaISS, String valorISS, + String totalICMSIsentoItem, String totalICMSNaotributadoItem, String numeroPDV, String numeroSeriePDV, + String modeloImpressora, String numCaixa, String status, String coo, String serie, + String brancos, String sequencial) { + + StringBuilder item = new StringBuilder(); + item.append(identificador); + item.append(numItem); + item.append(cfop); + item.append(codigoTES); + item.append(codProduto); + item.append(unidade); + item.append(quantidade); + item.append(valorUnitario); + item.append(valorTotal); + item.append(aliquotaItem); + item.append(impostoItem); + item.append(aliquotaPIS); + item.append(valorPIS); + item.append(aliquotaCofins); + item.append(valorCofins); + item.append(aliquotaCSLL); + item.append(valorCSLL); + item.append(aliquotaISS); + item.append(valorISS); + item.append(totalICMSIsentoItem); + item.append(totalICMSNaotributadoItem); + item.append(numeroPDV == null ? "" : numeroPDV); + item.append(numeroSeriePDV == null ? "" : numeroSeriePDV); + item.append(modeloImpressora); + item.append(numCaixa); + item.append(status); + item.append(coo == null ? "" : coo); + item.append(serie == null ? "" : serie); + item.append(brancos); + item.append(sequencial); + + return item.toString(); + } + + public static String fechamentoDeArquivo(String identificador, String qtdeDocGerados, String qtdeItensDocGerados, + String brancos, String sequencial) { + + StringBuilder fechamento = new StringBuilder(); + fechamento.append(identificador); + fechamento.append(qtdeDocGerados == null ? "" : qtdeDocGerados); + fechamento.append(qtdeItensDocGerados == null ? "" : qtdeItensDocGerados); + fechamento.append(brancos); + fechamento.append(sequencial); + + return fechamento.toString(); + } + + public static String reducaoZ(String identificador, String dataMovimento, String cnpj, String numRelatorio, String numPDV, + String numSeriePDV, String numReducaoZ, String gtInicial, String gtFinal, String docFiscalInic, + String docFiscalFinal, String valorCancel, String valorContabil, String subtributaria, String descontos, + String isento, String naoTributado, String aliquota, String aliquota2, String aliquota3, String aliquota4, + String coo, String outrosRecebimentos, String impostoDebitado, String dataReducaoZ, String horaReducaoZ, + String valorDocFiscal, String status, String brancos, String sequencial) { + + StringBuilder reducaoZ = new StringBuilder(); + reducaoZ.append(identificador); + reducaoZ.append(dataMovimento); + reducaoZ.append(cnpj); + reducaoZ.append(numRelatorio); + reducaoZ.append(numPDV); + reducaoZ.append(numSeriePDV); + reducaoZ.append(numReducaoZ); + reducaoZ.append(gtInicial); + reducaoZ.append(gtFinal); + reducaoZ.append(docFiscalInic); + reducaoZ.append(docFiscalFinal); + reducaoZ.append(valorCancel); + reducaoZ.append(valorContabil); + reducaoZ.append(subtributaria); + reducaoZ.append(descontos); + reducaoZ.append(isento); + reducaoZ.append(naoTributado); + reducaoZ.append(aliquota); + reducaoZ.append(aliquota2); + reducaoZ.append(aliquota3); + reducaoZ.append(aliquota4); + reducaoZ.append(coo); + reducaoZ.append(outrosRecebimentos); + reducaoZ.append(impostoDebitado); + reducaoZ.append(dataReducaoZ); + reducaoZ.append(horaReducaoZ); + reducaoZ.append(valorDocFiscal); + reducaoZ.append(status); + reducaoZ.append(brancos); + reducaoZ.append(sequencial); + + return reducaoZ.toString(); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ValidadorImportacaoEcf.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ValidadorImportacaoEcf.java new file mode 100644 index 000000000..6a1eea797 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ValidadorImportacaoEcf.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; + +public class ValidadorImportacaoEcf { + + public static void main(String[] args) { + BufferedReader br; + int linha = 1; + + BigDecimal soma = BigDecimal.ZERO; + try { + br = new BufferedReader(new FileReader("c:\\Users\\rjgw\\Downloads\\fiscal_cancel_201604060542.txt")); + try { + // int linha = 1; + String line = br.readLine(); + Integer l1 = null; + Integer l2 = null; + try { + while (line != null) { + if (line.startsWith("1")) { + l1 = Integer.valueOf(line.substring(51, 65).trim()); + System.out.println("Linha: " + linha + " -- " + "Valor: " + l1); + soma = soma.add(new BigDecimal(l1).divide(new BigDecimal(100))); + l2 = 0; + } + if (line.startsWith("2")) { + l2 += Integer.valueOf(line.substring(47, 62).trim()); + } + line = br.readLine(); + if (line.startsWith("1") && l1 != null && l2 != null) { + if (l1.compareTo(l2) != 0) { + System.out.println("Linha: " + linha); + } + } + linha++; + } + } catch (NullPointerException e) { + } + + System.out.println("Soma: " + soma); + + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + System.out.println("Linha: " + linha); + e.printStackTrace(); + } finally { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } catch (FileNotFoundException e) { + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ZipUtil.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ZipUtil.java new file mode 100644 index 000000000..83f3e944d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/ZipUtil.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class ZipUtil { + + public static void compactarArquivos(File arquivoDeSaida, File... arquivosEOuPastas) throws IOException { + if (arquivosEOuPastas != null && arquivoDeSaida != null) { + byte[] buf = new byte[1024]; + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(arquivoDeSaida)); + + for (File f : arquivosEOuPastas) { + FileInputStream in = new FileInputStream(f.getPath()); + out.putNextEntry(new ZipEntry(f.getName())); + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + in.close(); + f.delete(); + } + out.close(); + } + } + + public static void compactarArquivos(File arquivoDeSaida, List arquivosEOuPastas) throws IOException { + if (arquivosEOuPastas != null && arquivoDeSaida != null) { + byte[] buf = new byte[1024]; + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(arquivoDeSaida)); + + for (File f : arquivosEOuPastas) { + FileInputStream in = new FileInputStream(f.getPath()); + out.putNextEntry(new ZipEntry(f.getName())); + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + in.close(); + f.delete(); + } + out.close(); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECF.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECF.java new file mode 100644 index 000000000..c6cbd774b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECF.java @@ -0,0 +1,460 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SiglaMotivoCancelacion; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; + +public class ArchivoIntegracionECF { + + private static Logger log = Logger.getLogger(ArchivoIntegracionECF.class); + + public File importacionFiscalECFGenerico(Date inicio, Date fim, Empresa empresa, boolean isNormal, boolean isCancelados, boolean isPendencias, List list) { + + try { + String nomeArquivo = "fiscal_ecf_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + if (isCancelados) { + nomeArquivo = "fiscal_ecf_cancel_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + } else if (isPendencias) { + nomeArquivo = "fiscal_ecf_pendencias_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + } + + File arquivo = File.createTempFile(nomeArquivo, ".txt"); + + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + Integer seq = 1; + + String cnpjFilial = empresa.getCnpj(); + String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371); + String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), UtiliteriasFiscal.DATE_FORMAT_FISCAL); + String seqAbertura = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String abertura = UtiliteriasFiscal.aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, seqAbertura); + gravarArq.print(abertura + UtiliteriasFiscal.QUEBRA_LINHA); + + Integer qtdDoc = 0; + Integer qtdItens = 0; + + String header = null; + List itensDocs = new ArrayList(); + + for (ImportacionFiscalVO item : list) { + + qtdDoc++; + header = null; + itensDocs = new ArrayList(); + + String data = item.getDataEmissao(); + String brancos = StringHelper.preencherStringEspacoEsquerda(null, 202); + String cnpjEcf = item.getCnpjEcf() == null ? cnpjFilial : item.getCnpjEcf(); + + String serie = item.getNumImpressora(); + if (serie.length() >= 20) { + serie = serie.substring(17); + serie = StringHelper.preencherStringEspacoEsquerda(serie, 3); + } else { + serie = StringHelper.preencherStringEspacoEsquerda(null, 3); + } + + String especie = StringHelper.preencherStringEspacoDireita("CF", 5); + + String codigoCliente = StringHelper.preencherStringEsquerda(null, 6, "9"); + String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9"); + String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9"); + + String valorPIS = StringHelper.preencherZeroEsquerda(null, 14); + String valorCofins = StringHelper.preencherZeroEsquerda(null, 14); + String valorCSLL = StringHelper.preencherZeroEsquerda(null, 14); + + String coo = StringHelper.preencherStringEspacoDireita(item.getCoo(), 9); + + BigDecimal valorTotal = UtiliteriasFiscal.arredondar(UtiliteriasFiscal.valorTotalItensECF(item)); + String valorTotalDocumanto = UtiliteriasFiscal.formataEspacosDecimalDireita(valorTotal, 14); + String valorItens = valorTotalDocumanto; + + HashMap aliquotaBaseCalculo = getAliquotaBaseCalculo(item); + String aliquota = aliquotaBaseCalculo.get("aliquota"); + String imposto = aliquotaBaseCalculo.get("imposto"); + String totalICMSIsento = aliquotaBaseCalculo.get("totalICMSIsento"); + String totalICMSNaotributado = aliquotaBaseCalculo.get("totalICMSNaotributado"); + + String origenUf = StringHelper.preencherStringEspacoEsquerda(item.getOrigenUf(), 2); + String origen = item.getOrigenId() == null ? StringUtils.EMPTY : item.getOrigenId().toString(); + if (origen.length() > 2) { + origen = origen.substring(2); + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } else { + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } + + String destinoUf = StringHelper.preencherStringEspacoEsquerda(item.getDestinoUf(), 2); + String destino = item.getDestinoId() == null ? StringUtils.EMPTY : item.getDestinoId().toString(); + if (destino.length() > 2) { + destino = destino.substring(2); + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } else { + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } + + String motivocancelacion = null; + String valorMulta = null; + if (isCancelados) { + SiglaMotivoCancelacion sigla = SiglaMotivoCancelacion.valueOf(item.getMotivocancelacion()); + motivocancelacion = StringHelper.preencherStringEspacoEsquerda(sigla.toString(), 20); + valorMulta = UtiliteriasFiscal.formataZeroDecimal(item.getValorMulta(), 15); + brancos = StringHelper.preencherStringEspacoEsquerda(null, 167); + } + + seq++; + String status = StringHelper.preencherStringEspacoEsquerda(item.getStatus(), 1); + String claseServicio = StringHelper.preencherStringEspacoDireita(item.getClaseServicio(), 30); + String seqHeader = StringHelper.preencherZeroEsquerda(Integer.valueOf(seq).toString(), 6); + + header = UtiliteriasFiscal.headerDocumentoFiscal("1", data, cnpjEcf, coo, serie, especie, codigoCliente, + filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, aliquota, imposto, + valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origenUf, origen, + destinoUf, destino, null, null, status, motivocancelacion, valorMulta, brancos, claseServicio, seqHeader); + + /* + * Item da importacion Fiscal ECF + */ + int seqItem = 1; + for (ItemFiscalVO subItens : item.getItensFiscais()) { + String itemDoc = montarItensFiscais(subItens, seq++, seqItem); + itensDocs.add(itemDoc); + qtdItens++; + seqItem++; + } + + grabarHeaderItens(gravarArq, header, itensDocs); + + } + + seq++; + String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6); + String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6); + String brancos381 = StringHelper.preencherStringEspacoEsquerda(null, 381); + String seqFechamento = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String fechamento = UtiliteriasFiscal.fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos381, seqFechamento); + gravarArq.print(fechamento + UtiliteriasFiscal.QUEBRA_LINHA); + + gravarArq.close(); + return arquivo; + + } catch (IOException e) { + log.error("", e); + } + + return null; + } + + private HashMap getAliquotaBaseCalculo(ImportacionFiscalVO fiscal) { + + HashMap resp = new HashMap(); + + String aliquota = null; + String imposto = null; + String totalICMSIsento = null; + String totalICMSNaotributado = null; + + for (ItemFiscalVO item : fiscal.getItensFiscais()) { + + BigDecimal valorItem = BigDecimal.ZERO; + String codProduto = StringHelper.preencherStringEspacoEsquerda(item.getCodProduto(), 15); + // VALIDA TARIFA + if (codProduto.indexOf("TA") >= 0) { + valorItem = item.getValorTarifa() == null ? valorItem : item.getValorTarifa(); + if (valorItem.equals(BigDecimal.ZERO)) + valorItem = BigDecimal.ONE; + + // TAXA DE EMBARQUE + } else if (codProduto.indexOf("TX") >= 0) { + valorItem = item.getValorEmbarque() == null ? valorItem : item.getValorEmbarque(); + + // PEDAGIO + } else if (codProduto.indexOf("PE") >= 0) { + valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio(); + + // SEGURO + } else if (codProduto.indexOf("SE") >= 0) { + valorItem = item.getValorSeguro() == null ? valorItem : item.getValorSeguro(); + } + + valorItem = UtiliteriasFiscal.arredondar(valorItem); + item.setValorItem(new BigDecimal(UtiliteriasFiscal.formataZeroDecimal(valorItem, 15))); + + HashMap aliquotaBaseCalculo = new HashMap(0); + + // Verificando se é um produto tributável. Formato: XXTYYYY (XX - Posicao / YYYY - Aliquota) + String repTributado = item.getRepTributado() == null ? SituacaoTributaria.NAO_TRIBUTADO.getValue() : item.getRepTributado(); + if (repTributado.length() == 7 && repTributado.substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + + String tipoPassagem = item.getTipoPassagem(); + + if (tipoPassagem == null) { + tipoPassagem = "E"; + } + + String key = tipoPassagem + item.getRepTributado().substring(3, 7); + + if (!aliquotaBaseCalculo.containsKey(key)) { + aliquotaBaseCalculo.put(key, BigDecimal.ZERO); + } + + BigDecimal soma = item.getValorItem().divide(BigDecimal.TEN.multiply(BigDecimal.TEN)); + aliquotaBaseCalculo.put(key, soma.add(aliquotaBaseCalculo.get(key))); + + } else if (repTributado.equals(SituacaoTributaria.NAO_TRIBUTADO.getValue())) { + + BigDecimal soma = item.getValorItem(); + totalICMSNaotributado = soma.toString(); + + if (totalICMSNaotributado.length() < 14) { + totalICMSNaotributado = StringHelper.preencherZeroEsquerda(totalICMSNaotributado, 14); + } + + } + + for (String key : aliquotaBaseCalculo.keySet()) { + aliquota = key.substring(1, 5); + + BigDecimal aliquotaCalc = BigDecimal.valueOf(Double.valueOf(aliquota) / UtiliteriasFiscal.CEM.doubleValue()); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = aliquotaBaseCalculo.get(key); + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + imposto = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 14); + aliquota = UtiliteriasFiscal.formataZeroDecimal(aliquotaCalc, 14); + } + + boolean inconsistente = item.getInconsistencia() == null ? false : item.getInconsistencia(); + if (inconsistente) { + if (codProduto.indexOf("TA") >= 0) { + BigDecimal aliquotaCalc = item.getImpostoEstado() == null ? BigDecimal.ZERO : item.getImpostoEstado(); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = valorItem; + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + imposto = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 14); + aliquota = UtiliteriasFiscal.formataZeroDecimal(aliquotaCalc, 14); + totalICMSIsento = null; + totalICMSNaotributado = null; + } + } + + } + if (StringUtils.isBlank(aliquota)) + aliquota = StringHelper.preencherZeroEsquerda(null, 14); + + if (StringUtils.isBlank(imposto)) + imposto = StringHelper.preencherZeroEsquerda(null, 14); + + if (StringUtils.isBlank(totalICMSIsento)) + totalICMSIsento = StringHelper.preencherZeroEsquerda(null, 14); + + if (StringUtils.isBlank(totalICMSNaotributado)) + totalICMSNaotributado = StringHelper.preencherZeroEsquerda(null, 14); + + resp.put("aliquota", aliquota); + resp.put("imposto", imposto); + resp.put("totalICMSIsento", totalICMSIsento); + resp.put("totalICMSNaotributado", totalICMSNaotributado); + + return resp; + } + + private String montarItensFiscais(ItemFiscalVO item, Integer seq, Integer seqItem) { + + String tipoPassagem = null; + + String repTributado = item.getRepTributado() == null ? SituacaoTributaria.NAO_TRIBUTADO.getValue() : item.getRepTributado(); + if (repTributado.length() == 7 && repTributado.substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + tipoPassagem = item.getTipoPassagem(); + + if (tipoPassagem == null) + tipoPassagem = "E"; + + } else { + tipoPassagem = "E"; + } + + String numItem = StringHelper.preencherZeroEsquerda(seqItem.toString(), 3); + + String cfop = null; + if (tipoPassagem.equals("E")) { + cfop = StringHelper.preencherStringEspacoDireita("6357", 5); + } else if (tipoPassagem.equals("M")) { + cfop = StringHelper.preencherStringEspacoDireita("5357", 5); + } + + String codigoTES = StringHelper.preencherStringEsquerda(null, 3, "9"); + String codProduto = StringHelper.preencherStringEspacoEsquerda(item.getCodProduto(), 15); + String unidade = "UN"; + String quantidade = "001"; + + // TODO: A forma de enviar o valor do item é baseada no codProduto, pelo fato da FISCAL_R5 estar gravando os registros de tarifa errado + BigDecimal valorItem = BigDecimal.ZERO; + // VALIDA TARIFA + if (codProduto.indexOf("TA") >= 0) { + valorItem = item.getValorTarifa() == null ? valorItem : item.getValorTarifa(); + if (valorItem.equals(BigDecimal.ZERO)) + valorItem = BigDecimal.ONE.divide(UtiliteriasFiscal.CEM); + + // TAXA DE EMBARQUE + } else if (codProduto.indexOf("TX") >= 0) { + valorItem = item.getValorEmbarque() == null ? valorItem : item.getValorEmbarque(); + + // PEDAGIO + } else if (codProduto.indexOf("PE") >= 0) { + valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio(); + + // SEGURO + } else if (codProduto.indexOf("SE") >= 0) { + valorItem = item.getValorSeguro() == null ? valorItem : item.getValorSeguro(); + } + + valorItem = UtiliteriasFiscal.arredondar(valorItem); + String valorUnitario = UtiliteriasFiscal.formataZeroDecimal(valorItem, 15); + item.setValorItem(new BigDecimal(valorUnitario)); + String valorTotal = valorUnitario; + + String aliquotaItem = StringHelper.preencherZeroEsquerda(null, 7); + String impostoItem = StringHelper.preencherZeroEsquerda(null, 15); + String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda(null, 15); + String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(null, 15); + + HashMap aliquotaItens = new HashMap(0); + + // Verificando se é um produto tributável. Formato: XXTYYYY (XX - Posicao / YYYY - Aliquota) + if (repTributado.length() == 7 && repTributado.substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + + String key = tipoPassagem + item.getRepTributado().substring(3, 7); + + if (!aliquotaItens.containsKey(key)) { + aliquotaItens.put(key, BigDecimal.ZERO); + } + + BigDecimal soma = item.getValorItem().divide(BigDecimal.TEN.multiply(BigDecimal.TEN)); + aliquotaItens.put(key, soma.add(aliquotaItens.get(key))); + + } else if (repTributado.equals(SituacaoTributaria.NAO_TRIBUTADO.getValue())) { + + BigDecimal soma = item.getValorItem(); + totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(soma.toString(), 15); + } + + for (String key : aliquotaItens.keySet()) { + aliquotaItem = key.substring(1, 5); + + BigDecimal aliquotaCalc = BigDecimal.valueOf(Double.valueOf(aliquotaItem) / UtiliteriasFiscal.CEM.doubleValue()); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = aliquotaItens.get(key); + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + impostoItem = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 15); + aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7); + } + + boolean inconsistente = item.getInconsistencia() == null ? false : item.getInconsistencia(); + if (inconsistente) { + if (codProduto.indexOf("TA") >= 0) { + BigDecimal aliquotaCalc = item.getImpostoEstado() == null ? BigDecimal.ZERO : item.getImpostoEstado(); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = valorItem; + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + impostoItem = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 15); + aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7); + totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(null, 15); + } + } + + String aliquotaPIS = StringHelper.preencherZeroEsquerda(null, 7); + String valorPIS = StringHelper.preencherZeroEsquerda(null, 15); + String aliquotaCofins = StringHelper.preencherZeroEsquerda(null, 7); + String valorCofins = StringHelper.preencherZeroEsquerda(null, 15); + String aliquotaCSLL = StringHelper.preencherZeroEsquerda(null, 7); + String valorCSLL = StringHelper.preencherZeroEsquerda(null, 15); + String aliquotaISS = StringHelper.preencherZeroEsquerda(null, 7); + String valorISS = StringHelper.preencherZeroEsquerda(null, 15); + + String numeroPDV = StringHelper.preencherStringEspacoDireita(item.getNumpdv(), 10); + String numeroSeriePDV = StringHelper.preencherStringEspacoDireita(item.getNumImpressora(), 20); + String modeloImpressora = StringHelper.preencherStringEspacoDireita(item.getModeloImpressora(), 40); + String numCaixa = StringHelper.preencherStringEspacoDireita(item.getNumCaixa(), 10); + String status = StringHelper.preencherStringEspacoEsquerda(item.getStatus(), 1); + + String coo = null; + String serie = null; + + coo = StringHelper.preencherStringEspacoDireita(item.getCoo(), 9); + serie = item.getNumImpressora(); + if (serie.length() >= 20) { + serie = serie.substring(17); + serie = StringHelper.preencherStringEspacoEsquerda(serie, 3); + } else { + serie = StringHelper.preencherStringEspacoEsquerda(null, 3); + } + + String brancos99 = StringHelper.preencherStringEspacoEsquerda(null, 99); + + seq++; + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String itemDoc = UtiliteriasFiscal.itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto, + unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem, + aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL, + aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem, + numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status, coo, serie, + brancos99, sequencial); + return itemDoc; + + } + + private void grabarHeaderItens(PrintWriter gravarArq, String header, List itensDocs) { + gravarArq.print(header + UtiliteriasFiscal.QUEBRA_LINHA); + + for (String doc : itensDocs) { + gravarArq.print(doc + UtiliteriasFiscal.QUEBRA_LINHA); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFManual.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFManual.java new file mode 100644 index 000000000..d85ead2f5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFManual.java @@ -0,0 +1,263 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SubItens; + +public class ArchivoIntegracionECFManual { + + private static Logger log = Logger.getLogger(ArchivoIntegracionECFManual.class); + + public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa, List listManual) { + + try { + String nomeArquivo = "fiscal_ecf_manual_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + File arquivo = File.createTempFile(nomeArquivo, ".txt"); + + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + Integer seq = 1; + + String cnpjFilial = empresa.getCnpj(); + String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371); + String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), UtiliteriasFiscal.DATE_FORMAT_FISCAL); + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String abertura = UtiliteriasFiscal.aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, sequencial); + gravarArq.print(abertura + UtiliteriasFiscal.QUEBRA_LINHA); + + Integer qtdDoc = 0; + Integer qtdItens = 0; + + inicio = DateUtil.inicioFecha(inicio); + fim = DateUtil.fimFecha(fim); + + List list = agruparItensFiscaisManual(listManual); + for (ImportacionManualFiscalVO imf : list) { + + qtdDoc++; + + String data = imf.getDataEmissao(); + + String coo = StringHelper.preencherZeroEsquerda(imf.getCoo(), 9); + String serie = StringHelper.preencherStringEspacoEsquerda(imf.getSerie(), 3); + String especie = StringHelper.preencherStringEspacoDireita("RMD", 5); + + String codigoCliente = StringHelper.preencherStringEsquerda(null, 6, "9"); + String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9"); + String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9"); + + BigDecimal valorTotal = UtiliteriasFiscal.arredondar(calculaValorTotalECFManual(imf)); + String valorTotalDocumanto = UtiliteriasFiscal.formataEspacosDecimalDireita(valorTotal, 14); + String valorItens = valorTotalDocumanto; + + BigDecimal valorICMS = imf.getIcms() == null ? BigDecimal.ZERO : UtiliteriasFiscal.arredondar(imf.getIcms()); + String baseCalICMS = UtiliteriasFiscal.formataZeroDecimal(valorICMS, 14); + + BigDecimal aliquotaCalc = imf.getIcms() == null ? BigDecimal.ZERO : UtiliteriasFiscal.arredondar(imf.getIcms()); + BigDecimal baseCalculo = UtiliteriasFiscal.arredondar(imf.getValorTotal()); + BigDecimal valorImposto = UtiliteriasFiscal.arredondar(baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM))); + String valorTotalICMS = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 14); + + String valorPIS = StringHelper.preencherZeroEsquerda(null, 14); + String valorCofins = StringHelper.preencherZeroEsquerda(null, 14); + String valorCSLL = StringHelper.preencherZeroEsquerda(null, 14); + String totalICMSIsento = StringHelper.preencherZeroEsquerda(null, 14); + String totalICMSNaotributado = StringHelper.preencherZeroEsquerda(null, 14); + + String origenUf = StringHelper.preencherStringEspacoEsquerda(imf.getOrigenUf(), 2); + String origen = imf.getOrigenId().toString(); + if (origen.length() > 2) { + origen = origen.substring(2); + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } else { + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } + + String destinoUf = StringHelper.preencherStringEspacoEsquerda(imf.getDestinoUf(), 2); + String destino = imf.getDestinoId().toString(); + if (destino.length() > 2) { + destino = destino.substring(2); + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } else { + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } + + String subSerie = StringHelper.preencherStringEspacoEsquerda(imf.getSubSerie(), 2); + String aidf = StringHelper.preencherStringEspacoEsquerda(imf.getAidf(), 30); + String status = StringHelper.preencherStringEspacoEsquerda(imf.getStatus(), 1); + String claseServicio = StringHelper.preencherStringEspacoDireita(imf.getClaseServicio(), 30); + String brancos170 = StringHelper.preencherStringEspacoEsquerda(null, 170); + + seq++; + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String header = UtiliteriasFiscal.headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente, + filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, baseCalICMS, valorTotalICMS, + valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origenUf, origen, + destinoUf, destino, subSerie, + aidf, status, null, null, brancos170, claseServicio, sequencial); + gravarArq.print(header + UtiliteriasFiscal.QUEBRA_LINHA); + + for (String itemDoc : montarItensFiscaisManual(imf, imf.getSubItens(), seq)) { + + qtdItens++; + gravarArq.print(itemDoc + UtiliteriasFiscal.QUEBRA_LINHA); + seq++; + } + } + + seq++; + + String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6); + String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6); + String brancos381 = StringHelper.preencherStringEspacoEsquerda(null, 381); + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String fechamento = UtiliteriasFiscal.fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos381, sequencial); + gravarArq.print(fechamento + UtiliteriasFiscal.QUEBRA_LINHA); + + gravarArq.close(); + return arquivo; + + } catch (IOException e) { + log.error("", e); + } + + return null; + } + + private BigDecimal calculaValorTotalECFManual(ImportacionManualFiscalVO imf) { + BigDecimal valorTotal = BigDecimal.ZERO; + valorTotal = valorTotal.add(imf.getValorTotal()); + valorTotal = valorTotal.add(imf.getImporteoutros() == null ? BigDecimal.ZERO : imf.getImporteoutros()); + valorTotal = valorTotal.add(imf.getImportepedagio() == null ? BigDecimal.ZERO : imf.getImportepedagio()); + valorTotal = valorTotal.add(imf.getImporteseguro() == null ? BigDecimal.ZERO : imf.getImporteseguro()); + valorTotal = valorTotal.add(imf.getImportetaxaembarque() == null ? BigDecimal.ZERO : imf.getImportetaxaembarque()); + return valorTotal; + } + + private List montarItensFiscaisManual(ImportacionManualFiscalVO imf, List itensFiscais, Integer seq) { + + List itensDocs = new ArrayList(); + Integer num = 0; + + for (SubItens item : itensFiscais) { + + num++; + String numItem = StringHelper.preencherZeroEsquerda(num.toString(), 3); + + String cfop = null; + if (imf.getEstadoIdOrigen() != imf.getEstadoIdDestino()) { + cfop = StringHelper.preencherStringEspacoDireita("6357", 5); + } else { + cfop = StringHelper.preencherStringEspacoDireita("5357", 5); + } + + String codigoTES = StringHelper.preencherStringEsquerda(null, 3, "9"); + String prod = imf.getCodProduto() == null ? item.getCodProduto() : imf.getCodProduto(); + String codProduto = StringHelper.preencherStringEspacoEsquerda(prod, 15); + + String unidade = "UN"; + String quantidade = "001"; + + BigDecimal valorItem = UtiliteriasFiscal.arredondar(item.getValor()); + String valorUnitario = UtiliteriasFiscal.formataZeroDecimal(valorItem, 15); + String valorTotal = UtiliteriasFiscal.formataZeroDecimal(valorItem, 15); + + String aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7); + String impostoItem = UtiliteriasFiscal.formataZeroDecimal(null, 15); + String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda(null, 15); + String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(null, 15); + + if (codProduto.indexOf("TA") >= 0) { + BigDecimal aliquotaCalc = UtiliteriasFiscal.arredondar(imf.getIcms() == null ? BigDecimal.ZERO : imf.getIcms()); + BigDecimal baseCalculo = UtiliteriasFiscal.arredondar(imf.getValorTotal() == null ? BigDecimal.ZERO : imf.getValorTotal()); + BigDecimal valorImposto = UtiliteriasFiscal.arredondar(baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM))); + impostoItem = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 15); + } else { + totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(valorTotal, 15); + } + + String aliquotaPIS = StringHelper.preencherZeroEsquerda(null, 7); + String valorPIS = StringHelper.preencherZeroEsquerda(null, 15); + String aliquotaCofins = StringHelper.preencherZeroEsquerda(null, 7); + String valorCofins = StringHelper.preencherZeroEsquerda(null, 15); + String aliquotaCSLL = StringHelper.preencherZeroEsquerda(null, 7); + String valorCSLL = StringHelper.preencherZeroEsquerda(null, 15); + String aliquotaISS = StringHelper.preencherZeroEsquerda(null, 7); + String valorISS = StringHelper.preencherZeroEsquerda(null, 15); + + String numeroPDV = StringHelper.preencherStringEspacoDireita(imf.getNumpdv(), 10); + String numeroSeriePDV = StringHelper.preencherStringEspacoDireita(imf.getNumImpressora(), 20); + String modeloImpressora = StringHelper.preencherStringEspacoDireita(imf.getModeloImpressora(), 40); + String numCaixa = StringHelper.preencherStringEspacoDireita(imf.getNumCaixa(), 10); + String status = StringHelper.preencherStringEspacoEsquerda(imf.getStatus(), 1); + + seq++; + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + String brancos111 = StringHelper.preencherStringEspacoDireita(null, 111); + + String itemDoc = UtiliteriasFiscal.itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto, + unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem, + aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL, + aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem, + numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status, null, null, + brancos111, sequencial); + itensDocs.add(itemDoc); + } + + return itensDocs; + } + + private List agruparItensFiscaisManual(List list) { + + List aux = new ArrayList(); + + for (ImportacionManualFiscalVO imf : list) { + + List itens = new ArrayList(); + + // if (imf.getImporteoutros() != null) { + // itens.add(new SubItens(imf.getImporteoutros(), "00000000000-OT")); + // } + + if (imf.getImportepedagio() != null) { + itens.add(new SubItens(imf.getImportepedagio(), "00000000000-PE")); + } + + if (imf.getImporteseguro() != null) { + itens.add(new SubItens(imf.getImporteseguro(), "00000000000-SE")); + } + + if (imf.getImportetaxaembarque() != null) { + itens.add(new SubItens(imf.getImportetaxaembarque(), "00000000000-TX")); + } + if (imf.getValorItem() != null) { + itens.add(new SubItens(imf.getValorTotal(), "00000000000-TA")); + } + + imf.setSubItens(itens); + aux.add(imf); + } + + return aux; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFReducaoZ.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFReducaoZ.java new file mode 100644 index 000000000..843eecc21 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFReducaoZ.java @@ -0,0 +1,219 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.AgpImpressoraEcfVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.AgpImpressoraReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.TipoPendencia; + +public class ArchivoIntegracionECFReducaoZ { + + private List listAgpEcf; + private List listAgpRedZ; + + private List listEcfValidos; + private List listRedZValidos; + + private List listEcfInvalidos; + private List listRedZInvalidos; + + public ArchivoIntegracionECFReducaoZ() { + listAgpEcf = new ArrayList(); + listAgpRedZ = new ArrayList(); + + listEcfValidos = new ArrayList(); + listRedZValidos = new ArrayList(); + + listEcfInvalidos = new ArrayList(); + listRedZInvalidos = new ArrayList(); + } + + public void importacionFiscalECFValidaReducaoZ(List listEcf, List listRedZ) { + + listAgpEcf = agruparEcf(listEcf); + listAgpRedZ = agruparReducaoZ(listRedZ); + + for (AgpImpressoraReducaoZVO agpRedZ : listAgpRedZ) { + + AgpImpressoraEcfVO agpEcf = buscaRegistroEcf(agpRedZ.getNumserie20(), agpRedZ.getDatamov()); + if (agpEcf == null) { + + for (ImportacionFiscalReducaoZVO reZ : agpRedZ.getItens()) { + reZ.setInconsistente(true); + listRedZInvalidos.add(reZ); + } + continue; + } + + BigDecimal valorEcf = BigDecimal.ZERO; + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + BigDecimal valorBoleto = UtiliteriasFiscal.arredondar(UtiliteriasFiscal.valorTotalItensECF(ecf)); + valorEcf = valorEcf.add(valorBoleto); + } + + String valorFormatado = UtiliteriasFiscal.formataZeroDecimal(valorEcf, 0); + valorEcf = new BigDecimal(valorFormatado); + + BigDecimal valorRedZ = agpRedZ.getItens().get(0).getVendabrutadiaria(); + for (ImportacionFiscalReducaoZVO reZ : agpRedZ.getItens()) { + + String tipoMovimento = reZ.getAliquota(); + if (tipoMovimento.equals(SituacaoTributaria.CANCELADO.getValue()) || + tipoMovimento.equals(SituacaoTributaria.DESCONTO.getValue())) { + BigDecimal valorTrib = reZ.getImposto(); + valorRedZ = valorRedZ.subtract(valorTrib); + } + } + + if (valorRedZ.compareTo(valorEcf) == 0) { + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + listEcfValidos.add(ecf); + } + + for (ImportacionFiscalReducaoZVO reZ : agpRedZ.getItens()) { + listRedZValidos.add(reZ); + } + + } else { + + if (valorRedZ.compareTo(valorEcf) > 0) { + + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + listEcfValidos.add(ecf); + } + + BigDecimal dif = valorRedZ.subtract(valorEcf); + for (ImportacionFiscalReducaoZVO reZv : agpRedZ.getItens()) { + BigDecimal vendabrutadiaria = reZv.getVendabrutadiaria().subtract(dif); + reZv.setVendabrutadiaria(vendabrutadiaria); + listRedZValidos.add(reZv); + } + + ImportacionFiscalReducaoZVO reZ = new ImportacionFiscalReducaoZVO(agpRedZ.getItens().get(0)); + reZ.setStatus(TipoPendencia.DIF_RED_Z.toString()); + reZ.setAliquota("01"); + reZ.setImposto(dif); + reZ.setVendabrutadiaria(dif); + reZ.setInconsistente(true); + + listRedZInvalidos.add(reZ); + + } else if (valorRedZ.compareTo(valorEcf) < 0) { + + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + listEcfValidos.add(ecf); + } + + BigDecimal dif = valorEcf.subtract(valorRedZ); + for (ImportacionFiscalReducaoZVO reZv : agpRedZ.getItens()) { + BigDecimal vendabrutadiaria = reZv.getVendabrutadiaria().add(dif); + reZv.setVendabrutadiaria(vendabrutadiaria); + listRedZValidos.add(reZv); + } + + ImportacionFiscalReducaoZVO reZ = new ImportacionFiscalReducaoZVO(agpRedZ.getItens().get(0)); + reZ.setStatus(TipoPendencia.DIF_ECF.toString()); + reZ.setAliquota("01"); + reZ.setImposto(dif); + reZ.setVendabrutadiaria(dif); + reZ.setInconsistente(true); + listRedZInvalidos.add(reZ); + } + } + } + } + + private AgpImpressoraEcfVO buscaRegistroEcf(String numserie20, String datamov) { + try { + int index = listAgpEcf.indexOf(new AgpImpressoraEcfVO(numserie20, datamov)); + return listAgpEcf.get(index); + } catch (ArrayIndexOutOfBoundsException e) { + } + return null; + } + + private List agruparReducaoZ(List list) { + + List agps = new ArrayList(); + + AgpImpressoraReducaoZVO atual = null; + for (ImportacionFiscalReducaoZVO redz : list) { + AgpImpressoraReducaoZVO novo = new AgpImpressoraReducaoZVO(redz.getNumserie20(), redz.getDatamov()); + + if (atual == null) { + atual = novo; + atual.getItens().add(redz); + + } else if (atual.equals(novo)) { + atual.getItens().add(redz); + + } else { + agps.add(atual); + atual = novo; + atual.getItens().add(redz); + } + } + + agps.add(atual); + + return agps; + } + + private List agruparEcf(List list) { + + List agps = new ArrayList(); + + AgpImpressoraEcfVO atual = null; + for (ImportacionFiscalVO ecf : list) { + AgpImpressoraEcfVO novo = new AgpImpressoraEcfVO(ecf.getNumImpressora(), ecf.getDataEmissao()); + + if (atual == null) { + atual = novo; + atual.getItens().add(ecf); + + } else if (atual.equals(novo)) { + atual.getItens().add(ecf); + + } else { + agps.add(atual); + atual = novo; + atual.getItens().add(ecf); + } + } + + agps.add(atual); + + return agps; + } + + public List getListAgpEcf() { + return listAgpEcf; + } + + public List getListAgpRedZ() { + return listAgpRedZ; + } + + public List getListEcfValidos() { + return listEcfValidos; + } + + public List getListRedZValidos() { + return listRedZValidos; + } + + public List getListEcfInvalidos() { + return listEcfInvalidos; + } + + public List getListRedZInvalidos() { + return listRedZInvalidos; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionNaoFiscal.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionNaoFiscal.java new file mode 100644 index 000000000..babba4ed0 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionNaoFiscal.java @@ -0,0 +1,94 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; + +public class ArchivoIntegracionNaoFiscal { + + private static Logger log = Logger.getLogger(ArchivoIntegracionNaoFiscal.class); + + private String cnpjFilial; + private Integer sequencial = 0; + + private List importacionNaoFiscalVOs; + + private StringBuilder getAberturaArquivo() { + StringBuilder aberturaArquivo = new StringBuilder(); + aberturaArquivo.append("0") //Identificador Registro = "0" + .append(DateUtil.getStringCurrentDate("yyyyMMdd")) //Data geração arquivo + .append(StringHelper.preencherStringEspacoEsquerda(cnpjFilial.replace("[^0-9]", ""), 14)) //Cnpj filial + .append(StringHelper.preencherStringEspacoEsquerda(null, 371)) //Brancos + .append(StringHelper.preencherZeroEsquerda((++sequencial).toString(), 6)) //Sequencial + .append(StringHelper.QUEBRA_LINHA); + return aberturaArquivo; + } + + private StringBuilder getHeaderArquivo() { + StringBuilder headerArquivo = new StringBuilder(); + for (ImportacionNaoFiscalVO importacionNaoFiscalVO : importacionNaoFiscalVOs) { + headerArquivo.append("1") //Identificador Registro = "1" + .append(DateUtil.getStringDate(importacionNaoFiscalVO.getFechorvta(),"yyyyMMdd")) //Data emissão documento + .append(StringHelper.preencherStringEspacoEsquerda(cnpjFilial.replace("[^0-9]", ""), 14)) //Cnpj filial + .append(StringHelper.preencherStringEspacoEsquerda(importacionNaoFiscalVO.getNumeroDocumento(), 9)) //Numero do Documento + .append(StringHelper.preencherStringEspacoEsquerda(null, 3)) //Série + .append(StringHelper.preencherStringEspacoEsquerda("SVP", 5)) //Prefixo = "SVP" + .append(StringHelper.preencherStringEsquerda(null, 6, "9")) //Codigo Cliente "999999" + .append(StringHelper.preencherStringEsquerda(null, 2, "9")) //Filial cliente="99" + .append(StringHelper.preencherStringEsquerda(null, 3, "9")) //Condição pagamento = "999" + .append(UtiliteriasFiscal.formataZeroDecimal(importacionNaoFiscalVO.getTotal(), 2, 14)) //Valor Total documento + .append(StringHelper.preencherStringEspacoEsquerda("REC", 3)) //Tipo = "REC" + .append(StringHelper.preencherStringEspacoEsquerda(importacionNaoFiscalVO.getTipoeventoextraId()+"", 10)) //Natureza + .append(StringHelper.preencherStringEspacoEsquerda(null, 316)) //Brancos + .append(StringHelper.preencherZeroEsquerda((++sequencial).toString(), 6)) //Sequencial + .append(StringHelper.QUEBRA_LINHA); + } + return headerArquivo; + } + + private StringBuilder getFechamentoArquivo() { + StringBuilder fechamentoArquivo = new StringBuilder(); + fechamentoArquivo.append("3") //Identificador Registro = "3" + .append(StringHelper.preencherZeroEsquerda((importacionNaoFiscalVOs.size())+"", 6)) //Qtde de Documentos gerados = 1 + .append(StringHelper.preencherZeroEsquerda((importacionNaoFiscalVOs.size())+"", 6)) //Qtde de Itens Documentos gerados = 2 + .append(StringHelper.preencherStringEspacoEsquerda(null, 381)) //Brancos + .append(StringHelper.preencherZeroEsquerda((++sequencial).toString(), 6)); //Sequencial + return fechamentoArquivo; + } + + public File gerarArquivo(String cnpjFilial, List importacionNaoFiscalVOs) throws BusinessException { + try { + String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario() + "_" + Calendar.getInstance().getTime().getTime() + "_" + "naofiscal"; + File arquivo = File.createTempFile(nomeArquivo, ".tmp"); + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + /* Gerando arquivo */ + this.cnpjFilial = cnpjFilial; + this.importacionNaoFiscalVOs = importacionNaoFiscalVOs; + gravarArq.print(getAberturaArquivo()); + gravarArq.print(getHeaderArquivo()); + gravarArq.print(getFechamentoArquivo()); + + gravarArq.close(); + + return arquivo; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionReducaoZ.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionReducaoZ.java new file mode 100644 index 000000000..2aa2f6c41 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionReducaoZ.java @@ -0,0 +1,188 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; + +public class ArchivoIntegracionReducaoZ { + + private static Logger log = Logger.getLogger(ArchivoIntegracionReducaoZ.class); + + public File importacionReducaoZ(Date inicio, Date fim, Empresa empresa, boolean isPendencias, List listReducao) { + + try { + String nomeArquivo = "fiscal_reducao_z_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + if (isPendencias) + nomeArquivo = "fiscal_pendencia_reducao_z_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + + File arquivo = File.createTempFile(nomeArquivo, ".txt"); + + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + Integer seq = 1; + + String cnpjFilial = StringHelper.retornaSomenteNumeros(empresa.getCnpj() == null ? StringHelper.preencherStringEspacoEsquerda(null, 14) : empresa.getCnpj()); + String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371); + String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), UtiliteriasFiscal.DATE_FORMAT_FISCAL); + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String abertura = UtiliteriasFiscal.aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, sequencial); + gravarArq.print(abertura + UtiliteriasFiscal.QUEBRA_LINHA); + + List list = null; + if (isPendencias) { + list = listReducao; + } else { + list = agruparReducaoZ(listReducao); + } + + for (ImportacionFiscalReducaoZVO ifrZ : list) { + + String dataMovimento = ifrZ.getDatamov(); + String cnpj = StringHelper.retornaSomenteNumeros(ifrZ.getCnpj() == null ? StringHelper.preencherStringEspacoEsquerda(null, 14) : ifrZ.getCnpj()); + + String impAliquota = ifrZ.getAliquota() == null ? "" : ifrZ.getAliquota().substring(0, 2); + String numRelatorio = StringHelper.preencherZeroEsquerda(impAliquota, 6); + + String numPDV = StringHelper.preencherStringEspacoEsquerda(ifrZ.getNumpdv(), 10); + String numSeriePDV = StringHelper.preencherStringEspacoEsquerda(ifrZ.getNumserie20(), 20); + String numReducaoZ = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCrz(), 5); + + String gtInicial = StringHelper.preencherZeroEsquerda(ifrZ.getGtInicial().toString(), 18); + String gtFinal = StringHelper.preencherZeroEsquerda(ifrZ.getGtFinal().toString(), 18); + + String docFiscalInic = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCooinicial(), 9); + String docFiscalFinal = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCoofinal(), 9); + + String valorCancel = StringHelper.preencherZeroEsquerda(null, 8); + String valorContabil = StringHelper.preencherZeroEsquerda(ifrZ.getVendabrutadiaria().toString(), 14); + + String subtributaria = StringHelper.preencherZeroEsquerda(null, 14); + String descontos = StringHelper.preencherZeroEsquerda(null, 14); + String isento = StringHelper.preencherZeroEsquerda(null, 14); + + String valorNaoTributado = ifrZ.getValorNaoTributado() == null ? "" : ifrZ.getValorNaoTributado().toString(); + String naoTributado = StringHelper.preencherZeroEsquerda(valorNaoTributado, 14); + + String aliquota = StringHelper.preencherZeroEsquerda(null, 14); + if (ifrZ.getAliquota().length() == 7 && ifrZ.getAliquota().substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + aliquota = ifrZ.getAliquota().substring(3, 7); + aliquota = StringHelper.preencherZeroEsquerda(aliquota, 14); + } + + String aliquota2 = StringHelper.preencherZeroEsquerda(null, 14); + String aliquota3 = StringHelper.preencherZeroEsquerda(null, 14); + String aliquota4 = StringHelper.preencherZeroEsquerda(null, 14); + + String coo = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCoo(), 6); + String outrosRecebimentos = StringHelper.preencherZeroEsquerda(null, 14); + + BigDecimal aliquotaCalc = BigDecimal.valueOf(Double.valueOf(aliquota) / UtiliteriasFiscal.CEM.doubleValue()); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = UtiliteriasFiscal.arredondar(ifrZ.getImposto().divide(UtiliteriasFiscal.CEM)); + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + String impostoDebitado = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 13); + + String dataReducaoZ = ifrZ.getDatareducao(); + String horaReducaoZ = ifrZ.getHorareducao(); + + String valorDocFiscal = StringHelper.preencherZeroEsquerda(ifrZ.getImposto().toString(), 13); + + String brancos = StringHelper.preencherStringEspacoEsquerda(null, 72); + String status = StringHelper.preencherStringEspacoEsquerda(null, 10); + if (isPendencias) + status = StringHelper.preencherStringEspacoEsquerda(ifrZ.getStatus(), 10); + + seq++; + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String redZ = UtiliteriasFiscal.reducaoZ("1", dataMovimento, cnpj, numRelatorio, numPDV, numSeriePDV, numReducaoZ, + gtInicial, gtFinal, docFiscalInic, docFiscalFinal, valorCancel, valorContabil, subtributaria, + descontos, isento, naoTributado, aliquota, aliquota2, aliquota3, aliquota4, coo, outrosRecebimentos, + impostoDebitado, dataReducaoZ, horaReducaoZ, valorDocFiscal, status, brancos, sequencial); + gravarArq.print(redZ + UtiliteriasFiscal.QUEBRA_LINHA); + } + + Integer qtdeDoc = seq - 1; + seq++; + + String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdeDoc.toString(), 6); + String brancos387 = StringHelper.preencherStringEspacoEsquerda(null, 387); + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String fechamento = UtiliteriasFiscal.fechamentoDeArquivo("3", qtdeDocGerados, null, brancos387, sequencial); + gravarArq.print(fechamento + UtiliteriasFiscal.QUEBRA_LINHA); + + gravarArq.close(); + return arquivo; + + } catch (IOException e) { + log.error("", e); + } + + return null; + } + + private List agruparReducaoZ(List list) { + + List aux = new ArrayList(); + + BigDecimal valorNaoTributado = null; + BigDecimal valorNaoIncluido = BigDecimal.ZERO; + + ImportacionFiscalReducaoZVO item = null; + + for (ImportacionFiscalReducaoZVO ifr : list) { + + if (!ifr.equals(item)) { + valorNaoIncluido = BigDecimal.ZERO; + item = ifr; + } + + String tipoMovimento = ifr.getAliquota(); + if (tipoMovimento.equals(SituacaoTributaria.CANCELADO.getValue()) || + tipoMovimento.equals(SituacaoTributaria.DESCONTO.getValue())) { + + valorNaoIncluido = valorNaoIncluido.add(ifr.getImposto()); + ifr.setValorNaoIncluido(valorNaoIncluido); + + } else if (tipoMovimento.equals(SituacaoTributaria.NAO_TRIBUTADO.getValue())) { + valorNaoTributado = ifr.getImposto(); + } else { + + ifr.setValorNaoTributado(valorNaoTributado); + ifr.setValorNaoIncluido(valorNaoIncluido); + + BigDecimal valorReducaoZ = ifr.getVendabrutadiaria().subtract(valorNaoIncluido); + ifr.setVendabrutadiaria(valorReducaoZ); + + aux.add(ifr); + + } + } + + return aux; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ValidaIntegracionECFRedZxls.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ValidaIntegracionECFRedZxls.java new file mode 100644 index 000000000..9496baa99 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ValidaIntegracionECFRedZxls.java @@ -0,0 +1,410 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +public class ValidaIntegracionECFRedZxls { + + private List listEcf; + private List listRedZ; + + public static void main(String[] args) { + ValidaIntegracionECFRedZxls ss = new ValidaIntegracionECFRedZxls(); + ss.executar(); + } + + private void executar() { + + listEcf = verificaArquivoEcf(); + listRedZ = verificaArquivoRedZ(); + + try { + + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("EMPRESA"); + row.createCell(1).setCellValue("DATA_MOVIMENTO"); + row.createCell(2).setCellValue("SERIE"); + row.createCell(3).setCellValue("PDV"); + row.createCell(4).setCellValue("NUMERO_BILHETES"); + row.createCell(5).setCellValue("VALOR_ECF"); + row.createCell(6).setCellValue("VALOR_REDUCAO_Z"); + row.createCell(7).setCellValue("STATUS_DIFERENÇA"); + + for (FiscalVO ecf : listEcf) { + + RedZVO redz = buscaRegistroRedZ(ecf.getNumserie20(), ecf.getDatamov()); + boolean isValoresIguais = true; + + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("UTIL"); + row.createCell(1).setCellValue(ecf.getDatamov()); + row.createCell(2).setCellValue(redz.getNumserie20()); + row.createCell(3).setCellValue(ecf.getPdv()); + row.createCell(4).setCellValue(ecf.getQuantidade()); + row.createCell(5).setCellValue(ecf.getValorTotal().doubleValue()); + row.createCell(6).setCellValue(redz.getValorTotal().doubleValue()); + + if (!redz.getValorTotal().equals(ecf.getValorTotal())) { + isValoresIguais = false; + } + + if (isValoresIguais) { + row.createCell(7).setCellValue("VALIDO"); + System.out.println(" VALIDO ---- SERIE: " + redz.getNumserie20() + " DATAMOV: " + ecf.getDatamov() + " VALOR ECF: " + ecf.getValorTotal() + " VALOR RED Z: " + redz.getValorTotal() + " CONT: " + ecf.getQuantidade() + " PDV: " + ecf.getPdv()); + } else { + row.createCell(7).setCellValue("INVALIDO"); + System.out.println(" !!! INVALIDO ---- SERIE: " + redz.getNumserie20() + " DATAMOV: " + ecf.getDatamov() + " VALOR ECF: " + ecf.getValorTotal() + " VALOR RED Z: " + redz.getValorTotal() + " CONT: " + ecf.getQuantidade() + " PDV: " + ecf.getPdv()); + } + + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + File arquivo = new File("C:\\Users\\rjgw\\Desktop\\dif.xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + + private RedZVO buscaRegistroRedZ(String numserie20, String datamov) { + try { + int index = listRedZ.indexOf(new RedZVO(datamov, numserie20)); + return listRedZ.get(index); + } catch (ArrayIndexOutOfBoundsException e) { + } + return null; + } + + public List verificaArquivoRedZ() { + + List list = new ArrayList(); + + File arquivoTxt = new File("C:\\Users\\rjgw\\Desktop\\fiscal_reducao_z_201606240529438877750410577735828.txt"); + BufferedReader br; + + try { + br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + + RedZVO atual = null; + while (linha != null) { + + if (linha.startsWith("1")) { + + String datamov = linha.substring(1, 9).trim(); + String numserie20 = linha.substring(39, 60).trim(); + RedZVO novo = new RedZVO(datamov, numserie20); + novo.setPdv(linha.substring(56, 60).trim()); + + String valor = linha.substring(128, 140).trim(); + try { + novo.setValorTotal(new BigDecimal(valor)); + } catch (Exception e) { + } + + if (atual == null) { + atual = novo; + + } else if (atual.equals(novo)) { + + } else { + list.add(atual); + atual = novo; + + } + } + + linha = br.readLine(); + } + + list.add(atual); + + br.close(); + + return list; + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } + + public List verificaArquivoEcf() { + + List list = new ArrayList(); + + File arquivoTxt = new File("C:\\Users\\rjgw\\Desktop\\fiscal_ecf_201606240529405088610479025318030.txt"); + BufferedReader br; + + try { + br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + int cont = 0; + + FiscalVO atual = null; + while (linha != null) { + + if (linha.startsWith("1")) { + + String datamov = linha.substring(1, 9).trim(); + String pdv = linha.substring(32, 35).trim(); + FiscalVO novo = new FiscalVO(datamov, pdv); + + String valor = linha.substring(56, 70).trim(); + + if (atual == null) { + atual = novo; + atual.soma(valor); + cont++; + + } else if (atual.equals(novo)) { + atual.soma(valor); + cont++; + } else { + atual.setQuantidade(cont); + list.add(atual); + + cont = 0; + + atual = novo; + atual.soma(valor); + cont++; + } + } + + if (linha.startsWith("2")) { + atual.setNumserie20(linha.substring(212, 232).trim()); + } + + linha = br.readLine(); + } + + list.add(atual); + + br.close(); + + return list; + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } + + public class RedZVO { + private String datamov; + private String pdv; + private String numserie20; + private BigDecimal valorTotal; + + public RedZVO(String datamov, String numserie20) { + this.datamov = datamov; + this.numserie20 = numserie20; + this.valorTotal = BigDecimal.ZERO; + } + + public void soma(String valor) { + BigDecimal vl = new BigDecimal(valor); + this.valorTotal = valorTotal.add(vl); + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public String getPdv() { + return pdv; + } + + public void setPdv(String pdv) { + this.pdv = pdv; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((numserie20 == null) ? 0 : numserie20.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + RedZVO other = (RedZVO) obj; + if (!getOuterType().equals(other.getOuterType())) + return false; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (numserie20 == null) { + if (other.numserie20 != null) + return false; + } else if (!numserie20.equals(other.numserie20)) + return false; + return true; + } + + private ValidaIntegracionECFRedZxls getOuterType() { + return ValidaIntegracionECFRedZxls.this; + } + + } + + public class FiscalVO { + private String datamov; + private String pdv; + private String numserie20; + private BigDecimal valorTotal; + private int quantidade; + + public FiscalVO(String datamov, String pdv) { + super(); + this.datamov = datamov; + this.pdv = pdv; + this.valorTotal = BigDecimal.ZERO; + this.quantidade = 0; + } + + public void soma(String valor) { + BigDecimal vl = new BigDecimal(valor); + this.valorTotal = valorTotal.add(vl); + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public int getQuantidade() { + return quantidade; + } + + public void setQuantidade(int quantidade) { + this.quantidade = quantidade; + } + + public String getPdv() { + return pdv; + } + + public void setPdv(String pdv) { + this.pdv = pdv; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((pdv == null) ? 0 : pdv.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalVO other = (FiscalVO) obj; + if (!getOuterType().equals(other.getOuterType())) + return false; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (pdv == null) { + if (other.pdv != null) + return false; + } else if (!pdv.equals(other.pdv)) + return false; + return true; + } + + private ValidaIntegracionECFRedZxls getOuterType() { + return ValidaIntegracionECFRedZxls.this; + } + + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/seguridad/Base64.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/seguridad/Base64.java new file mode 100644 index 000000000..dbf06aa71 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/seguridad/Base64.java @@ -0,0 +1,203 @@ +/* + * @(#)Base64.java 1.3 01/12/03 + * + * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ +package com.rjconsultores.ventaboletos.utilerias.seguridad; + +/** + * Static methods for translating Base64 encoded strings to byte arrays and vice-versa. + * + * @author Josh Bloch + * @version 1.3, 12/03/01 + * @see Preferences + * @since 1.4 + */ +public class Base64 { + + /** + * Translates the specified byte array into a Base64 string as per Preferences.put(byte[]). + */ + public static String byteArrayToBase64(byte[] a) { + return byteArrayToBase64(a, false); + } + + /** + * Translates the specified byte array into an "aternate representation" Base64 string. This non-standard variant uses an alphabet that does not contain the uppercase alphabetic characters, which makes it suitable for use in situations where case-folding occurs. + */ + public static String byteArrayToAltBase64(byte[] a) { + return byteArrayToBase64(a, true); + } + + private static String byteArrayToBase64(byte[] a, boolean alternate) { + int aLen = a.length; + int numFullGroups = aLen / 3; + int numBytesInPartialGroup = aLen - 3 * numFullGroups; + int resultLen = 4 * ((aLen + 2) / 3); + StringBuffer result = new StringBuffer(resultLen); + char[] intToAlpha = (alternate ? intToAltBase64 : intToBase64); + + // Translate all full groups from byte array elements to Base64 + int inCursor = 0; + for (int i = 0; i < numFullGroups; i++) { + int byte0 = a[inCursor++] & 0xff; + int byte1 = a[inCursor++] & 0xff; + int byte2 = a[inCursor++] & 0xff; + result.append(intToAlpha[byte0 >> 2]); + result.append(intToAlpha[(byte0 << 4) & 0x3f | (byte1 >> 4)]); + result.append(intToAlpha[(byte1 << 2) & 0x3f | (byte2 >> 6)]); + result.append(intToAlpha[byte2 & 0x3f]); + } + + // Translate partial group if present + if (numBytesInPartialGroup != 0) { + int byte0 = a[inCursor++] & 0xff; + result.append(intToAlpha[byte0 >> 2]); + if (numBytesInPartialGroup == 1) { + result.append(intToAlpha[(byte0 << 4) & 0x3f]); + result.append("=="); + } else { + // assert numBytesInPartialGroup == 2; + int byte1 = a[inCursor++] & 0xff; + result.append(intToAlpha[(byte0 << 4) & 0x3f | (byte1 >> 4)]); + result.append(intToAlpha[(byte1 << 2) & 0x3f]); + result.append('='); + } + } + // assert inCursor == a.length; + // assert result.length() == resultLen; + return result.toString(); + } + + /** + * This array is a lookup table that translates 6-bit positive integer index values into their "Base64 Alphabet" equivalents as specified in Table 1 of RFC 2045. + */ + private static final char intToBase64[] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' + }; + /** + * This array is a lookup table that translates 6-bit positive integer index values into their "Alternate Base64 Alphabet" equivalents. This is NOT the real Base64 Alphabet as per in Table 1 of RFC 2045. This alternate alphabet does not use the capital letters. It is designed for use in environments where "case folding" occurs. + */ + private static final char intToAltBase64[] = { + '!', '"', '#', '$', '%', '&', '\'', '(', ')', ',', '-', '.', ':', + ';', '<', '>', '@', '[', ']', '^', '`', '_', '{', '|', '}', '~', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '?' + }; + + /** + * Translates the specified Base64 string (as per Preferences.get(byte[])) into a byte array. + * + * @throw IllegalArgumentException if s is not a valid Base64 string. + */ + public static byte[] base64ToByteArray(String s) { + return base64ToByteArray(s, false); + } + + /** + * Translates the specified "aternate representation" Base64 string into a byte array. + * + * @throw IllegalArgumentException or ArrayOutOfBoundsException if s is not a valid alternate representation Base64 string. + */ + public static byte[] altBase64ToByteArray(String s) { + return base64ToByteArray(s, true); + } + + private static byte[] base64ToByteArray(String s, boolean alternate) { + byte[] alphaToInt = (alternate ? altBase64ToInt : base64ToInt); + int sLen = s.length(); + int numGroups = sLen / 4; + if (4 * numGroups != sLen) { + throw new IllegalArgumentException( + "String length must be a multiple of four."); + } + int missingBytesInLastGroup = 0; + int numFullGroups = numGroups; + if (sLen != 0) { + if (s.charAt(sLen - 1) == '=') { + missingBytesInLastGroup++; + numFullGroups--; + } + if (s.charAt(sLen - 2) == '=') { + missingBytesInLastGroup++; + } + } + byte[] result = new byte[3 * numGroups - missingBytesInLastGroup]; + + // Translate all full groups from base64 to byte array elements + int inCursor = 0, outCursor = 0; + for (int i = 0; i < numFullGroups; i++) { + int ch0 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch1 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch2 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch3 = base64toInt(s.charAt(inCursor++), alphaToInt); + result[outCursor++] = (byte) ((ch0 << 2) | (ch1 >> 4)); + result[outCursor++] = (byte) ((ch1 << 4) | (ch2 >> 2)); + result[outCursor++] = (byte) ((ch2 << 6) | ch3); + } + + // Translate partial group, if present + if (missingBytesInLastGroup != 0) { + int ch0 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch1 = base64toInt(s.charAt(inCursor++), alphaToInt); + result[outCursor++] = (byte) ((ch0 << 2) | (ch1 >> 4)); + + if (missingBytesInLastGroup == 1) { + int ch2 = base64toInt(s.charAt(inCursor++), alphaToInt); + result[outCursor++] = (byte) ((ch1 << 4) | (ch2 >> 2)); + } + } + return result; + } + + /** + * Translates the specified character, which is assumed to be in the "Base 64 Alphabet" into its equivalent 6-bit positive integer. + * + * @throw IllegalArgumentException or ArrayOutOfBoundsException if c is not in the Base64 Alphabet. + */ + private static int base64toInt(char c, byte[] alphaToInt) { + int result = alphaToInt[c]; + if (result < 0) { + throw new IllegalArgumentException("Illegal character " + c); + } + return result; + } + + /** + * This array is a lookup table that translates unicode characters drawn from the "Base64 Alphabet" (as specified in Table 1 of RFC 2045) into their 6-bit positive integer equivalents. Characters that are not in the Base64 alphabet but fall within the bounds of the array are translated to -1. + */ + private static final byte base64ToInt[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 + }; + /** + * This array is the analogue of base64ToInt, but for the nonstandard variant that avoids the use of uppercase alphabetic characters. + */ + private static final byte altBase64ToInt[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, + 2, 3, 4, 5, 6, 7, 8, -1, 62, 9, 10, 11, -1, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 12, 13, 14, -1, 15, 63, 16, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 17, -1, 18, 19, 21, 20, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 22, 23, 24, 25 + }; + + public static void main(String args[]) { + Integer i = new Integer(-1); + Short s = i.shortValue(); + System.out.println(s); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/seguridad/ContrasenaUtileria.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/seguridad/ContrasenaUtileria.java new file mode 100644 index 000000000..d4eb39d26 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/seguridad/ContrasenaUtileria.java @@ -0,0 +1,75 @@ +package com.rjconsultores.ventaboletos.utilerias.seguridad; + +import java.io.File; +import java.net.URL; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Locale; +import java.util.regex.Pattern; + +import org.zkoss.util.resource.LabelLocator; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public class ContrasenaUtileria { + private static final int CANT_MIN_CARACTER = 8; + private static final int CANT_MIN_NUMERO = 1; + private static final int CANT_MIN_LETRA = 1; + private static final int CANT_ESPECIALES = 2; + + private static Pattern patternHayNumero = Pattern.compile(".*[0-9]+.*"); + private static Pattern patternHayLetra = Pattern.compile(".*[a-zA-Z]+.*"); + private static Pattern patternHayEspeciales = Pattern.compile(".*[^\\w]+.*[^\\w]+.*"); + + public static String encriptarContrasena(String contrasena){ + MessageDigest md; + try { + md = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + + byte[] pass = md.digest(contrasena.getBytes()); + return Base64.byteArrayToBase64(pass); + } + public static void validarContrasenaCompleja(String contrasena) throws BusinessException{ + int length = contrasena.length(); + + if (length< CANT_MIN_CARACTER){ + throw new BusinessException("complejidadContrasena.CANT_MIN_CARACTER", new Object[]{CANT_MIN_CARACTER}); + } + + if (!patternHayLetra.matcher(contrasena).find()){ + throw new BusinessException("complejidadContrasena.CANT_MIN_LETRA", new Object[]{CANT_MIN_LETRA}); + } + + if (!patternHayNumero.matcher(contrasena).find()){ + throw new BusinessException("complejidadContrasena.CANT_MIN_NUMERO", new Object[]{CANT_MIN_NUMERO}); + } + + if (!patternHayEspeciales.matcher(contrasena).find()){ + throw new BusinessException("complejidadContrasena.CANT_ESPECIALES", new Object[]{CANT_ESPECIALES}); + } + } + public static void main(String args[]){ + System.out.println(ContrasenaUtileria.encriptarContrasena("gleimar")); + + LabelLocator teste = new LabelLocator() { + + @Override + public URL locate(Locale arg0) throws Exception { + return new File("E:/scia_ventaboletos_transpais_senda/sco/AdmVenta/Web/trunk/ventaboletos/web/WEB-INF/i3-label_pt_BR.label").toURI().toURL(); + } + }; + Labels.register(teste); + try { + ContrasenaUtileria.validarContrasenaCompleja("asdfasdf1@@"); + System.out.println("ok"); + } catch (BusinessException e) { + System.out.println(e.getLocalizedMessage()); + } + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/MyAnnotationSessionFactoryBean.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/MyAnnotationSessionFactoryBean.java new file mode 100644 index 000000000..aa6f26ed1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/MyAnnotationSessionFactoryBean.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.utilerias.spring; + +import org.hibernate.HibernateException; +import org.hibernate.cfg.AnnotationConfiguration; +import org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean; + +import com.rjconsultores.ventaboletos.dao.hibernate.sqlfunction.FnArredondamentoTarifa; + +public class MyAnnotationSessionFactoryBean extends AnnotationSessionFactoryBean{ + + public MyAnnotationSessionFactoryBean() { + super(); + } + + + @Override + protected void postProcessAnnotationConfiguration(AnnotationConfiguration config) throws HibernateException { + config.addSqlFunction("FN_ARREDONDAMENTO_TARIFA", new FnArredondamentoTarifa()); + } +} + diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiGrantedAuthority.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiGrantedAuthority.java new file mode 100644 index 000000000..2fa1a0a1c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiGrantedAuthority.java @@ -0,0 +1,23 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.utilerias.spring.security; + +import org.springframework.security.core.GrantedAuthority; + +/** + * @author gleimar + * + */ +public interface MiGrantedAuthority extends GrantedAuthority { + /** + * Indica si para el permiso actual tienes acceso de lectura y escrita. + * + * + * @return + * true - Acceso de lectura y escrita
+ * false - Acceso de lectura
+ * + */ + public boolean fullAccess(); +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiPasswordEncoder.java b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiPasswordEncoder.java new file mode 100644 index 000000000..302ba16f3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiPasswordEncoder.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.utilerias.spring.security; + +import org.springframework.dao.DataAccessException; +import org.springframework.security.authentication.encoding.PasswordEncoder; + +import com.rjconsultores.ventaboletos.utilerias.seguridad.ContrasenaUtileria; + +public class MiPasswordEncoder implements PasswordEncoder { + + @Override + public String encodePassword(String pwd, Object salt) throws DataAccessException { + + return ContrasenaUtileria.encriptarContrasena(pwd); + + } + + @Override + public boolean isPasswordValid(String encPass, String pwd, Object salt) throws DataAccessException { + return encodePassword(pwd, salt).equals(encPass); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/version/model/entidadesAdmVta.version b/modelWeb/src/com/rjconsultores/ventaboletos/version/model/entidadesAdmVta.version new file mode 100644 index 000000000..78d70ae1d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/version/model/entidadesAdmVta.version @@ -0,0 +1 @@ +entidadesAdmVta_20120227_1RC17 \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/aidf/AidfVo.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/aidf/AidfVo.java new file mode 100644 index 000000000..e9a6e7e4d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/aidf/AidfVo.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.vo.aidf; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +public class AidfVo { + + private Long aidfId; + private AidfTipo aidfTipo; + private Integer aidfEspecieId; + private Integer estadoId; + private String docfiscal; + private String acfiscal; + private String serie; + private String subserie; + private String forminicial; + private String formfinal; + private Date fecadquisicion; + private Date fecvencimiento; + private String inscestadual; + private Integer empresaId; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private String cnpj; + private String tipoValidaVenta; + public Long getAidfId() { + return aidfId; + } + public void setAidfId(Long aidfId) { + this.aidfId = aidfId; + } + public AidfTipo getAidfTipo() { + return aidfTipo; + } + public void setAidfTipo(AidfTipo aidfTipo) { + this.aidfTipo = aidfTipo; + } + public Integer getAidfEspecieId() { + return aidfEspecieId; + } + public void setAidfEspecieId(Integer aidfEspecieId) { + this.aidfEspecieId = aidfEspecieId; + } + public Integer getEstadoId() { + return estadoId; + } + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + public String getDocfiscal() { + return docfiscal; + } + public void setDocfiscal(String docfiscal) { + this.docfiscal = docfiscal; + } + public String getAcfiscal() { + return acfiscal; + } + public void setAcfiscal(String acfiscal) { + this.acfiscal = acfiscal; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } + public String getSubserie() { + return subserie; + } + public void setSubserie(String subserie) { + this.subserie = subserie; + } + public String getForminicial() { + return forminicial; + } + public void setForminicial(String forminicial) { + this.forminicial = forminicial; + } + public String getFormfinal() { + return formfinal; + } + public void setFormfinal(String formfinal) { + this.formfinal = formfinal; + } + public Date getFecadquisicion() { + return fecadquisicion; + } + public void setFecadquisicion(Date fecadquisicion) { + this.fecadquisicion = fecadquisicion; + } + public Date getFecvencimiento() { + return fecvencimiento; + } + public void setFecvencimiento(Date fecvencimiento) { + this.fecvencimiento = fecvencimiento; + } + public String getInscestadual() { + return inscestadual; + } + public void setInscestadual(String inscestadual) { + this.inscestadual = inscestadual; + } + public Integer getEmpresaId() { + return empresaId; + } + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getCnpj() { + return cnpj; + } + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + public String getTipoValidaVenta() { + return tipoValidaVenta; + } + public void setTipoValidaVenta(String tipoValidaVenta) { + this.tipoValidaVenta = tipoValidaVenta; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ClientePacoteVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ClientePacoteVO.java new file mode 100644 index 000000000..11d9ef91d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ClientePacoteVO.java @@ -0,0 +1,174 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +import com.rjconsultores.ventaboletos.enums.TipoPessoa; + +@XmlRootElement(name = "cliente") +@XmlType(propOrder = {"razaoSocial", "cpfCnpj", "tipoPessoa", "descemail", "desctelefone", "descfax", "endereco", "numero", "complemento", + "bairro", "cidade", "estado", "cep", "pais"}) +public class ClientePacoteVO { + + private Long vendapacoteId; + private String razaoSocial; + private String cpfCnpj; + private String tipoPessoa; + private String descemail; + private String desctelefone; + private String descfax; + private String endereco; + private String numero; + private String complemento; + private String bairro; + private String cidade; + private String estado; + private String cep; + private String pais; + + public ClientePacoteVO() { + super(); + } + + public ClientePacoteVO(String razaoSocial, String cpfCnpj, TipoPessoa tipoPessoa, String descemail, String desctelefone, String descfax, String cep, + String endereco, String numero, String complemento, String pais, String estado, String cidade, String bairro) { + this(); + setRazaoSocial(razaoSocial); + setCpfCnpj(cpfCnpj); + setTipoPessoa(tipoPessoa.toString()); + setDescemail(descemail); + setDesctelefone(desctelefone); + setDescfax(descfax); + setCep(cep); + setEndereco(endereco); + setNumero(numero); + setComplemento(complemento); + setPais(pais); + setEstado(estado); + setCidade(cidade); + setBairro(bairro); + } + + public String getRazaoSocial() { + return razaoSocial; + } + + public void setRazaoSocial(String razaoSocial) { + this.razaoSocial = razaoSocial; + } + + public String getCpfCnpj() { + return cpfCnpj; + } + + public void setCpfCnpj(String cpfCnpj) { + this.cpfCnpj = cpfCnpj; + } + + public String getTipoPessoa() { + return tipoPessoa; + } + + public void setTipoPessoa(String tipoPessoa) { + this.tipoPessoa = tipoPessoa; + } + + public String getDescemail() { + return descemail; + } + + public void setDescemail(String descemail) { + this.descemail = descemail; + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + public String getDescfax() { + return descfax; + } + + public void setDescfax(String descfax) { + this.descfax = descfax; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getPais() { + return pais; + } + + public void setPais(String pais) { + this.pais = pais; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/DadosBancarioVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/DadosBancarioVO.java new file mode 100644 index 000000000..05be11d9b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/DadosBancarioVO.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "dadosBancarios") +@XmlType(propOrder = {"banco", "identificadorDeposito"}) +public class DadosBancarioVO { + + private String banco; + private String identificadorDeposito; + + public String getBanco() { + return banco; + } + + public void setBanco(String banco) { + this.banco = banco; + } + + public String getIdentificadorDeposito() { + return identificadorDeposito; + } + + public void setIdentificadorDeposito(String identificadorDeposito) { + this.identificadorDeposito = identificadorDeposito; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/EnderecoApanheVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/EnderecoApanheVO.java new file mode 100644 index 000000000..e51d9647f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/EnderecoApanheVO.java @@ -0,0 +1,94 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "pacote") +@XmlType(propOrder = { "local", "cep", "endereco", "cidade", "numero", "bairro", "complemento", "referencia" }) +public class EnderecoApanheVO { + + private Long vendapacoteId; + private String local; + private String cep; + private String endereco; + private String cidade; + private String numero; + private String bairro; + private String complemento; + private String referencia; + + public String getLocal() { + return local; + } + + public void setLocal(String local) { + this.local = local; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getReferencia() { + return referencia; + } + + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ItemAdicionalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ItemAdicionalVO.java new file mode 100644 index 000000000..840cccf05 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ItemAdicionalVO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement +@XmlType(propOrder = {"descitemadicional"}) +public class ItemAdicionalVO { + + private Long itemadicionalId; + private String descitemadicional; + private Long vendapacoteId; + + public String getDescitemadicional() { + return descitemadicional; + } + + public void setDescitemadicional(String descitemadicional) { + this.descitemadicional = descitemadicional; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + @XmlTransient + public Long getItemadicionalId() { + return itemadicionalId; + } + + public void setItemadicionalId(Long itemadicionalId) { + this.itemadicionalId = itemadicionalId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/NotaCreditoVendaPacoteVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/NotaCreditoVendaPacoteVO.java new file mode 100644 index 000000000..e53d65990 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/NotaCreditoVendaPacoteVO.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "notacredito") +@XmlType(propOrder = { "vouchernotacredito", "numoperacaopacotecancelamento" }) +public class NotaCreditoVendaPacoteVO { + + private String numoperacaopacotecancelamento; + private Long vouchernotacredito; + + public String getNumoperacaopacotecancelamento() { + return numoperacaopacotecancelamento; + } + + public void setNumoperacaopacotecancelamento(String numoperacaopacotecancelamento) { + this.numoperacaopacotecancelamento = numoperacaopacotecancelamento; + } + + public Long getVouchernotacredito() { + return vouchernotacredito; + } + + public void setVouchernotacredito(Long vouchernotacredito) { + this.vouchernotacredito = vouchernotacredito; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PacoteVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PacoteVO.java new file mode 100644 index 000000000..1b1371b9f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PacoteVO.java @@ -0,0 +1,277 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "pacote") +@XmlType(propOrder = { "numoperacao", "datavenda", "datapacote", "nompacote", "pacoteId", "descpacote", "usuariovenda", "status", "pontoVenda", "empresa", "quantidade", + "totalTarifa", "totalSeguro", "totalOutros", "totalPedagio", "totalTaxaEmbarque", "valorsubtotal", "valortotal", "valordesconto", + "formaspagamento", "servico", "pax", "enderecoApanhe", "clientePacote", "itens" }) +public class PacoteVO { + + private Long vendapacoteId; + private Date datapacote; + private Date datavenda; + private Long pacoteId; + private String nompacote; + private String descpacote; + private String numoperacao; + private Integer usuariovenda; + private String status; + private String pontoVenda; + private String empresa; + private Integer quantidade = 0; + private BigDecimal totalTarifa = BigDecimal.ZERO; + private BigDecimal totalSeguro = BigDecimal.ZERO; + private BigDecimal totalOutros = BigDecimal.ZERO; + private BigDecimal totalPedagio = BigDecimal.ZERO; + private BigDecimal totalTaxaEmbarque = BigDecimal.ZERO; + + private BigDecimal valorsubtotal = BigDecimal.ZERO; + private BigDecimal valortotal = BigDecimal.ZERO; + private BigDecimal valordesconto = BigDecimal.ZERO; + + private ClientePacoteVO clientePacote; + private ServicoVO servico; + private EnderecoApanheVO enderecoApanhe; + + private List formaspagamento = new ArrayList(); + private List pax = new ArrayList(); + private List itens = new ArrayList(); + + /* Auxiliares */ + private Integer qtdePacoteFormaspago; + + public Integer getQuantidade() { + return quantidade; + } + + public void setQuantidade(Integer quantidade) { + this.quantidade = quantidade; + } + + public String getNumoperacao() { + return numoperacao; + } + + public void setNumoperacao(String numoperacao) { + this.numoperacao = numoperacao; + } + + public Integer getUsuariovenda() { + return usuariovenda; + } + + public void setUsuariovenda(Integer usuariovenda) { + this.usuariovenda = usuariovenda; + } + + public Date getDatavenda() { + return datavenda; + } + + public void setDatavenda(Date datavenda) { + this.datavenda = datavenda; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public BigDecimal getValortotal() { + return valortotal; + } + + public void setValortotal(BigDecimal valortotal) { + this.valortotal = valortotal; + } + + public BigDecimal getValordesconto() { + return valordesconto; + } + + public void setValordesconto(BigDecimal valordesconto) { + this.valordesconto = valordesconto; + } + + @XmlElementWrapper + @XmlElement(name = "pagamento", type = PagamentoVO.class) + public List getFormaspagamento() { + return formaspagamento; + } + + public void setFormaspagamento(List formaspagamento) { + this.formaspagamento = formaspagamento; + } + + public ServicoVO getServico() { + return servico; + } + + public void setServico(ServicoVO servico) { + this.servico = servico; + } + + @XmlElementWrapper + @XmlElement(name = "passageiro", type = PassageiroVO.class) + public List getPax() { + return pax; + } + + public void setPax(List pax) { + this.pax = pax; + } + + public Date getDatapacote() { + return datapacote; + } + + public void setDatapacote(Date datapacote) { + this.datapacote = datapacote; + } + + public String getPontoVenda() { + return pontoVenda; + } + + public void setPontoVenda(String pontoVenda) { + this.pontoVenda = pontoVenda; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public BigDecimal getValorsubtotal() { + return valorsubtotal; + } + + public void setValorsubtotal(BigDecimal valorsubtotal) { + this.valorsubtotal = valorsubtotal; + } + + public BigDecimal getTotalTarifa() { + return totalTarifa; + } + + public void setTotalTarifa(BigDecimal totalTarifa) { + this.totalTarifa = totalTarifa; + } + + public BigDecimal getTotalSeguro() { + return totalSeguro; + } + + public void setTotalSeguro(BigDecimal totalSeguro) { + this.totalSeguro = totalSeguro; + } + + public BigDecimal getTotalOutros() { + return totalOutros; + } + + public void setTotalOutros(BigDecimal totalOutros) { + this.totalOutros = totalOutros; + } + + public ClientePacoteVO getClientePacote() { + return clientePacote; + } + + public void setClientePacote(ClientePacoteVO clientePacote) { + this.clientePacote = clientePacote; + } + + public BigDecimal getTotalTaxaEmbarque() { + return totalTaxaEmbarque; + } + + public void setTotalTaxaEmbarque(BigDecimal totalTaxaEmbarque) { + this.totalTaxaEmbarque = totalTaxaEmbarque; + } + + public BigDecimal getTotalPedagio() { + return totalPedagio; + } + + public void setTotalPedagio(BigDecimal totalPedagio) { + this.totalPedagio = totalPedagio; + } + + public String getNompacote() { + return nompacote; + } + + public void setNompacote(String nompacote) { + this.nompacote = nompacote; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + public EnderecoApanheVO getEnderecoApanhe() { + return enderecoApanhe; + } + + public void setEnderecoApanhe(EnderecoApanheVO enderecoApanhe) { + this.enderecoApanhe = enderecoApanhe; + } + + @XmlTransient + public Integer getQtdePacoteFormaspago() { + return qtdePacoteFormaspago; + } + + public void setQtdePacoteFormaspago(Integer qtdePacoteFormaspago) { + this.qtdePacoteFormaspago = qtdePacoteFormaspago; + } + + public String getDescpacote() { + return descpacote; + } + + public void setDescpacote(String descpacote) { + this.descpacote = descpacote; + } + + @XmlElementWrapper + @XmlElement(name = "itemPacote", type = ItemAdicionalVO.class) + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + public Long getPacoteId() { + return pacoteId; + } + + public void setPacoteId(Long pacoteId) { + this.pacoteId = pacoteId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoCartaoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoCartaoVO.java new file mode 100644 index 000000000..11105fbdf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoCartaoVO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name="cartao") +public class PagamentoCartaoVO { + + private String bandeira; + private String numautorizacao; + private Integer parcelas; + + public String getBandeira() { + return bandeira; + } + public void setBandeira(String bandeira) { + this.bandeira = bandeira; + } + public String getNumautorizacao() { + return numautorizacao; + } + public void setNumautorizacao(String numautorizacao) { + this.numautorizacao = numautorizacao; + } + public Integer getParcelas() { + return parcelas; + } + public void setParcelas(Integer parcelas) { + this.parcelas = parcelas; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoVO.java new file mode 100644 index 000000000..b9600aa7b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoVO.java @@ -0,0 +1,88 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import java.math.BigDecimal; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "pagamento") +@XmlType(propOrder = { "formapagamento", "moeda", "valor", "notacredito", "cartao", "dadosBancario" }) +public class PagamentoVO { + + private String formapagamento; + private String moeda; + private BigDecimal valor; + private PagamentoCartaoVO cartao; + private DadosBancarioVO dadosBancario; + private Long vendapacoteId; + private Integer formapagoId; + private NotaCreditoVendaPacoteVO notacredito; + + public String getMoeda() { + return moeda; + } + + public void setMoeda(String moeda) { + this.moeda = moeda; + } + + public String getFormapagamento() { + return formapagamento; + } + + public void setFormapagamento(String formapagamento) { + this.formapagamento = formapagamento; + } + + public PagamentoCartaoVO getCartao() { + return cartao; + } + + public void setCartao(PagamentoCartaoVO cartao) { + this.cartao = cartao; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public DadosBancarioVO getDadosBancario() { + return dadosBancario; + } + + public void setDadosBancario(DadosBancarioVO dadosBancario) { + this.dadosBancario = dadosBancario; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + @XmlTransient + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public NotaCreditoVendaPacoteVO getNotacredito() { + return notacredito; + } + + public void setNotacredito(NotaCreditoVendaPacoteVO notacredito) { + this.notacredito = notacredito; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PassageiroVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PassageiroVO.java new file mode 100644 index 000000000..2d92e8031 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PassageiroVO.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name="passageiro") +@XmlType(propOrder = { "nome", "documento", "categoria", "assento", "boletoId" }) +public class PassageiroVO { + + public static final String CATEGORIA_ADULT = "ADT"; + public static final String CATEGORIA_CHILD = "CHD"; + public static final String CATEGORIA_INFANT = "INF"; + public static final String CATEGORIA_SENIOR = "SEN"; + + public static final int CATEGORIA_NORMAL=1; + + public static final int CATEGORIA_CRIANCA_GRATUIDADE=52; + + public static final int CATEGORIA_ESTUDANTE=22; + public static final int CATEGORIA_ESTUDANTE_PB=38; + public static final int CATEGORIA_ESTUDANTE_CE_LIBERCAD=49; + + public static final int CATEGORIA_CORTESIA_AFETIVIDADE=20; + public static final int CATEGORIA_CORTESIA_EMPRESA=21; + + public static final int CATEGORIA_FISCAL_DO_TRABALHO=24; + public static final int CATEGORIA_OPERADOR_A_TRABALHO=29; + + public static final int CATEGORIA_PRF=23; + public static final int CATEGORIA_POL_MILITAR_MA=32; + public static final int CATEGORIA_MILITAR_PI_POL=37; + public static final int CATEGORIA_CE_PM_BOMBEIRO=46; + public static final int CATEGORIA_CE_DETRAN=48; + public static final int CATEGORIA_MA_OFI_JUSTICA=30; + + public static final int CATEGORIA_ERFP=25; + + public static final int CATEGORIA_MA_SINFRA=31; + + public static final int CATEGORIA_SINDICATO_PB=40; + public static final int CATEGORIA_SINDICATO_CE=50; + public static final int CATEGORIA_SINDICATO_PI=51; + + public static final int CATEGORIA_PB_PORTADOR_DE_CA=43; + public static final int CATEGORIA_PB_ACOMP_PORT_CA=44; + public static final int CATEGORIA_PB_INTEG_PARAIBA=45; + + public static final int CATEGORIA_IDOSO_100=12; + public static final int CATEGORIA_IDOSO_50=13; + public static final int CATEGORIA_IDOSO_CE=47; + public static final int CATEGORIA_IDOSO_MA=34; + public static final int CATEGORIA_IDOSO_50_MA=35; + public static final int CATEGORIA_IDOSO_100_PB_BIL=41; + public static final int CATEGORIA_IDOSO_50_PB_BIL=42; + public static final int CATEGORIA_IDOSO_100_SP=27; + public static final int CATEGORIA_IDOSO_100_GO=15; + public static final int CATEGORIA_IDOSO_50_GO=16; + public static final int CATEGORIA_IDOSO_100_TO=18; + public static final int CATEGORIA_IDOSO_50_TO=19; + + public static final int CATEGORIA_DEFICIENTE=11; + public static final int CATEGORIA_DEFICIENTE_GO=14; + public static final int CATEGORIA_DEFICIENTE_TO=17; + public static final int CATEGORIA_DEFICIENTE_PB=39; + public static final int CATEGORIA_DEFICIENTE_BA=26; + public static final int CATEGORIA_DEFICIENTE_MA=33; + public static final int CATEGORIA_DEFICIENTE_PI=36; + + private Long vendapacoteId; + private Long tarifavendapacoteId; + private Long boletoId; + private String assento; + private String nome; + private String documento; + private String categoria; + + public String getNome() { + return nome; + } + public void setNome(String nome) { + this.nome = nome; + } + public String getDocumento() { + return documento; + } + public void setDocumento(String documento) { + this.documento = documento; + } + public String getCategoria() { + return categoria; + } + public void setCategoria(String categoria) { + this.categoria = categoria; + } + public Long getBoletoId() { + return boletoId; + } + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + @XmlTransient + public Long getTarifavendapacoteId() { + return tarifavendapacoteId; + } + public void setTarifavendapacoteId(Long tarifavendapacoteId) { + this.tarifavendapacoteId = tarifavendapacoteId; + } + public String getAssento() { + return assento; + } + public void setAssento(String assento) { + this.assento = assento; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ServicoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ServicoVO.java new file mode 100644 index 000000000..8d153da1f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ServicoVO.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement +@XmlType(propOrder = {"localorigem", "origem", "destino", "dataviagem", "horario", "horarioapanhe"}) +public class ServicoVO { + + private Long vendapacoteId; + private Integer localorigem; + private Date dataviagem; + private Date horario; + private Date horarioapanhe; + private String destino; + private String origem; + + public Integer getLocalorigem() { + return localorigem; + } + + public void setLocalorigem(Integer localorigem) { + this.localorigem = localorigem; + } + + public Date getDataviagem() { + return dataviagem; + } + + public void setDataviagem(Date dataviagem) { + this.dataviagem = dataviagem; + } + + public Date getHorario() { + return horario; + } + + public void setHorario(Date horario) { + this.horario = horario; + } + + public Date getHorarioapanhe() { + return horarioapanhe; + } + + public void setHorarioapanhe(Date horarioapanhe) { + this.horarioapanhe = horarioapanhe; + } + + public String getDestino() { + return destino; + } + + public void setDestino(String destino) { + this.destino = destino; + } + + public String getOrigem() { + return origem; + } + + public void setOrigem(String origem) { + this.origem = origem; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosClientePacoteResultTransformer.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosClientePacoteResultTransformer.java new file mode 100644 index 000000000..bdc8f2e79 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosClientePacoteResultTransformer.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.enums.TipoPessoa; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; + +public class DatosClientePacoteResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map passageiros = new HashMap(); + + for (Object objmap : mapList) { + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!passageiros.containsKey(vendapacoteId)){ + ClientePacoteVO clientePacote = new ClientePacoteVO(); + clientePacote.setVendapacoteId(vendapacoteId); + setDatosClientePacote(clientePacote, tupleMap); + passageiros.put(vendapacoteId, clientePacote); + } + } + + List clientesPacoteList = new ArrayList(); + clientesPacoteList.addAll(passageiros.values()); + + return clientesPacoteList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosClientePacote(ClientePacoteVO clientePacote, Map tupleMap) { + clientePacote.setRazaoSocial((String) tupleMap.get("RAZAO_SOCIAL")); + clientePacote.setCpfCnpj((String) tupleMap.get("CPF_CNPJ")); + clientePacote.setTipoPessoa(TipoPessoa.getTipoPessoa((Integer) tupleMap.get("TIPO_PESSOA")).toString()); + clientePacote.setDescemail((String) tupleMap.get("DESCEMAIL")); + clientePacote.setDesctelefone((String) tupleMap.get("DESCTELEFONE")); + clientePacote.setDescfax((String) tupleMap.get("DESCFAX")); + clientePacote.setCep((String) tupleMap.get("CEP")); + clientePacote.setEndereco((String) tupleMap.get("ENDERECO")); + clientePacote.setNumero((String) tupleMap.get("NUMERO")); + clientePacote.setComplemento((String) tupleMap.get("COMPLEMENTO")); + clientePacote.setPais((String) tupleMap.get("PAIS")); + clientePacote.setEstado((String) tupleMap.get("ESTADO")); + clientePacote.setCidade((String) tupleMap.get("CIDADE")); + clientePacote.setBairro((String) tupleMap.get("BAIRRO")); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEnderecoApanheResultTransformer.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEnderecoApanheResultTransformer.java new file mode 100644 index 000000000..e00135d2a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEnderecoApanheResultTransformer.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.enums.LocalEnderecoApanhe; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.EnderecoApanheVO; + +public class DatosEnderecoApanheResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map passageiros = new HashMap(); + + for (Object objmap : mapList) { + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!passageiros.containsKey(vendapacoteId)){ + EnderecoApanheVO enderecoApanhe = new EnderecoApanheVO(); + enderecoApanhe.setVendapacoteId(vendapacoteId); + setDatosEnderecoApanhe(enderecoApanhe, tupleMap); + passageiros.put(vendapacoteId, enderecoApanhe); + } + } + + List enderecosApanheList = new ArrayList(); + enderecosApanheList.addAll(passageiros.values()); + + return enderecosApanheList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosEnderecoApanhe(EnderecoApanheVO enderecoApanhe, Map tupleMap) { + LocalEnderecoApanhe localEnderecoApanhe = LocalEnderecoApanhe.getLocalEnderecoApanhe((Integer) tupleMap.get("LOCAL")); + if(localEnderecoApanhe != null && LocalEnderecoApanhe.HOTEL.equals(localEnderecoApanhe)) { + enderecoApanhe.setLocal((String) tupleMap.get("DESCHOTEL")); + if(StringUtils.isBlank(enderecoApanhe.getLocal())) { + enderecoApanhe.setLocal(localEnderecoApanhe.toString()); + } + } else if (localEnderecoApanhe != null) { + enderecoApanhe.setLocal(localEnderecoApanhe.toString()); + } + + enderecoApanhe.setCep((String) tupleMap.get("CEP")); + enderecoApanhe.setEndereco((String) tupleMap.get("ENDERECO")); + enderecoApanhe.setNumero((String) tupleMap.get("NUMERO")); + enderecoApanhe.setComplemento((String) tupleMap.get("COMPLEMENTO")); + enderecoApanhe.setCidade((String) tupleMap.get("CIDADE")); + enderecoApanhe.setBairro((String) tupleMap.get("BAIRRO")); + enderecoApanhe.setReferencia((String) tupleMap.get("REFERENCIA")); + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosItemAdicionalResultTransformer.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosItemAdicionalResultTransformer.java new file mode 100644 index 000000000..02aeca015 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosItemAdicionalResultTransformer.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ItemAdicionalVO; + +public class DatosItemAdicionalResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map itens = new HashMap(); + + for (Object objmap : mapList) { + Map tupleMap = (Map) objmap; + Long itemadicionalId = (Long) tupleMap.get("ITEMADICIONAL_ID"); + + if(!itens.containsKey(itemadicionalId)){ + ItemAdicionalVO itemAdicional = new ItemAdicionalVO(); + itemAdicional.setItemadicionalId(itemadicionalId); + setDatosItemAdicional(itemAdicional, tupleMap); + itens.put(itemadicionalId+""+itemAdicional.getVendapacoteId(), itemAdicional); + } + } + + List itemAdicionalList = new ArrayList(); + itemAdicionalList.addAll(itens.values()); + + return itemAdicionalList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosItemAdicional(ItemAdicionalVO itemAdicional, Map tupleMap) { + itemAdicional.setVendapacoteId((Long) tupleMap.get("VENDAPACOTE_ID")); + itemAdicional.setDescitemadicional((String) tupleMap.get("DESCITEMADICIONAL")); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPagamentoResultTransformer.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPagamentoResultTransformer.java new file mode 100644 index 000000000..d76bec2e7 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPagamentoResultTransformer.java @@ -0,0 +1,86 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.NotaCreditoVendaPacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PagamentoCartaoVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PagamentoVO; + +public class DatosPagamentoResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + Map pacotes = new HashMap(); + + for(Object objmap : mapList ) { + + Map tupleMap = (Map) objmap; + Long pacoteformapagoId = (Long) tupleMap.get("PACOTEFORMAPAGO_ID"); + + if(!pacotes.containsKey(pacoteformapagoId)){ + PagamentoVO pagamento = new PagamentoVO(); + setDatosPacote(pagamento, tupleMap); + pacotes.put(pacoteformapagoId, pagamento); + } + } + + List pacotesList = new ArrayList(); + pacotesList.addAll(pacotes.values()); + + return pacotesList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosPacote(PagamentoVO pagamento, Map tupleMap) { + pagamento.setMoeda("R$"); + pagamento.setVendapacoteId((Long) tupleMap.get("VENDAPACOTE_ID")); + pagamento.setFormapagoId((Integer) tupleMap.get("FORMAPAGO_ID")); + pagamento.setFormapagamento((String) tupleMap.get("DESCPAGO")); + pagamento.setValor((BigDecimal) tupleMap.get("VALOR")); + + if(isVentaCartaoCredito(pagamento.getFormapagoId()) || isVentaCartaoDebito(pagamento.getFormapagoId())) { + PagamentoCartaoVO cartao = new PagamentoCartaoVO(); + cartao.setBandeira((String) tupleMap.get("TIPOTARJETA")); + cartao.setNumautorizacao((String) tupleMap.get("NUMAUTORIZACION")); + cartao.setParcelas((Integer) tupleMap.get("CANTPARCELAS")); + pagamento.setCartao(cartao); + } + + if(tupleMap.get("NOTACREDITOVENDAPACOTE_ID") != null) { + NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO(); + notacredito.setVouchernotacredito((Long) tupleMap.get("NOTACREDITOVENDAPACOTE_ID")); + notacredito.setNumoperacaopacotecancelamento((String) tupleMap.get("NUMOPERACAOPACOTECANCELAMENTO")); + pagamento.setNotacredito(notacredito); + } + + } + + private boolean isVentaCartaoCredito(Integer formapagoId){ + return Constantes.FORMA_PAGO_CREDITO.intValue() == formapagoId; + } + + private boolean isVentaCartaoDebito(Integer formapagoId){ + return Constantes.FORMA_PAGO_DEBITO.intValue() == formapagoId; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPassageiroResultTransformer.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPassageiroResultTransformer.java new file mode 100644 index 000000000..153fdaa14 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPassageiroResultTransformer.java @@ -0,0 +1,147 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PassageiroVO; + +public class DatosPassageiroResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map passageiros = new HashMap(); + + for (Object objmap : mapList) { + + Map tupleMap = (Map) objmap; + Long tarifavendapacoteId = (Long) tupleMap.get("TARIFAVENDAPACOTE_ID"); + + if(!passageiros.containsKey(tarifavendapacoteId)){ + PassageiroVO passageiro = new PassageiroVO(); + passageiro.setTarifavendapacoteId(tarifavendapacoteId); + setDatosPassageiro(passageiro, tupleMap); + passageiros.put(tarifavendapacoteId, passageiro); + } + } + + List passageirosList = new ArrayList(); + passageirosList.addAll(passageiros.values()); + + return passageirosList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosPassageiro(PassageiroVO passageiro, Map tupleMap){ + + passageiro.setVendapacoteId((Long) tupleMap.get("VENDAPACOTE_ID")); + passageiro.setDocumento((String) tupleMap.get("DOCUMENTO")); + passageiro.setNome((String) tupleMap.get("NOMEPASSAGEIRO")); + passageiro.setBoletoId((Long) tupleMap.get("BOLETO_ID")); + passageiro.setAssento((String) tupleMap.get("NUMASIENTO")); + + setCategoriaPassageiro(passageiro, tupleMap); + + } + + private void setCategoriaPassageiro(PassageiroVO passageiro, Map tupleMap){ + + Integer categoriaId = (Integer) tupleMap.get("CATEGORIA_ID"); + String categoria = (String) tupleMap.get("DESCCATEGORIA"); + + if(categoriaId != null) { + String categoriaWS = ""; + + if(isCategoriaAdult(categoriaId)) { + categoriaWS = PassageiroVO.CATEGORIA_ADULT; + } else if(isCategoriaInfant(categoriaId)) { + categoriaWS = PassageiroVO.CATEGORIA_INFANT; + } else if(isCategoriaChild(categoriaId)) { + categoriaWS = PassageiroVO.CATEGORIA_CHILD; + } else if(isCategoriaSenior(categoriaId)) { + categoriaWS = PassageiroVO.CATEGORIA_SENIOR; + } else { + categoriaWS = String.format("%s-%s", categoriaId.toString(), categoria); + } + + passageiro.setCategoria(categoriaWS); + } + + } + + private boolean isCategoriaSenior(Integer categoriaId){ + + return (PassageiroVO.CATEGORIA_IDOSO_100 == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_50 == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_CE == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_MA == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_50_MA == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_100_PB_BIL == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_50_PB_BIL == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_100_SP == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_100_GO == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_50_GO == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_100_TO == categoriaId + || PassageiroVO.CATEGORIA_IDOSO_50_TO == categoriaId); + } + + private boolean isCategoriaAdult(Integer categoriaId){ + + return (PassageiroVO.CATEGORIA_DEFICIENTE == categoriaId + || PassageiroVO.CATEGORIA_DEFICIENTE_GO == categoriaId + || PassageiroVO.CATEGORIA_DEFICIENTE_TO == categoriaId + || PassageiroVO.CATEGORIA_DEFICIENTE_PB == categoriaId + || PassageiroVO.CATEGORIA_DEFICIENTE_BA == categoriaId + || PassageiroVO.CATEGORIA_DEFICIENTE_MA == categoriaId + || PassageiroVO.CATEGORIA_DEFICIENTE_PI == categoriaId + || PassageiroVO.CATEGORIA_ESTUDANTE == categoriaId + || PassageiroVO.CATEGORIA_ESTUDANTE_PB == categoriaId + || PassageiroVO.CATEGORIA_ESTUDANTE_CE_LIBERCAD == categoriaId + || PassageiroVO.CATEGORIA_FISCAL_DO_TRABALHO == categoriaId + || PassageiroVO.CATEGORIA_OPERADOR_A_TRABALHO == categoriaId + || PassageiroVO.CATEGORIA_PRF == categoriaId + || PassageiroVO.CATEGORIA_POL_MILITAR_MA == categoriaId + || PassageiroVO.CATEGORIA_MILITAR_PI_POL == categoriaId + || PassageiroVO.CATEGORIA_CE_PM_BOMBEIRO == categoriaId + || PassageiroVO.CATEGORIA_CE_DETRAN == categoriaId + || PassageiroVO.CATEGORIA_MA_OFI_JUSTICA == categoriaId + || PassageiroVO.CATEGORIA_ERFP == categoriaId + || PassageiroVO.CATEGORIA_MA_SINFRA == categoriaId + || PassageiroVO.CATEGORIA_SINDICATO_PB == categoriaId + || PassageiroVO.CATEGORIA_SINDICATO_CE == categoriaId + || PassageiroVO.CATEGORIA_SINDICATO_PI == categoriaId + || PassageiroVO.CATEGORIA_PB_PORTADOR_DE_CA == categoriaId + || PassageiroVO.CATEGORIA_PB_ACOMP_PORT_CA == categoriaId + || PassageiroVO.CATEGORIA_PB_INTEG_PARAIBA == categoriaId + || PassageiroVO.CATEGORIA_CORTESIA_AFETIVIDADE == categoriaId + || PassageiroVO.CATEGORIA_CORTESIA_EMPRESA == categoriaId + || PassageiroVO.CATEGORIA_NORMAL == categoriaId ); + } + + private boolean isCategoriaInfant(Integer categoriaId){ + + return false; + } + + private boolean isCategoriaChild(Integer categoriaId){ + + return (PassageiroVO.CATEGORIA_CRIANCA_GRATUIDADE == categoriaId); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosServicoResultTransformer.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosServicoResultTransformer.java new file mode 100644 index 000000000..5646196ac --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosServicoResultTransformer.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ServicoVO; + +public class DatosServicoResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + Map servicos = new HashMap(); + + for (Object objmap : mapList) { + + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!servicos.containsKey(vendapacoteId)){ + ServicoVO servico = new ServicoVO(); + servico.setVendapacoteId(vendapacoteId); + setDatosServico(servico, tupleMap); + servicos.put(vendapacoteId, servico); + } + } + + List servicosList = new ArrayList(); + servicosList.addAll(servicos.values()); + + return servicosList; + } + + private void setDatosServico(ServicoVO servico, Map tupleMap) { + servico.setDataviagem((Date) tupleMap.get("FECHORVIAJE")); + servico.setHorario((Date) tupleMap.get("FECHORVIAJE")); + servico.setLocalorigem((Integer) tupleMap.get("ORIGEN_ID")); + servico.setOrigem((String) tupleMap.get("ORIGEM")); + servico.setDestino((String) tupleMap.get("DESTINO")); + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosTicketResultTransformer.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosTicketResultTransformer.java new file mode 100644 index 000000000..e39e92a09 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosTicketResultTransformer.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; + +public class DatosTicketResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + + Map pacotes = new HashMap(); + + for(Object objmap : mapList ){ + + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!pacotes.containsKey(vendapacoteId)){ + PacoteVO pacote = new PacoteVO(); + pacote.setVendapacoteId(vendapacoteId); + setDatosPacote(pacote, tupleMap); + pacotes.put(vendapacoteId, pacote); + } + } + + List pacotesList = new ArrayList(); + pacotesList.addAll(pacotes.values()); + + return pacotesList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosPacote(PacoteVO pacote, Map tupleMap){ + pacote.setNumoperacao((String) tupleMap.get("NUMOPERACION")); + pacote.setUsuariovenda((Integer) tupleMap.get("USUARIO_ID")); + pacote.setDatavenda((Date) tupleMap.get("DATAVENDA")); + pacote.setDatapacote((Date) tupleMap.get("DATAPACOTE")); + + if(tupleMap.get("SITUACAO") != null) { + SituacaoVendaPacote situacaoVendaPacote = SituacaoVendaPacote.getSituacaoVendaPacote((Integer) tupleMap.get("SITUACAO")); + if(situacaoVendaPacote != null) { + pacote.setStatus(situacaoVendaPacote.toString()); + } + } + + pacote.setPacoteId((Long) tupleMap.get("PACOTE_ID")); + pacote.setDescpacote((String) tupleMap.get("DESCPACOTE")); + pacote.setNompacote((String) tupleMap.get("NOMPACOTE")); + pacote.setPontoVenda((String) tupleMap.get("NOMBPUNTOVENTA")); + pacote.setEmpresa((String) tupleMap.get("NOMBEMPRESA")); + pacote.setQuantidade((Integer) tupleMap.get("QTDEPASSAGEIRO")); + pacote.setTotalTarifa((BigDecimal) tupleMap.get("TOTALTARIFA")); + pacote.setTotalTaxaEmbarque((BigDecimal) tupleMap.get("TOTALTAXAEMBARQUE")); + pacote.setTotalPedagio((BigDecimal) tupleMap.get("TOTALPEDAGIO")); + pacote.setTotalOutros((BigDecimal) tupleMap.get("TOTALOUTROS")); + pacote.setTotalSeguro((BigDecimal) tupleMap.get("TOTALSEGURO")); + pacote.setValorsubtotal((BigDecimal) tupleMap.get("SUBTOTAL")); + pacote.setValortotal((BigDecimal) tupleMap.get("TOTAL")); + pacote.setValordesconto((BigDecimal) tupleMap.get("DESCONTO")); + pacote.setQtdePacoteFormaspago((Integer) tupleMap.get("QTDEPACOTEFORMAPAGO")); + + if(StringUtils.isNotBlank(pacote.getDescpacote())){ + pacote.setDescpacote(StringEscapeUtils.unescapeHtml(pacote.getDescpacote().replaceAll(" ", " ").replaceAll("\\<.*?\\>", " ")).replaceAll("\\s+", " ")); + } + + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/CajaCerradoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/CajaCerradoVO.java new file mode 100644 index 000000000..5a7e4933a --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/CajaCerradoVO.java @@ -0,0 +1,174 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class CajaCerradoVO { + + private Long cajaId; + private String numFolioSistema; + private String origen; + private String destino; + private Integer corridaId; + private BigDecimal precioPagado; + private Date fecHorVenta; + private BigDecimal importeTaxaEmbarque; + private String ruta; + private String numAutorizacion; + private String ordenSevicio; + private String secretaria; + private String cvesecretaria; + private String emissorTarjeta; + private String tipoPasaje; + private String formaPago; + + public CajaCerradoVO() { + this.cajaId = new Long(-1); + this.numFolioSistema = ""; + this.origen = ""; + this.destino = ""; + this.corridaId = new Integer(-1); + this.precioPagado = new BigDecimal(0); + this.fecHorVenta = new Date(); + this.importeTaxaEmbarque = new BigDecimal(0); + this.ruta = ""; + this.numAutorizacion = ""; + this.ordenSevicio = ""; + this.secretaria = ""; + this.cvesecretaria = ""; + this.emissorTarjeta = ""; + this.tipoPasaje = ""; + this.formaPago = ""; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public String getOrigen() { + return origen; + } + + public void setOrigen(String origen) { + this.origen = origen; + } + + public String getDestino() { + return destino; + } + + public void setDestino(String destino) { + this.destino = destino; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public BigDecimal getPrecioPagado() { + return precioPagado; + } + + public void setPrecioPagado(BigDecimal precioPagado) { + this.precioPagado = precioPagado; + } + + public Date getFecHorVenta() { + return fecHorVenta; + } + + public void setFecHorVenta(Date fecHorVenta) { + this.fecHorVenta = fecHorVenta; + } + + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + + public String getRuta() { + return ruta; + } + + public void setRuta(String ruta) { + this.ruta = ruta; + } + + public String getNumAutorizacion() { + return numAutorizacion; + } + + public void setNumAutorizacion(String numAutorizacion) { + this.numAutorizacion = numAutorizacion; + } + + public String getOrdenSevicio() { + return ordenSevicio; + } + + public void setOrdenSevicio(String ordenSevicio) { + this.ordenSevicio = ordenSevicio; + } + + public String getCodigoSecretaria() { + return secretaria; + } + + public void setCodigoSecretaria(String secretaria) { + this.secretaria = secretaria; + } + + public String getCvesecretaria() { + return cvesecretaria; + } + + public void setCvesecretaria(String cvesecretaria) { + this.cvesecretaria = cvesecretaria; + } + + public String getEmissorTarjeta() { + return emissorTarjeta; + } + + public void setEmissorTarjeta(String emissorTarjeta) { + this.emissorTarjeta = emissorTarjeta; + } + + public String getTipoPasaje() { + return tipoPasaje; + } + + public void setTipoPasaje(String tipoPasaje) { + this.tipoPasaje = tipoPasaje; + } + + public String getFormaPago() { + return formaPago; + } + + public void setFormaPago(String formaPago) { + this.formaPago = formaPago; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/CajaVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/CajaVO.java new file mode 100644 index 000000000..35e283539 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/CajaVO.java @@ -0,0 +1,264 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class CajaVO { + + private Long cajaId; + private String numAsiento; + private Integer categoriaId; + private String numFolioSistema; + private Integer claseServicioId; + private Integer marcaId; + private Integer origenId; + private Integer destinoId; + private Integer corridaId; + private Date fecCorrida; + private String nombPasajero; + private BigDecimal precioBase; + private BigDecimal precioPagado; + private Integer tipoVentaId; + private String numSeriePreimpresa; + private String numFolioPreImpreso; + private Date fecHorViaje; + private Date fecHorVenta; + private Integer puntoVentaId; + private String numPuntoVenta; + private BigDecimal numKmViaje; + private String numOperacion; + private Integer motivoCancelacionId; + private Integer empresaPuntoVentaId; + private Integer empresaCorridaId; + private Integer turnoId; + private BigDecimal importeTaxaEmbarque; + private BigDecimal importePedagio; + private BigDecimal importeOutros; + private BigDecimal importeSeguro; + private Integer rutaId; + private Integer usuarioId; + private String numAutorizacion; + private String ordenSevicio; + private String uf; + private String desccategoria; + + public Long getCajaId() { + return cajaId; + } + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + public String getNumAsiento() { + return numAsiento; + } + public void setNumAsiento(String numAsiento) { + this.numAsiento = numAsiento; + } + public Integer getCategoriaId() { + return categoriaId; + } + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + public String getNumFolioSistema() { + return numFolioSistema; + } + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + public Integer getClaseServicioId() { + return claseServicioId; + } + public void setClaseServicioId(Integer claseServicioId) { + this.claseServicioId = claseServicioId; + } + public Integer getMarcaId() { + return marcaId; + } + public void setMarcaId(Integer marcaId) { + this.marcaId = marcaId; + } + public Integer getOrigenId() { + return origenId; + } + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + public Integer getDestinoId() { + return destinoId; + } + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + public Integer getCorridaId() { + return corridaId; + } + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + public Date getFecCorrida() { + return fecCorrida; + } + public void setFecCorrida(Date fecCorrida) { + this.fecCorrida = fecCorrida; + } + public String getNombPasajero() { + return nombPasajero; + } + public void setNombPasajero(String nombPasajero) { + this.nombPasajero = nombPasajero; + } + public BigDecimal getPrecioBase() { + return precioBase; + } + public void setPrecioBase(BigDecimal precioBase) { + this.precioBase = precioBase; + } + public BigDecimal getPrecioPagado() { + return precioPagado; + } + public void setPrecioPagado(BigDecimal precioPagado) { + this.precioPagado = precioPagado; + } + public Integer getTipoVentaId() { + return tipoVentaId; + } + public void setTipoVentaId(Integer tipoVentaId) { + this.tipoVentaId = tipoVentaId; + } + public String getNumSeriePreimpresa() { + return numSeriePreimpresa; + } + public void setNumSeriePreimpresa(String numSeriePreimpresa) { + this.numSeriePreimpresa = numSeriePreimpresa; + } + public String getNumFolioPreImpreso() { + return numFolioPreImpreso; + } + public void setNumFolioPreImpreso(String numFolioPreImpreso) { + this.numFolioPreImpreso = numFolioPreImpreso; + } + public Date getFecHorViaje() { + return fecHorViaje; + } + public void setFecHorViaje(Date fecHorViaje) { + this.fecHorViaje = fecHorViaje; + } + public Date getFecHorVenta() { + return fecHorVenta; + } + public void setFecHorVenta(Date fecHorVenta) { + this.fecHorVenta = fecHorVenta; + } + public Integer getPuntoVentaId() { + return puntoVentaId; + } + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + public BigDecimal getNumKmViaje() { + return numKmViaje; + } + public void setNumKmViaje(BigDecimal numKmViaje) { + this.numKmViaje = numKmViaje; + } + public String getNumOperacion() { + return numOperacion; + } + public void setNumOperacion(String numOperacion) { + this.numOperacion = numOperacion; + } + public Integer getMotivoCancelacionId() { + return motivoCancelacionId; + } + public void setMotivoCancelacionId(Integer motivoCancelacionId) { + this.motivoCancelacionId = motivoCancelacionId; + } + public Integer getEmpresaPuntoVentaId() { + return empresaPuntoVentaId; + } + public void setEmpresaPuntoVentaId(Integer empresaPuntoVentaId) { + this.empresaPuntoVentaId = empresaPuntoVentaId; + } + public Integer getEmpresaCorridaId() { + return empresaCorridaId; + } + public void setEmpresaCorridaId(Integer empresaCorridaId) { + this.empresaCorridaId = empresaCorridaId; + } + public Integer getTurnoId() { + return turnoId; + } + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + public BigDecimal getImportePedagio() { + return importePedagio; + } + public void setImportePedagio(BigDecimal importePedagio) { + this.importePedagio = importePedagio; + } + public BigDecimal getImporteOutros() { + return importeOutros; + } + public void setImporteOutros(BigDecimal importeOutros) { + this.importeOutros = importeOutros; + } + public BigDecimal getImporteSeguro() { + return importeSeguro; + } + public void setImporteSeguro(BigDecimal importeSeguro) { + this.importeSeguro = importeSeguro; + } + public Integer getRutaId() { + return rutaId; + } + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getNumAutorizacion() { + return numAutorizacion; + } + public void setNumAutorizacion(String numAutorizacion) { + this.numAutorizacion = numAutorizacion; + } + public String getOrdenSevicio() { + return ordenSevicio; + } + public void setOrdenSevicio(String ordenSevicio) { + this.ordenSevicio = ordenSevicio; + } + public String getNumPuntoVenta() { + return numPuntoVenta; + } + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + public String getUf() { + return uf; + } + public void setUf(String uf) { + this.uf = uf; + } + public String getDesccategoria() { + return desccategoria; + } + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/ReceitaDespesaVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/ReceitaDespesaVO.java new file mode 100644 index 000000000..08c296b8e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/ReceitaDespesaVO.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; + +import javax.xml.bind.annotation.XmlRootElement; + + +public class ReceitaDespesaVO { + private BigDecimal precio; + private String tipoEvento; + + public BigDecimal getPrecio() { + return precio; + } + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + public String getTipoEvento() { + return tipoEvento; + } + public void setTipoEvento(String tipoEvento) { + this.tipoEvento = tipoEvento; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioActivoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioActivoVO.java new file mode 100644 index 000000000..d5130bf4f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioActivoVO.java @@ -0,0 +1,37 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class UsuarioActivoVO { + private Integer usuarioId; + private String nombusuario; + private String cveusuario; + + public UsuarioActivoVO() { + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public String getCveusuario() { + return cveusuario; + } + + public void setCveusuario(String cveUsuario) { + this.cveusuario = cveUsuario; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioVO.java new file mode 100644 index 000000000..716e014f4 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioVO.java @@ -0,0 +1,84 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class UsuarioVO { + private Integer usuarioId; + private String cveusuario; + private Integer puntoVentaId; + private String numPuntoVenta; + private Integer turnoId; + private Date fecCorte; + private BigDecimal importeTotal; + private List pasajes; + private List diversos; + + public UsuarioVO() { + this.puntoVentaId = new Integer(-1); + this.fecCorte = new Date();; + this.turnoId = new Integer(-1); + this.importeTotal = new BigDecimal(0); + } + + public List getPasajes() { + return pasajes; + } + public void setPasajes(List pasajes) { + this.pasajes = pasajes; + } + public List getDiversos() { + return diversos; + } + public void setDiversos(List diversos) { + this.diversos = diversos; + } + public String getCveusuario() { + return cveusuario; + } + public void setCveusuario(String cveusuario) { + this.cveusuario = cveusuario; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Integer getPuntoVentaId() { + return puntoVentaId; + } + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + public Date getFecCorte() { + return fecCorte; + } + public void setFecCorte(Date fecCorte) { + this.fecCorte = fecCorte; + } + public Integer getTurnoId() { + return turnoId; + } + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + public BigDecimal getImporteTotal() { + return importeTotal; + } + public void setImporteTotal(BigDecimal importeTotal) { + this.importeTotal = importeTotal; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/VendaEmbarcadaVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/VendaEmbarcadaVO.java new file mode 100644 index 000000000..c9e7dda8d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/caja/VendaEmbarcadaVO.java @@ -0,0 +1,292 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Date; + +public class VendaEmbarcadaVO { + private Long cajaId; + private String numAsiento; + private Integer categoriaId; + private Integer claseServicioId; + private Integer marcaId; + private Integer origemId; + private Integer destinoId; + private Integer corridaId; + private Date fecCorrida; + private Integer tipoVentaId; + private Date fechorViaje; + private Date fechorVenta; + private Integer puntoVentaId; + private String numOperacion; + private Integer empresaPuntoVentaId; + private Integer empresaCorridaId; + private Integer estacionId; + private Integer usuarioId; + private Integer clienteId; + private BigDecimal precio; + private BigDecimal importeTaxaEmbarque; + private BigDecimal importePedagio; + private BigDecimal importeOutros; + private BigDecimal importeSeguro; + private Integer rutaId; + private Integer formaPagoId; + private BigInteger empresaId; + private Long boletoId; + private Date fecModIf; + private String numFolioPreimpresso; + private String serieImpFiscal; + + public VendaEmbarcadaVO() { + fecModIf = new Date(System.currentTimeMillis()); + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public BigInteger getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(BigInteger empresaId) { + this.empresaId = empresaId; + } + + public Integer getFormaPagoId() { + return formaPagoId; + } + + public void setFormaPagoId(Integer formaPagoId) { + this.formaPagoId = formaPagoId; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public String getNumAsiento() { + return numAsiento; + } + + public void setNumAsiento(String numAsiento) { + this.numAsiento = numAsiento; + } + + public Integer getCategoriaId() { + return categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public Integer getClaseServicioId() { + return claseServicioId; + } + + public void setClaseServicioId(Integer claseServicioId) { + this.claseServicioId = claseServicioId; + } + + public Integer getMarcaId() { + return marcaId; + } + + public void setMarcaId(Integer marcaId) { + this.marcaId = marcaId; + } + + public Integer getOrigemId() { + return origemId; + } + + public void setOrigemId(Integer origemId) { + this.origemId = origemId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFecCorrida() { + return fecCorrida; + } + + public void setFecCorrida(Date fecCorrida) { + this.fecCorrida = fecCorrida; + } + + public Integer getTipoVentaId() { + return tipoVentaId; + } + + public void setTipoVentaId(Integer tipoVentaId) { + this.tipoVentaId = tipoVentaId; + } + + public Date getFechorViaje() { + return fechorViaje; + } + + public void setFechorViaje(Date fechorViaje) { + this.fechorViaje = fechorViaje; + } + + public Date getFechorVenta() { + return fechorVenta; + } + + public void setFechorVenta(Date fechorVenta) { + this.fechorVenta = fechorVenta; + } + + public Integer getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public String getNumOperacion() { + return numOperacion; + } + + public void setNumOperacion(String numOperacion) { + this.numOperacion = numOperacion; + } + + public Integer getEmpresaPuntoVentaId() { + return empresaPuntoVentaId; + } + + public void setEmpresaPuntoVentaId(Integer empresaPuntoVentaId) { + this.empresaPuntoVentaId = empresaPuntoVentaId; + } + + public Integer getEmpresaCorridaId() { + return empresaCorridaId; + } + + public void setEmpresaCorridaId(Integer empresaCorridaId) { + this.empresaCorridaId = empresaCorridaId; + } + + public Integer getEstacionId() { + return estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getClienteId() { + return clienteId; + } + + public void setClienteId(Integer clienteId) { + this.clienteId = clienteId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + + public BigDecimal getImportePedagio() { + return importePedagio; + } + + public void setImportePedagio(BigDecimal importePedagio) { + this.importePedagio = importePedagio; + } + + public BigDecimal getImporteOutros() { + return importeOutros; + } + + public void setImporteOutros(BigDecimal importeOutros) { + this.importeOutros = importeOutros; + } + + public BigDecimal getImporteSeguro() { + return importeSeguro; + } + + public void setImporteSeguro(BigDecimal importeSeguro) { + this.importeSeguro = importeSeguro; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public Date getFecModIf() { + return fecModIf; + } + + public void setFecModIf(Date fecModIf) { + this.fecModIf = fecModIf; + } + + public String getNumFolioPreimpresso() { + return numFolioPreimpresso; + } + + public void setNumFolioPreimpresso(String numFolioPreimpresso) { + this.numFolioPreimpresso = numFolioPreimpresso; + } + + public String getSerieImpFiscal() { + return serieImpFiscal; + } + + public void setSerieImpFiscal(String serieImpFiscal) { + this.serieImpFiscal = serieImpFiscal; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java new file mode 100644 index 000000000..6cee2f10d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java @@ -0,0 +1,840 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.constantes.DescricaoTipoVenta; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class BoletoComissao { + + private Long boletoId; + private Integer empresaId; + private Integer puntoVentaId; + private String datavenda; + private Integer tipoVenta; + private String indstatusboleto; + private Integer motivoCancelacionId; + private String descmotivocancelacion; + private BigDecimal valorpagado; + private BigDecimal seguro; + private BigDecimal pedagio; + private BigDecimal embarque; + private BigDecimal excessoBagagem; + private BigDecimal seguroOpcional; + private BigDecimal seguroOutros; + private Boolean ptoVtaOrigem; + private String numAsiento; + private String numAsientoVinculado; + private String numFolioSistema; + private String numSeriePreimpresa; + private String numFolioPreImpreso; + private String uf; + private String desccategoria; + private String nombpasajero; + private Integer status; + private String numoperacion; + private Integer tipoVentaOriginal1; + private Integer tipoVentaOriginal2; + private Integer ocdId; + + private Integer estadoId; + private Integer formapagoId; + private String descpago; + private Boolean indconferenciafisicacomissao; + private BigDecimal importeFp; + + private Set formapagos; + private BigDecimal icmsBase; + private String nombusuario; + private Integer comempformapagoId; + private Integer comempcategoriaId; + private Long logconferenciaId; + + private boolean exigeConferenciaDevolvido; + private Boolean indcarboletosdevolvidosconf; + + private boolean exigeConferenciaAba; + + private boolean conferido; + + private Date feccorrida; + private Integer corridaId; + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public String getDatavenda() { + return datavenda; + } + + public void setDatavenda(String datavenda) { + this.datavenda = datavenda; + } + + public Integer getTipoVenta() { + return tipoVenta; + } + + public void setTipoVenta(Integer tipoVenta) { + this.tipoVenta = tipoVenta; + } + + public Integer getMotivoCancelacionId() { + return motivoCancelacionId; + } + + public void setMotivoCancelacionId(Integer motivoCancelacionId) { + this.motivoCancelacionId = motivoCancelacionId; + } + + public BigDecimal getValorpagado() { + return valorpagado; + } + + public void setValorpagado(BigDecimal valorpagado) { + this.valorpagado = valorpagado; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getEmbarque() { + return embarque; + } + + public void setEmbarque(BigDecimal embarque) { + this.embarque = embarque; + } + + public BigDecimal getExcessoBagagem() { + return excessoBagagem; + } + + public void setExcessoBagagem(BigDecimal excessoBagagem) { + this.excessoBagagem = excessoBagagem; + } + + public BigDecimal getSeguroOpcional() { + return seguroOpcional; + } + + public void setSeguroOpcional(BigDecimal seguroOpcional) { + this.seguroOpcional = seguroOpcional; + } + + public BigDecimal getSeguroOutros() { + return seguroOutros; + } + + public void setSeguroOutros(BigDecimal seguroOutros) { + this.seguroOutros = seguroOutros; + } + + public Boolean isPtoVtaOrigem() { + return ptoVtaOrigem; + } + + public void setPtoVtaOrigem(Boolean ptoVtaOrigem) { + this.ptoVtaOrigem = ptoVtaOrigem; + } + + public String getIndstatusboleto() { + return indstatusboleto; + } + + public void setIndstatusboleto(String indstatusboleto) { + this.indstatusboleto = indstatusboleto; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public String getNumAsiento() { + return numAsiento; + } + + public void setNumAsiento(String numAsiento) { + this.numAsiento = numAsiento; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public String getNumSeriePreimpresa() { + return numSeriePreimpresa; + } + + public void setNumSeriePreimpresa(String numSeriePreimpresa) { + this.numSeriePreimpresa = numSeriePreimpresa; + } + + public String getNumFolioPreImpreso() { + return numFolioPreImpreso; + } + + public void setNumFolioPreImpreso(String numFolioPreImpreso) { + this.numFolioPreImpreso = numFolioPreImpreso; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + + public Boolean getPtoVtaOrigem() { + return ptoVtaOrigem; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if (statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public String getDescFormapagos() { + StringBuilder sFormapagos = new StringBuilder(); + for (FormapagoVO formapago : formapagos) { + if (sFormapagos.length() > 0) { + sFormapagos.append(", "); + } + sFormapagos.append(formapago.getDescpago()); + } + + return sFormapagos.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getBoletoId() == null) ? 0 : getBoletoId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + BoletoComissao other = (BoletoComissao) obj; + if (getBoletoId() == null) { + if (other.getBoletoId() != null) + return false; + } else if (!getBoletoId().equals(other.getBoletoId())) + return false; + return true; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public Set getFormapagos() { + return formapagos; + } + + public void setFormapagos(Set formapagos) { + this.formapagos = formapagos; + } + + public BigDecimal getIcmsBase() { + return icmsBase; + } + + public void setIcmsBase(BigDecimal icmsBase) { + this.icmsBase = icmsBase; + } + + public String getDescmotivocancelacion() { + return descmotivocancelacion; + } + + public void setDescmotivocancelacion(String descmotivocancelacion) { + this.descmotivocancelacion = descmotivocancelacion; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public String getNumAsientoVinculado() { + return numAsientoVinculado; + } + + public void setNumAsientoVinculado(String numAsientoVinculado) { + this.numAsientoVinculado = numAsientoVinculado; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getValorpagado()) + .add(getEmbarque()) + .add(getSeguro()) + .add(getPedagio()) + .add(getSeguro()); + + return total; + } + + public String getDescTipoVenta() { + return DescricaoTipoVenta.getDescricaoTipoVenta(getTipoVenta()); + } + + public String getSituacaoBilhete() { + if(isOcd()) { + return "OCD"; + } else if((isStatusCancelado()) && (isMotivocancelacionDevolvido() || isMotivocancelacionCancelado()) && StringUtils.isNotBlank(getDescmotivocancelacion())) { + return getDescmotivocancelacion(); + } else if((isStatusVendido() || isStatusCancelado()) && !isMotivocancelacionDevolvido() && !isMotivocancelacionCancelado()) { + if (isMotivocancelacionTrocado()) { + return "B. VENDIDO TROCADO"; + } else if (isMotivocancelacionTransferido()) { + return "B. VENDIDO TRANSFERIDO"; + } + } else if(isStatusTroca()) { + if (isVendaBilheteTroca(getTipoVenta()) || isVendaGap(getTipoVenta())) { + return "B. DA TROCA"; + } else if (isVendaBilheteTransferencia(getTipoVenta()) || isVendaGap(getTipoVenta())) { + return "B. DA TRANSFERENCIA"; + } else if (isVendaBilheteConfirmaAberto(getTipoVenta())) { + return "CONFIRMAÇÃO ABERTO"; + } + } + + IndStatusBoleto indStatusBoleto = IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); + return indStatusBoleto != null ? indStatusBoleto.getValue() : ""; + } + + public boolean isOcd() { + return getOcdId() != null && isStatusCancelado() && isMotivocancelacionDevolvido(); + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public BigDecimal getImporteFp() { + return importeFp; + } + + public void setImporteFp(BigDecimal importeFp) { + this.importeFp = importeFp; + } + + public Integer getComempformapagoId() { + return comempformapagoId; + } + + public void setComempformapagoId(Integer comempformapagoId) { + this.comempformapagoId = comempformapagoId; + } + + public Integer getComempcategoriaId() { + return comempcategoriaId; + } + + public void setComempcategoriaId(Integer comempcategoriaId) { + this.comempcategoriaId = comempcategoriaId; + } + + public boolean isExigeConferencia() { + return getComempcategoriaId() != null || getComempformapagoId() != null; + } + + public boolean isExigeConferenciaBoletoDevolvido() { + return exigeConferenciaDevolvido; + } + + public boolean isConferido() { + return conferido; + } + + public void setConferido(boolean conferido) { + this.conferido = conferido; + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public Integer getTipoVentaOriginal() { + return tipoVentaOriginal2 != null ? tipoVentaOriginal2 : tipoVentaOriginal1 != null ? tipoVentaOriginal1 : tipoVenta; + } + + public Integer getTipoVentaOriginal1() { + return tipoVentaOriginal1; + } + + public void setTipoVentaOriginal1(Integer tipoVentaOriginal1) { + this.tipoVentaOriginal1 = tipoVentaOriginal1; + } + + public Integer getTipoVentaOriginal2() { + return tipoVentaOriginal2; + } + + public void setTipoVentaOriginal2(Integer tipoVentaOriginal2) { + this.tipoVentaOriginal2 = tipoVentaOriginal2; + } + + public Integer getOcdId() { + return ocdId; + } + + public void setOcdId(Integer ocdId) { + this.ocdId = ocdId; + } + + public boolean isVendaManual(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_MANUAL.intValue(); + } + + public boolean isVendaGap(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_BOLETO_REMOTO.intValue() || + tipoVenta == Constantes.TPV_CALL_CENTER.intValue() || + tipoVenta == Constantes.TPV_POR_INTERNET.intValue(); + } + + public boolean isVendaBilheteNormal(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_DIRECTO_NORMAL.intValue(); + } + + public boolean isVendaBilheteTroca(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_TRANSFERENCIAS.intValue(); + } + + public boolean isVendaBilheteTransferencia(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_CAMBIO_VIAJE.intValue(); + } + + public boolean isVendaBilheteManual(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_MANUAL.intValue(); + } + + public boolean isVendaBilheteAberto(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_BOLETO_ABIERTO.intValue(); + } + + public boolean isVendaBilheteConfirmaAberto(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_CONFIRMA_ABIERTO.intValue(); + } + + public boolean isVendaBilheteCheckin(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_CHECKIN_VIAGEM.intValue(); + } + + public boolean isSemMotivocancelacion() { + return getMotivoCancelacionId() == null; + } + + public boolean isMotivocancelacionAgrupamento() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_BOLETO_AGRUPAMENTO.intValue(); + } + + public boolean isMotivocancelacionCancelado() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_CANCELACION.intValue(); + } + + public boolean isMotivocancelacionDevolvido() { + return !isSemMotivocancelacion() && (getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue() || + getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_50.intValue() || + getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_100.intValue()); + } + + public boolean isMotivocancelacionEntregaGap() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_BOLETO_ENTREGADO.intValue(); + } + + public boolean isMotivocancelacionTransferido() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_TRANSFERENCIA.intValue(); + } + + public boolean isMotivocancelacionTrocado() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_TROCA.intValue(); + } + + public boolean isMotivocancelacionCheckin() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_CHECKIN.intValue(); + } + + /** ABA BILHETE MANUAL */ + public boolean isBilhetesManualVendido() { + return isVendaBilheteManual(getTipoVenta()) && isStatusVendido(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteNormalVendido() { + return (isVendaBilheteNormal(getTipoVenta()) && isSemMotivocancelacion() && isStatusVendido()) || // Venda sem alteração + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTrocado()) || // Venda trocada + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTransferido()) || // Venda transferida + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionCancelado()) || // Venda cancelada + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionDevolvido()) || // Venda devolvida + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionAgrupamento()) || // Agrupamento de corrida + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionCheckin()) || // Venda normal Checkin + (isVendaBilheteTroca(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCheckin()) || // Venda troca Checkin + (isVendaBilheteTransferencia(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCheckin()) || // Venda transferencia Checkin + (isVendaBilheteTroca(getTipoVenta()) && isStatusTroca() && isSemMotivocancelacion()) || // Novo bilhete da troca + (isVendaBilheteTroca(getTipoVenta()) && isStatusVendido() && isSemMotivocancelacion()) || // Novo bilhete de agrupamento de corrida + (isVendaBilheteTroca(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido()) || // Novo bilhete da troca devolvido + (isVendaBilheteTransferencia(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado()) || // Novo bilhete transferido devolvido + (isVendaBilheteTroca(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido()) || // Novo bilhete da troca cancelado + (isVendaBilheteTransferencia(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado()) || // Novo bilhete transferido cancelado + (isVendaBilheteTransferencia(getTipoVenta()) && isStatusEntregue() && isSemMotivocancelacion()); // bilhete transferido entregue + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalTrocado() { + return isVendaBilheteNormal(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionTrocado(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteNormalChekin() { + return isVendaBilheteCheckin(getTipoVenta()) && isStatusVendido(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteAberto() { + return isVendaBilheteAberto(getTipoVenta()) && isStatusVendido(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteEntregaAberto() { + return isVendaBilheteConfirmaAberto(getTipoVenta()) && isStatusTroca(); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteAbertoCancelado() { + return isVendaBilheteConfirmaAberto(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionCancelado(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteAbertoDevolvido() { + return isVendaBilheteConfirmaAberto(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalDevolvido() { + return isVendaBilheteNormal(getTipoVenta()) && isMotivocancelacionDevolvido() && isStatusCancelado(); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteNormalCancelado() { + return isVendaBilheteNormal(getTipoVenta()) && isMotivocancelacionCancelado() && isStatusCancelado(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalTrocadoDevolvido() { + return isVendaBilheteTroca(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalTransferidoDevolvido() { + return isVendaBilheteTransferencia(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido(); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteNormalTrocadoCancelado() { + return isVendaBilheteTroca(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionCancelado(); + } + + /** ABA GAP VENDIDA */ + public boolean isBilheteGapVendido() { + return (isVendaGap(getTipoVenta()) && isSemMotivocancelacion() && isStatusVendido() && isSemNumFolioSistema()) || // Gap sem alteração + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionEntregaGap() && isSemNumFolioSistema()) || // Gap entregue + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionEntregaGap() && isSemNumFolioSistema()) || // Gap entregue + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTrocado() && isSemNumFolioSistema()) || // Gap trocada + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTransferido() && isSemNumFolioSistema()) || // Gap transferida + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionCancelado() && isSemNumFolioSistema()) || // Gap cancelada + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionDevolvido() && isSemNumFolioSistema()) || // Gap devolvida + (isVendaGap(getTipoVenta()) && isStatusTroca() && isSemMotivocancelacion() && isSemNumFolioSistema()) || // Gap Novo bilhete da troca + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido() && isSemNumFolioSistema()) || // Gap Novo bilhete da troca devolvido + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado() && isSemNumFolioSistema()) || // Gap Novo bilhete transferido devolvido + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido() && isSemNumFolioSistema()) || // Gap Novo bilhete da troca cancelado + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado() && isSemNumFolioSistema()); // Gap Novo bilhete transferido cancelado + } + + /** ABA GAP DEVOLVIDO */ + public boolean isBilheteGapTrocado() { + return isVendaGap(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionTrocado() && isSemNumFolioSistema(); + } + + /** ABA GAP DEVOLVIDO */ + public boolean isBilheteGapTrocadoDevolvido() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionTrocado() && isStatusCancelado() && isSemNumFolioSistema(); + } + + /** ABA GAP CANCELADO */ + public boolean isBilheteGapTrocadoCancelado() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionCancelado() && isStatusCancelado() && isSemNumFolioSistema(); + } + + /** ABA GAP CANCELADO */ + public boolean isBilheteGapCancelado() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionCancelado() && isStatusCancelado() && isSemNumFolioSistema(); + } + + /** ABA GAP DEVOLVIDO */ + public boolean isBilheteGapDevolvido() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionDevolvido() && isStatusCancelado() && isSemNumFolioSistema(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteEntregaGap() { + return isVendaGap(getTipoVenta()) && isStatusEntregue() && isComNumFolioSistema(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteEntregaGapTrocado() { + return isVendaGap(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionTrocado() && isComNumFolioSistema(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteEntregaGapDevolvido() { + return isVendaGap(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido() && isComNumFolioSistema(); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteEntregaGapCancelado() { + return isVendaGap(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionCancelado() && isComNumFolioSistema(); + } + + public boolean isStatusVendido() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.V); + } + + public boolean isStatusCancelado() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.C); + } + + public boolean isStatusEntregue() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.E); + } + + public boolean isStatusTroca() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.T); + } + + public boolean isStatusExtraviado() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.X); + } + + public boolean isStatusMarcado() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.M); + } + + public String getNombpasajero() { + return nombpasajero; + } + + public void setNombpasajero(String nombpasajero) { + this.nombpasajero = nombpasajero; + } + + public IndStatusBoleto getIndstatusboletoEnum() { + return IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); + } + + public Boolean getIndcarboletosdevolvidosconf() { + return indcarboletosdevolvidosconf; + } + + public void setIndcarboletosdevolvidosconf(Boolean indcarboletosdevolvidosconf) { + this.indcarboletosdevolvidosconf = indcarboletosdevolvidosconf; + } + + public boolean getExigeConferenciaDevolvido() { + return exigeConferenciaDevolvido; + } + + public void setExigeConferenciaDevolvido(boolean exigeConferenciaDevolvido) { + this.exigeConferenciaDevolvido = exigeConferenciaDevolvido; + } + + private boolean isSemNumFolioSistema() { + return StringUtils.isBlank(getNumFolioSistema()); + } + + private boolean isComNumFolioSistema() { + return StringUtils.isNotBlank(getNumFolioSistema()); + } + + public boolean isExigeConferenciaAba() { + return exigeConferenciaAba; + } + + public void setExigeConferenciaAba(boolean exigeConferenciaAba) { + this.exigeConferenciaAba = exigeConferenciaAba; + } + + public Date getFeccorrida() { + return feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public String getFeccorridaServico() { + StringBuilder str = new StringBuilder(); + if(getFeccorrida() != null) { + str.append(DateUtil.getStringDate(getFeccorrida(), "dd/MM")); + } + + if(getCorridaId() != null) { + if(str.length() > 0) { + str.append(" - "); + } + + str.append(getCorridaId()); + } + + return str.toString(); + } + + public boolean isBilheteGap() { + return isBilheteGapVendido() || + isBilheteGapCancelado() || + isBilheteGapTrocado() || + isBilheteGapTrocadoCancelado() || + isBilheteGapTrocadoDevolvido(); + } + + public boolean isTotalizarFormapago() { + boolean totalizar = isTotalizarTipovenda(); + if(totalizar) { + totalizar = !isOcd(); + } + return totalizar; + } + + private boolean isTotalizarTipovenda() { + return isBilhetesManualVendido() || + isBilheteNormalVendido() || + isBilheteNormalTrocado() || + isBilheteNormalTrocadoCancelado() || + isBilheteNormalTrocadoDevolvido() || + isBilheteNormalCancelado() || + isBilheteNormalDevolvido() || + isBilheteAberto() || + isBilheteGapCancelado() || + isBilheteGapDevolvido() || + isBilheteGapVendido() || + isBilheteGapTrocadoCancelado() || + isBilheteGapTrocadoDevolvido(); + + } + +} \ No newline at end of file diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoDesconto.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoDesconto.java new file mode 100644 index 000000000..4b81adfdd --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoDesconto.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; + +public class ComissaoDesconto { + + public enum TipoDesconto { + FIXO, EVENTUAL; + } + + private String nomeDesconto; + private BigDecimal valorDesconto; + private TipoDesconto tipo; + private String tipoDesconto; + + public String getNomeDesconto() { + return nomeDesconto; + } + + public void setNomeDesconto(String nomeDesconto) { + this.nomeDesconto = nomeDesconto; + } + + public BigDecimal getValorDesconto() { + return valorDesconto; + } + + public void setValorDesconto(BigDecimal valorDesconto) { + this.valorDesconto = valorDesconto; + } + + public String getTipoDesconto() { + if(this.tipo != null) + return tipo.toString(); + + return tipoDesconto; + } + + public void setTipoDesconto(String tipoDesconto) { + this.tipoDesconto = tipoDesconto; + } + + public TipoDesconto getTipo() { + return tipo; + } + + public void setTipo(TipoDesconto tipo) { + this.tipo = tipo; + } + + @Override + public String toString() { + return "RegistroCalculoDesconto [nomeDesconto=" + nomeDesconto + ", valorDesconto=" + valorDesconto + ", tipoDesconto=" + tipoDesconto + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoReceita.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoReceita.java new file mode 100644 index 000000000..4067f9d04 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoReceita.java @@ -0,0 +1,266 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +public class ComissaoReceita { + + private Date data; + private BigDecimal receitaComissao; + private BigDecimal receitaBPR; + private BigDecimal receitaGAP; + private BigDecimal gapImpressa; + private BigDecimal internet; + private BigDecimal cancelados; + private BigDecimal canceladosGAP; + private BigDecimal devolvidos; + private BigDecimal devolvidosGAP; + private BigDecimal devolucoesOrigem; + private BigDecimal devolucoesOrigemGAP; + private BigDecimal receitaExcessoBagagem; + private BigDecimal receitaSeguroOpcional; + private BigDecimal receitaSeguroOutros; + private Integer contImpressa; + + private BigDecimal comissaoBPRDiaria; + private BigDecimal comissaoExcessoBagagemDiaria; + private BigDecimal comissaoSegOpcionalDiaria; + private BigDecimal comissaoEntregaPassagemDiaria; + private BigDecimal comissaoOutrosDiaria; + + public ComissaoReceita() { + super(); + this.receitaComissao = BigDecimal.ZERO; + this.receitaBPR = BigDecimal.ZERO; + this.receitaGAP = BigDecimal.ZERO; + this.gapImpressa = BigDecimal.ZERO; + this.internet = BigDecimal.ZERO; + this.cancelados = BigDecimal.ZERO; + this.canceladosGAP = BigDecimal.ZERO; + this.devolvidos = BigDecimal.ZERO; + this.devolvidosGAP = BigDecimal.ZERO; + this.devolucoesOrigem = BigDecimal.ZERO; + this.devolucoesOrigemGAP = BigDecimal.ZERO; + this.receitaExcessoBagagem = BigDecimal.ZERO; + this.receitaSeguroOpcional = BigDecimal.ZERO; + this.receitaSeguroOutros = BigDecimal.ZERO; + this.contImpressa = 0; + this.comissaoBPRDiaria = BigDecimal.ZERO; + this.comissaoExcessoBagagemDiaria = BigDecimal.ZERO; + this.comissaoSegOpcionalDiaria = BigDecimal.ZERO; + this.comissaoEntregaPassagemDiaria = BigDecimal.ZERO; + this.comissaoOutrosDiaria = BigDecimal.ZERO; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public BigDecimal getReceitaComissao() { + return receitaComissao; + } + + public void setReceitaComissao(BigDecimal receitaComissao) { + this.receitaComissao = receitaComissao; + } + + public BigDecimal getReceitaBPR() { + return receitaBPR; + } + + public void setReceitaBPR(BigDecimal receitaBPR) { + this.receitaBPR = receitaBPR; + } + + public BigDecimal getReceitaGAP() { + return receitaGAP; + } + + public void setReceitaGAP(BigDecimal receitaGAP) { + this.receitaGAP = receitaGAP; + } + + public BigDecimal getGapImpressa() { + return gapImpressa; + } + + public void setGapImpressa(BigDecimal gapImpressa) { + this.gapImpressa = gapImpressa; + } + + public BigDecimal getInternet() { + return internet; + } + + public void setInternet(BigDecimal internet) { + this.internet = internet; + } + + public BigDecimal getCancelados() { + return cancelados; + } + + public void setCancelados(BigDecimal cancelados) { + this.cancelados = cancelados; + } + + public BigDecimal getCanceladosGAP() { + return canceladosGAP; + } + + public void setCanceladosGAP(BigDecimal canceladosGAP) { + this.canceladosGAP = canceladosGAP; + } + + public BigDecimal getDevolvidos() { + return devolvidos; + } + + public void setDevolvidos(BigDecimal devolvidos) { + this.devolvidos = devolvidos; + } + + public BigDecimal getDevolvidosRelatorio() { + BigDecimal devolvidos = BigDecimal.ZERO; + devolvidos = devolvidos.add(getDevolvidos() != null ? getDevolvidos() : BigDecimal.ZERO) + .add(getDevolucoesOrigem() != null ? getDevolucoesOrigem() : BigDecimal.ZERO); + return devolvidos; + } + + public BigDecimal getDevolvidosGAPRelatorio() { + BigDecimal devolvidosGap = BigDecimal.ZERO; + devolvidosGap = devolvidosGap.add(getDevolvidosGAP() != null ? getDevolvidosGAP() : BigDecimal.ZERO) + .add(getDevolucoesOrigemGAP() != null ? getDevolucoesOrigemGAP() : BigDecimal.ZERO); + return devolvidos; + } + + public BigDecimal getDevolvidosGAP() { + return devolvidosGAP; + } + + public void setDevolvidosGAP(BigDecimal devolvidosGAP) { + this.devolvidosGAP = devolvidosGAP; + } + + public BigDecimal getDevolucoesOrigem() { + return devolucoesOrigem; + } + + public void setDevolucoesOrigem(BigDecimal devolucoesOrigem) { + this.devolucoesOrigem = devolucoesOrigem; + } + + public BigDecimal getDevolucoesOrigemGAP() { + return devolucoesOrigemGAP; + } + + public void setDevolucoesOrigemGAP(BigDecimal devolucoesOrigemGAP) { + this.devolucoesOrigemGAP = devolucoesOrigemGAP; + } + + public BigDecimal getReceitaExcessoBagagem() { + return receitaExcessoBagagem; + } + + public void setReceitaExcessoBagagem(BigDecimal receitaExcessoBagagem) { + this.receitaExcessoBagagem = receitaExcessoBagagem; + } + + public BigDecimal getReceitaSeguroOpcional() { + return receitaSeguroOpcional; + } + + public void setReceitaSeguroOpcional(BigDecimal receitaSeguroOpcional) { + this.receitaSeguroOpcional = receitaSeguroOpcional; + } + + public Integer getContImpressa() { + return contImpressa; + } + + public void setContImpressa(Integer contImpressa) { + this.contImpressa = contImpressa; + } + + public BigDecimal getComissaoBPRDiaria() { + return comissaoBPRDiaria; + } + + public void setComissaoBPRDiaria(BigDecimal comissaoBPRDiaria) { + this.comissaoBPRDiaria = comissaoBPRDiaria; + } + + public BigDecimal getComissaoExcessoBagagemDiaria() { + return comissaoExcessoBagagemDiaria; + } + + public void setComissaoExcessoBagagemDiaria(BigDecimal comissaoExcessoBagagemDiaria) { + this.comissaoExcessoBagagemDiaria = comissaoExcessoBagagemDiaria; + } + + public BigDecimal getComissaoSegOpcionalDiaria() { + return comissaoSegOpcionalDiaria; + } + + public void setComissaoSegOpcionalDiaria(BigDecimal comissaoSegOpcionalDiaria) { + this.comissaoSegOpcionalDiaria = comissaoSegOpcionalDiaria; + } + + public BigDecimal getComissaoEntregaPassagemDiaria() { + return comissaoEntregaPassagemDiaria; + } + + public void setComissaoEntregaPassagemDiaria(BigDecimal comissaoEntregaPassagemDiaria) { + this.comissaoEntregaPassagemDiaria = comissaoEntregaPassagemDiaria; + } + + public BigDecimal getReceitaSeguroOutros() { + return receitaSeguroOutros; + } + + public void setReceitaSeguroOutros(BigDecimal receitaSeguroOutros) { + this.receitaSeguroOutros = receitaSeguroOutros; + } + + public BigDecimal getComissaoOutrosDiaria() { + return comissaoOutrosDiaria; + } + + public void setComissaoOutrosDiaria(BigDecimal comissaoOutrosDiaria) { + this.comissaoOutrosDiaria = comissaoOutrosDiaria; + } + + @Override + public String toString() { + return "ComissaoReceita [data=" + data + ", receitaComissao=" + receitaComissao + ", receitaBPR=" + receitaBPR + ", receitaGAP=" + receitaGAP + ", gapImpressa=" + gapImpressa + ", internet=" + internet + ", cancelados=" + cancelados + ", canceladosGAP=" + canceladosGAP + ", devolvidos=" + devolvidos + ", devolvidosGAP=" + devolvidosGAP + ", devolucoesOrigem=" + devolucoesOrigem + ", devolucoesOrigemGAP=" + devolucoesOrigemGAP + ", receitaExcessoBagagem=" + receitaExcessoBagagem + ", receitaSeguroOpcional=" + receitaSeguroOpcional + ", contImpressa=" + contImpressa + ", comissaoBPRDiaria=" + comissaoBPRDiaria + ", comissaoExcessoBagagemDiaria=" + comissaoExcessoBagagemDiaria + ", comissaoSegOpcionalDiaria=" + comissaoSegOpcionalDiaria + ", comissaoEntregaPassagemDiaria=" + comissaoEntregaPassagemDiaria + "]"; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getReceitaBPR() != null ? getReceitaBPR() : BigDecimal.ZERO) + .add(getReceitaGAP() != null ? getReceitaGAP() : BigDecimal.ZERO) + .subtract(getGapImpressa() != null ? getGapImpressa() : BigDecimal.ZERO) + .subtract(getInternet() != null ? getInternet() : BigDecimal.ZERO) + .subtract(getCancelados() != null ? getCancelados() : BigDecimal.ZERO) + .subtract(getCanceladosGAP() != null ? getCanceladosGAP() : BigDecimal.ZERO) + .add(getReceitaExcessoBagagem() != null ? getReceitaExcessoBagagem() : BigDecimal.ZERO) + .add(getReceitaSeguroOpcional() != null ? getReceitaSeguroOpcional() : BigDecimal.ZERO) + .add(getReceitaSeguroOutros() != null ? getReceitaSeguroOutros() : BigDecimal.ZERO); + return total; + } + + public BigDecimal getTotalComissao() { + BigDecimal totalComissao = BigDecimal.ZERO; + totalComissao = totalComissao.add(getComissaoBPRDiaria() != null ? getComissaoBPRDiaria() : BigDecimal.ZERO) + .add(getComissaoEntregaPassagemDiaria() != null ? getComissaoEntregaPassagemDiaria() : BigDecimal.ZERO) + .add(getComissaoExcessoBagagemDiaria() != null ? getComissaoExcessoBagagemDiaria() : BigDecimal.ZERO) + .add(getComissaoOutrosDiaria() != null ? getComissaoOutrosDiaria() : BigDecimal.ZERO) + .add(getComissaoSegOpcionalDiaria() != null ? getComissaoSegOpcionalDiaria() : BigDecimal.ZERO); + return totalComissao; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ConferenciaComissaoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ConferenciaComissaoVO.java new file mode 100644 index 000000000..f1cd65663 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ConferenciaComissaoVO.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Set; + +public class ConferenciaComissaoVO implements Comparable { + + private Integer puntoventaId; + private String nombpuntoventa; + private String numPuntoVenta; + private String competencia; + private Date datamovimento; + + private Set diasSemMovimentos; + + private List dias; + + public ConferenciaComissaoVO() { + super(); + } + + public ConferenciaComissaoVO(Integer puntoventaId, String competencia) { + this(); + this.puntoventaId = puntoventaId; + this.competencia = competencia; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public List getDias() { + return dias; + } + + public void setDias(List dias) { + this.dias = dias; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getCompetencia() { + return competencia; + } + + public void setCompetencia(String competencia) { + this.competencia = competencia; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((competencia == null) ? 0 : competencia.hashCode()); + result = prime * result + ((puntoventaId == null) ? 0 : puntoventaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ConferenciaComissaoVO other = (ConferenciaComissaoVO) obj; + if (competencia == null) { + if (other.competencia != null) + return false; + } else if (!competencia.equals(other.competencia)) + return false; + if (puntoventaId == null) { + if (other.puntoventaId != null) + return false; + } else if (!puntoventaId.equals(other.puntoventaId)) + return false; + return true; + } + + public Set getDiasSemMovimentos() { + return diasSemMovimentos; + } + + public void setDiasSemMovimentos(Set diasSemMovimentos) { + this.diasSemMovimentos = diasSemMovimentos; + } + + public List getDiasOrdenado() { + Collections.sort(getDias()); + return getDias(); + } + + @Override + public int compareTo(ConferenciaComissaoVO o) { + return this.getNombpuntoventa().compareToIgnoreCase(o.getNombpuntoventa()); + } + + public Date getDatamovimento() { + return datamovimento; + } + + public void setDatamovimento(Date datamovimento) { + this.datamovimento = datamovimento; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/DiaConferenciaComissaoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/DiaConferenciaComissaoVO.java new file mode 100644 index 000000000..948e720f3 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/DiaConferenciaComissaoVO.java @@ -0,0 +1,156 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.enums.comissao.CoresConferencia; + +public class DiaConferenciaComissaoVO implements Comparable { + + private Integer dia; + private Date data; + private Long conferenciaId; + + private Boolean indboletogerado; + private Boolean indconferido; + private Boolean indpendencia; + private Boolean indsemmovimento; + private Boolean indmaloterecebido; + + public DiaConferenciaComissaoVO() { + super(); + this.indboletogerado = Boolean.FALSE; + this.indconferido = Boolean.FALSE; + this.indpendencia = Boolean.FALSE; + this.indsemmovimento = Boolean.FALSE; + this.indmaloterecebido = Boolean.FALSE; + } + + public DiaConferenciaComissaoVO(Integer dia) { + this(); + this.dia = dia; + } + + public Integer getDia() { + return dia; + } + + public void setDia(Integer dia) { + this.dia = dia; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dia == null) ? 0 : dia.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + DiaConferenciaComissaoVO other = (DiaConferenciaComissaoVO) obj; + if (dia == null) { + if (other.dia != null) + return false; + } else if (!dia.equals(other.dia)) + return false; + return true; + } + + @Override + public int compareTo(DiaConferenciaComissaoVO o) { + return this.getDia().compareTo(o.getDia()); + } + + public CoresConferencia getCor() { + CoresConferencia cor = CoresConferencia.BRANCO; + + if (getIndsemmovimento() != null && getIndsemmovimento()) { + cor = CoresConferencia.BRANCO; + } + + if ((getIndsemmovimento() == null || !getIndsemmovimento()) && (getIndmaloterecebido() == null || !getIndmaloterecebido())) { + cor = CoresConferencia.PRETO; + } + + if (getIndmaloterecebido() != null && getIndmaloterecebido()) { + if (getIndconferido() == null || !getIndconferido()) { + cor = CoresConferencia.VERMELHO; + } + } + + if (getIndconferido() != null && getIndconferido()) { + if (getIndboletogerado() != null && getIndboletogerado()) { + cor = CoresConferencia.AZUL; + if (getIndpendencia() != null && getIndpendencia()) { + cor = CoresConferencia.AMARELO; + } + } else if (getIndboletogerado() == null || !getIndboletogerado()) { + cor = CoresConferencia.LARANJA; + } + } + + return cor; + } + + public Boolean getIndboletogerado() { + return indboletogerado; + } + + public void setIndboletogerado(Boolean indboletogerado) { + this.indboletogerado = indboletogerado; + } + + public Boolean getIndconferido() { + return indconferido; + } + + public void setIndconferido(Boolean indconferido) { + this.indconferido = indconferido; + } + + public Boolean getIndpendencia() { + return indpendencia; + } + + public void setIndpendencia(Boolean indpendencia) { + this.indpendencia = indpendencia; + } + + public Boolean getIndsemmovimento() { + return indsemmovimento; + } + + public void setIndsemmovimento(Boolean indsemmovimento) { + this.indsemmovimento = indsemmovimento; + } + + public Boolean getIndmaloterecebido() { + return indmaloterecebido; + } + + public void setIndmaloterecebido(Boolean indmaloterecebido) { + this.indmaloterecebido = indmaloterecebido; + } + + public Long getConferenciaId() { + return conferenciaId; + } + + public void setConferenciaId(Long conferenciaId) { + this.conferenciaId = conferenciaId; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/EtiquetaMalote.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/EtiquetaMalote.java new file mode 100644 index 000000000..2a433acf9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/EtiquetaMalote.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class EtiquetaMalote { + + private Integer empresaId; + private String nombempresa; + private Integer puntoventaId; + private String nombpuntoventa; + + private String numeroMalote; + private Date dataInicial; + private Date dataFinal; + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumeroMalote() { + return numeroMalote; + } + + public void setNumeroMalote(String numeroMalote) { + this.numeroMalote = numeroMalote; + } + + public Date getDataInicial() { + return dataInicial; + } + + public void setDataInicial(Date dataInicial) { + this.dataInicial = dataInicial; + } + + public Date getDataFinal() { + return dataFinal; + } + + public void setDataFinal(Date dataFinal) { + this.dataFinal = dataFinal; + } + + public String getDatasMalote() { + return DateUtil.getStringDate(getDataInicial(), "dd/MM/yyyy") + " - " + DateUtil.getStringDate(getDataFinal(), "dd/MM/yyyy"); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java new file mode 100644 index 000000000..b30ba8ff2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java @@ -0,0 +1,194 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +import org.apache.commons.lang.StringUtils; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; + +public class EventosFinanceirosVO { + + private Long eventoextraId; + private String numdocumento; + private Date fechoringreso; + private BigDecimal impingreso; + private String desctipoevento; + private String descinfo; + private Integer status; + private Integer formapagoId; + private String descpago; + private Boolean indconferenciafisicacomissao; + private String indtipo; /* 0- Debito, 1- Credito */ + private String nombusuario; + + private Integer comemptipoeventoextraId; + private Integer comempformapagoId; + + private Long logconferenciaId; + private boolean conferido; + + private Boolean exigeConferenciaAba; + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public String getNumdocumento() { + return numdocumento; + } + + public void setNumdocumento(String numdocumento) { + this.numdocumento = numdocumento; + } + + public Date getFechoringreso() { + return fechoringreso; + } + + public void setFechoringreso(Date fechoringreso) { + this.fechoringreso = fechoringreso; + } + + public BigDecimal getImpingreso() { + return impingreso; + } + + public void setImpingreso(BigDecimal impingreso) { + this.impingreso = impingreso; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public String getDescinfo() { + return descinfo; + } + + public void setDescinfo(String descinfo) { + this.descinfo = descinfo; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if(statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public boolean isCredito() { + return StringUtils.isNotBlank(getIndtipo()) && "1".equals(getIndtipo()); + } + + public boolean isDebito() { + return StringUtils.isNotBlank(getIndtipo()) && "0".equals(getIndtipo()); + } + + public String getDebitoCredito() { + return isCredito() ? Labels.getLabel("conferenciaController.lbCredito.value") : Labels.getLabel("conferenciaController.lbDebito.value"); + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public boolean isConferido() { + return conferido; + } + + public void setConferido(boolean conferido) { + this.conferido = conferido; + } + + public Integer getComemptipoeventoextraId() { + return comemptipoeventoextraId; + } + + public void setComemptipoeventoextraId(Integer comemptipoeventoextraId) { + this.comemptipoeventoextraId = comemptipoeventoextraId; + } + + public Integer getComempformapagoId() { + return comempformapagoId; + } + + public void setComempformapagoId(Integer comempformapagoId) { + this.comempformapagoId = comempformapagoId; + } + + public boolean isExigeConferencia() { + return getComemptipoeventoextraId() != null || getComempformapagoId() != null; + } + + public Boolean getExigeConferenciaAba() { + return exigeConferenciaAba; + } + + public void setExigeConferenciaAba(Boolean exigeConferenciaAba) { + this.exigeConferenciaAba = exigeConferenciaAba; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/FormapagoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/FormapagoVO.java new file mode 100644 index 000000000..b21ef671d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/FormapagoVO.java @@ -0,0 +1,94 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; + +public class FormapagoVO { + + private Integer formapagoId; + private String descpago; + private Boolean indconferenciafisicacomissao; + private BigDecimal importe; + + public FormapagoVO() { + super(); + } + + public FormapagoVO(Integer formapagoId, String descpago, Boolean indconferenciafisicacomissao, BigDecimal importeFp) { + this(); + this.formapagoId = formapagoId; + this.descpago = descpago; + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + this.importe = importeFp; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((formapagoId == null) ? 0 : formapagoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + FormapagoVO other = (FormapagoVO) obj; + if (formapagoId == null) { + if (other.formapagoId != null) + return false; + } else if (!formapagoId.equals(other.formapagoId)) + return false; + return true; + } + + public String getImporteFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getImporte(), LocaleUtil.getLocale()); + } + + public void add(BigDecimal importe) { + this.importe = this.importe.add(importe != null ? importe : BigDecimal.ZERO); + } + + public void subtract(BigDecimal importe) { + this.importe = this.importe.subtract(importe != null ? importe : BigDecimal.ZERO); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/HistoricoComissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/HistoricoComissao.java new file mode 100644 index 000000000..57eef6c36 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/HistoricoComissao.java @@ -0,0 +1,281 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.NumberFormat; +import java.text.ParseException; + +import org.brazilutils.text.RealToWords; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; + +public class HistoricoComissao extends Comissao { + + private static final Logger log = LoggerFactory.getLogger(HistoricoComissao.class); + + private static final long serialVersionUID = 1L; + + private static final NumberFormat NF = NumberFormat.getCurrencyInstance(LocaleUtil.getLocale()); + + private String pagamento; + private String usuarioPagamento; + private String usuarioLancamento; + private String nombpuntoventa; + private String numpuntoventa; + private String sigla; + private String nome; + private String banco; + private String conta; + private String agencia; + private String cidade; + private String nombempresa; + private String cnpj; + private String descCorreo; + + public HistoricoComissao() { + super(); + setComissaoBpr(BigDecimal.ZERO); + setReceitaExcessobagagem(BigDecimal.ZERO); + setReceitaSeguroopcional(BigDecimal.ZERO); + setReceitaOutros(BigDecimal.ZERO); + setDescontosFixos(BigDecimal.ZERO); + setDescontosEventuais(BigDecimal.ZERO); + setRoyaties(BigDecimal.ZERO); + setIssRetido(BigDecimal.ZERO); + setBonificacaoMetas(BigDecimal.ZERO); + setEntregasPassagem(BigDecimal.ZERO); + } + + public String getPagamento() { + return pagamento; + } + + public void setPagamento(String pagamento) { + this.pagamento = pagamento; + } + + public String getUsuarioPagamento() { + return usuarioPagamento; + } + + public void setUsuarioPagamento(String usuarioPagamento) { + this.usuarioPagamento = usuarioPagamento; + } + + public String getUsuarioLancamento() { + return usuarioLancamento; + } + + public void setUsuarioLancamento(String usuarioLancamento) { + this.usuarioLancamento = usuarioLancamento; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumpuntoventa() { + return numpuntoventa; + } + + public void setNumpuntoventa(String numpuntoventa) { + this.numpuntoventa = numpuntoventa; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getComissaoBpr() != null ? getComissaoBpr() : BigDecimal.ZERO) + .add(getReceitaExcessobagagem() != null ? getReceitaExcessobagagem() : BigDecimal.ZERO) + .add(getReceitaSeguroopcional() != null ? getReceitaSeguroopcional() : BigDecimal.ZERO) + .add(getReceitaOutros() != null ? getReceitaOutros() : BigDecimal.ZERO) + .add(getBonificacaoMetas() != null ? getBonificacaoMetas() : BigDecimal.ZERO) + .add(getEntregasPassagem() != null ? getEntregasPassagem() : BigDecimal.ZERO); + + total = total.setScale(2, RoundingMode.HALF_UP); + + return total; + } + + public BigDecimal getTotalLiquido() { + BigDecimal totalLiquido = getTotal(); + totalLiquido = totalLiquido.subtract(getDescontosEventuais() != null ? getDescontosEventuais() : BigDecimal.ZERO) + .subtract(getDescontosFixos() != null ? getDescontosFixos() : BigDecimal.ZERO) + .subtract(getIssRetido() != null ? getIssRetido() : BigDecimal.ZERO) + .subtract(getRoyaties() != null ? getRoyaties() : BigDecimal.ZERO); + + totalLiquido = totalLiquido.setScale(2, RoundingMode.HALF_UP); + + return totalLiquido; + } + + public String getSigla() { + return sigla; + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getBanco() { + return banco; + } + + public void setBanco(String banco) { + this.banco = banco; + } + + public String getConta() { + return conta; + } + + public void setConta(String conta) { + this.conta = conta; + } + + public String getAgencia() { + return agencia; + } + + public void setAgencia(String agencia) { + this.agencia = agencia; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getTexto() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.texto", + new String[]{getNombempresa(), + getCnpj(), + getTextoValor()}); + } + + public String getTexto1() { + try { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.texto1", + new String[]{DateUtil.getStringDate(DateUtil.getDataInicialCompetencia(getCompetencia()), "dd/MM/yyyy"), + DateUtil.getStringDate(DateUtil.getDataFinalCompetencia(getCompetencia()), "dd/MM/yyyy")}); + } catch (ParseException e) { + log.error(e.getMessage(), e); + } + return null; + } + + public String getTexto2() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.texto2"); + } + + private String getTextoValor() { + StringBuilder sTextoValor = new StringBuilder(); + sTextoValor.append(NF.format(getTotalLiquido().doubleValue())) + .append(" (") + .append(new RealToWords().toWords(getTotalLiquido())) + .append(") **********"); + return sTextoValor.toString(); + } + + public String getMsg() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.msg", new String[]{getNombempresa()}); + } + + public String getMsg1() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.msg1", new String[]{getNombempresa()}); + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + @Override + public BigDecimal getComissaoBpr() { + return super.getComissaoBpr() != null ? super.getComissaoBpr() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getReceitaExcessobagagem() { + return super.getReceitaExcessobagagem() != null ? super.getReceitaExcessobagagem() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getReceitaSeguroopcional() { + return super.getReceitaSeguroopcional() != null ? super.getReceitaSeguroopcional() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getDescontosFixos() { + return super.getDescontosFixos() != null ? super.getDescontosFixos() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getDescontosEventuais() { + return super.getDescontosEventuais() != null ? super.getDescontosEventuais() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getRoyaties() { + return super.getRoyaties() != null ? super.getRoyaties() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getIssRetido() { + return super.getIssRetido() != null ? super.getIssRetido() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getBonificacaoMetas() { + return super.getBonificacaoMetas() != null ? super.getBonificacaoMetas() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getEntregasPassagem() { + return super.getEntregasPassagem() != null ? super.getEntregasPassagem() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getReceitaOutros() { + return super.getReceitaOutros() != null ? super.getReceitaOutros() : BigDecimal.ZERO; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/LogConferenciaVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/LogConferenciaVO.java new file mode 100644 index 000000000..51e59259f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/LogConferenciaVO.java @@ -0,0 +1,262 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.constantes.DescricaoTipoVenta; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.enums.comissao.TipoLogConferencia; + +public class LogConferenciaVO { + + private Long logconferenciaId; + private String observacao; + private BigDecimal preco; + private Integer status; + private String numfoliosistema; + private Long boletoId; + private Long eventoextraId; + private Long ocdId; + private Integer tipo; + private String numoperacion; + private String desctipoevento; + private String nombusuario; + private Date fecmodif; + private boolean indcredito; + private String nombempresa; + private String nombpuntoventa; + private Date datamovimento; + private String desccategoria; + private Integer tipoventa; + private String descinfoevento; + + public LogConferenciaVO() { + super(); + } + + public LogConferenciaVO(Long logconferenciaId, String observacao, BigDecimal preco, Integer status, String numfoliosistema) { + this(); + this.logconferenciaId = logconferenciaId; + this.observacao = observacao; + this.preco = preco; + this.status = status; + this.numfoliosistema = numfoliosistema; + } + + public LogConferenciaVO(Long logconferenciaId) { + this(); + this.logconferenciaId = logconferenciaId; + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public String getObservacao() { + return observacao; + } + + public void setObservacao(String observacao) { + this.observacao = observacao; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getNumfoliosistema() { + return numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if(statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Long getOcdId() { + return ocdId; + } + + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + public Integer getTipo() { + return tipo; + } + + public void setTipo(Integer tipo) { + this.tipo = tipo; + } + + public String getTipoDescricao() { + TipoLogConferencia tipoLogConferencia = TipoLogConferencia.getTipoLogConferencia(tipo); + if(tipoLogConferencia != null) { + return tipoLogConferencia.toString(); + } + return ""; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((logconferenciaId == null) ? 0 : logconferenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + LogConferenciaVO other = (LogConferenciaVO) obj; + if (logconferenciaId == null) { + if (other.logconferenciaId != null) + return false; + } else if (!logconferenciaId.equals(other.logconferenciaId)) + return false; + return true; + } + + public boolean isIndcredito() { + return indcredito; + } + + public void setIndcredito(boolean indcredito) { + this.indcredito = indcredito; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public Date getDatamovimento() { + return datamovimento; + } + + public void setDatamovimento(Date datamovimento) { + this.datamovimento = datamovimento; + } + + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + + public String getDebitoCredito() { + return isIndcredito() ? "C" : "D"; + } + + public Integer getTipoventa() { + return tipoventa; + } + + public void setTipoventa(Integer tipoventa) { + this.tipoventa = tipoventa; + } + + public String getDescinfoevento() { + return descinfoevento; + } + + public void setDescinfoevento(String descinfoevento) { + this.descinfoevento = descinfoevento; + } + + public String getDescricaoTipoventa() { + return DescricaoTipoVenta.getDescricaoTipoVenta(getTipoventa()); + } + + public String getDescdebitocredito() { + return isIndcredito() ? "C" : "D"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/MovimentosAtrasoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/MovimentosAtrasoVO.java new file mode 100644 index 000000000..206437da8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/MovimentosAtrasoVO.java @@ -0,0 +1,232 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.Date; +import java.util.Set; + +import com.rjconsultores.ventaboletos.constantes.Constantes; + +public class MovimentosAtrasoVO implements Comparable { + + private Integer puntoventaId; + private String nombpuntoventa; + private String numPuntoVenta; + private String competencia; + private Integer diasemtransito; + private Date dataMovimento; + private SituacaoDiaMovimento situacao; + private String numtelefonouno; + private String uf; + private String nombpuntoventaPadre; + private Integer intervalofechamento; + + private Set diasEmAtraso; + + public MovimentosAtrasoVO() { + super(); + } + + public MovimentosAtrasoVO(Integer puntoventaId, Date dataMovimento) { + this(); + this.puntoventaId = puntoventaId; + this.dataMovimento = dataMovimento; + } + + public MovimentosAtrasoVO(Integer puntoventaId, String nombpuntoventa, String numPuntoVenta, String competencia, Integer diasemtransito, Date dataMovimento, SituacaoDiaMovimento situacao, Integer intervalofechamento, String nombpuntoventaPadre, String uf, String numtelefonouno) { + this(); + this.puntoventaId = puntoventaId; + this.nombpuntoventa = nombpuntoventa; + this.numPuntoVenta = numPuntoVenta; + this.competencia = competencia; + this.diasemtransito = diasemtransito; + this.dataMovimento = dataMovimento; + this.situacao = situacao; + this.intervalofechamento = intervalofechamento; + this.nombpuntoventaPadre = nombpuntoventaPadre; + this.uf = uf; + this.numtelefonouno = numtelefonouno; + + /*movimentosAtrasoVO.setIntervalofechamento(rset.getInt("INTERVALOFECHAMENTO")); + movimentosAtrasoVO.setNombpuntoventaPadre(rset.getString("NOMPUNTOVENTAPADRE")); + movimentosAtrasoVO.setUf(rset.getString("UF")); + movimentosAtrasoVO.setNumtelefonouno(rset.getString("NUMTELEFONOUNO"));*/ + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public String getCompetencia() { + return competencia; + } + + public void setCompetencia(String competencia) { + this.competencia = competencia; + } + + public enum SituacaoDiaMovimento { + ENTREGUE("EN","Entregue"), + ATRASADO("AT","Atrasado"), + AGUARDANDO("AG","Aguardando"); + + private String shortDescricao; + private String descricao; + + private SituacaoDiaMovimento(String shortDescricao, String descricao) { + this.shortDescricao = shortDescricao; + this.descricao = descricao; + } + + public String getShortDescricao() { + return shortDescricao; + } + + @Override + public String toString() { + return this.descricao; + } + + } + + @Override + public int compareTo(MovimentosAtrasoVO o) { + return this.nombpuntoventa.compareTo(o.nombpuntoventa); + } + + public Integer getDiasemtransito() { + return diasemtransito; + } + + public void setDiasemtransito(Integer diasemtransito) { + this.diasemtransito = diasemtransito; + } + + public Date getDataMovimento() { + return dataMovimento; + } + + public void setDataMovimento(Date dataMovimento) { + this.dataMovimento = dataMovimento; + } + + public SituacaoDiaMovimento getSituacao() { + return situacao; + } + + public void setSituacao(SituacaoDiaMovimento situacao) { + this.situacao = situacao; + } + + public String getDescricaoSituacao() { + return getSituacao() != null ? getSituacao().toString() : ""; + } + + public String getShortDescricaoSituacao() { + return getSituacao() != null ? getSituacao().getShortDescricao() : ""; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dataMovimento == null) ? 0 : dataMovimento.hashCode()); + result = prime * result + ((puntoventaId == null) ? 0 : puntoventaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + MovimentosAtrasoVO other = (MovimentosAtrasoVO) obj; + if (puntoventaId == null) { + if (other.puntoventaId != null) + return false; + } else if (!puntoventaId.equals(other.puntoventaId)) + return false; + return true; + } + + public String getNumtelefonouno() { + return numtelefonouno; + } + + public void setNumtelefonouno(String numtelefonouno) { + this.numtelefonouno = numtelefonouno; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getNombpuntoventaPadre() { + return nombpuntoventaPadre; + } + + public void setNombpuntoventaPadre(String nombpuntoventaPadre) { + this.nombpuntoventaPadre = nombpuntoventaPadre; + } + + public Integer getIntervalofechamento() { + return intervalofechamento; + } + + public void setIntervalofechamento(Integer intervalofechamento) { + this.intervalofechamento = intervalofechamento; + } + + public Set getDiasEmAtraso() { + return diasEmAtraso; + } + + public void setDiasEmAtraso(Set diasEmAtraso) { + this.diasEmAtraso = diasEmAtraso; + } + + public String getStrDiasEmAtraso() { + return getDiasEmAtraso().toString().replaceAll("[^0-9,]", ""); + } + + public String getDesIntervalofechamento() { + switch (intervalofechamento) { + case Constantes.INTERVALO_FECHAMENTO_DIARIO: + return "Diário"; + case Constantes.INTERVALO_FECHAMENTO_SEMANAL: + return "Semanal"; + case Constantes.INTERVALO_FECHAMENTO_DECENDIAL: + return "Decendial"; + case Constantes.INTERVALO_FECHAMENTO_QUINZENAL: + return "Quinzenal"; + case Constantes.INTERVALO_FECHAMENTO_MENSAL: + return "Mensal"; + default: + return ""; + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/OcdVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/OcdVO.java new file mode 100644 index 000000000..8263dfe14 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/OcdVO.java @@ -0,0 +1,264 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +import org.apache.commons.lang.StringUtils; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; + +public class OcdVO { + + private Long ocdId; + + private Long boletoId; + private Integer puntoventaId; + + private String numoperacion; + + private Date fecpagar; + private BigDecimal valorPagar; + private BigDecimal penalizacion; + + private Integer usuarioIncId; + private Date fecinc; + + private Boolean indpago; + private Integer usuarioPagoId; + private Date fecpago; + private Integer puntoventapagoId; + + private Date fecmodif; + private Integer usuarioId; + private Boolean activo; + private String nombusuario; + private String login; + private String numFolioSistema; + + private Integer status; + private Long logconferenciaId; + private boolean conferido; + + private boolean exigeConferenciaAba; + + public Long getOcdId() { + return ocdId; + } + + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public Date getFecpagar() { + return fecpagar; + } + + public void setFecpagar(Date fecpagar) { + this.fecpagar = fecpagar; + } + + public BigDecimal getValorPagar() { + return valorPagar; + } + + public void setValorPagar(BigDecimal valorPagar) { + this.valorPagar = valorPagar; + } + + public BigDecimal getPenalizacion() { + return penalizacion; + } + + public void setPenalizacion(BigDecimal penalizacion) { + this.penalizacion = penalizacion; + } + + public Integer getUsuarioIncId() { + return usuarioIncId; + } + + public void setUsuarioIncId(Integer usuarioIncId) { + this.usuarioIncId = usuarioIncId; + } + + public Date getFecinc() { + return fecinc; + } + + public void setFecinc(Date fecinc) { + this.fecinc = fecinc; + } + + public Boolean getIndpago() { + return indpago; + } + + public void setIndpago(Boolean indpago) { + this.indpago = indpago; + } + + public Integer getUsuarioPagoId() { + return usuarioPagoId; + } + + public void setUsuarioPagoId(Integer usuarioPagoId) { + this.usuarioPagoId = usuarioPagoId; + } + + public Date getFecpago() { + return fecpago; + } + + public void setFecpago(Date fecpago) { + this.fecpago = fecpago; + } + + public Integer getPuntoventapagoId() { + return puntoventapagoId; + } + + public void setPuntoventapagoId(Integer puntoventapagoId) { + this.puntoventapagoId = puntoventapagoId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if(statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public String getDescindpago() { + return getIndpago() != null && getIndpago() ? Labels.getLabel("conferenciaController.lbl.sim") : Labels.getLabel("conferenciaController.lbl.nao"); + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public String getValorPagarFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getValorPagar(), LocaleUtil.getLocale()); + } + + public String getPenalizacionFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getPenalizacion(), LocaleUtil.getLocale()); + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public boolean isConferido() { + return conferido; + } + + public void setConferido(boolean conferido) { + this.conferido = conferido; + } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public String getNombusuarioLogin() { + StringBuilder nombusuarioLogin = new StringBuilder(); + + nombusuarioLogin.append(StringUtils.isNotBlank(getNombusuario()) ? getNombusuario() : ""); + + if(nombusuarioLogin.length() > 0) { + nombusuarioLogin.append(" - ") + .append(StringUtils.isNotBlank(getLogin()) ? getLogin() : ""); + } + + return nombusuarioLogin.toString(); + } + + public boolean isExigeConferenciaAba() { + return exigeConferenciaAba; + } + + public void setExigeConferenciaAba(boolean exigeConferenciaAba) { + this.exigeConferenciaAba = exigeConferenciaAba; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/RegistroCalculo.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/RegistroCalculo.java new file mode 100644 index 000000000..55f422bed --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/RegistroCalculo.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.List; + +public class RegistroCalculo { + + private BigDecimal comissaoPagar; + private BigDecimal comissaoBPR; + private BigDecimal comissaoSegOpcional; + private BigDecimal comissaoExcessoBagagem; + private BigDecimal comissaoEntregaPassagem; + private BigDecimal comissaoOutros; + private BigDecimal comissaoBonificaoMetas; + + private BigDecimal royaties; + private BigDecimal retidoISS; + + private BigDecimal descontos; + private List lsDescontos; + private List lsReceitas; + + private String nombpuntoventa; + private String numPuntoVenta; + + public BigDecimal getComissaoPagar() { + return comissaoPagar; + } + + public void setComissaoPagar(BigDecimal comissaoPagar) { + this.comissaoPagar = comissaoPagar; + } + + public BigDecimal getComissaoBPR() { + return comissaoBPR; + } + + public void setComissaoBPR(BigDecimal comissaoBPR) { + this.comissaoBPR = comissaoBPR; + } + + public BigDecimal getComissaoSegOpcional() { + return comissaoSegOpcional; + } + + public void setComissaoSegOpcional(BigDecimal comissaoSegOpcional) { + this.comissaoSegOpcional = comissaoSegOpcional; + } + + public BigDecimal getComissaoExcessoBagagem() { + return comissaoExcessoBagagem; + } + + public void setComissaoExcessoBagagem(BigDecimal comissaoExcessoBagagem) { + this.comissaoExcessoBagagem = comissaoExcessoBagagem; + } + + public BigDecimal getComissaoEntregaPassagem() { + return comissaoEntregaPassagem; + } + + public void setComissaoEntregaPassagem(BigDecimal comissaoEntregaPassagem) { + this.comissaoEntregaPassagem = comissaoEntregaPassagem; + } + + public BigDecimal getComissaoBonificaoMetas() { + return comissaoBonificaoMetas; + } + + public void setComissaoBonificaoMetas(BigDecimal comissaoBonificaoMetas) { + this.comissaoBonificaoMetas = comissaoBonificaoMetas; + } + + public BigDecimal getRoyaties() { + return royaties; + } + + public void setRoyaties(BigDecimal royaties) { + this.royaties = royaties; + } + + public BigDecimal getRetidoISS() { + return retidoISS; + } + + public void setRetidoISS(BigDecimal retidoISS) { + this.retidoISS = retidoISS; + } + + public BigDecimal getDescontos() { + return descontos; + } + + public void setDescontos(BigDecimal descontos) { + this.descontos = descontos; + } + + public List getLsDescontos() { + return lsDescontos; + } + + public void setLsDescontos(List lsDescontos) { + this.lsDescontos = lsDescontos; + } + + public List getLsReceitas() { + return lsReceitas; + } + + public void setLsReceitas(List lsReceitas) { + this.lsReceitas = lsReceitas; + } + + public BigDecimal getComissaoOutros() { + return comissaoOutros; + } + + public void setComissaoOutros(BigDecimal comissaoOutros) { + this.comissaoOutros = comissaoOutros; + } + + @Override + public String toString() { + return "RegistroCalculo [comissaoPagar=" + comissaoPagar + ", comissaoBPR=" + comissaoBPR + ", comissaoSegOpcional=" + comissaoSegOpcional + ", comissaoExcessoBagagem=" + comissaoExcessoBagagem + ", comissaoEntregaPassagem=" + comissaoEntregaPassagem + ", comissaoBonificaoMetas=" + comissaoBonificaoMetas + ", royaties=" + royaties + ", retidoISS=" + retidoISS + ", descontos=" + descontos + ", lsDescontos=" + lsDescontos + ", lsReceitas=" + lsReceitas + "]"; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ResumoComissao.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ResumoComissao.java new file mode 100644 index 000000000..54f5fe2d2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/comissao/ResumoComissao.java @@ -0,0 +1,130 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; + +public class ResumoComissao { + + private BigDecimal totalVendas; + private BigDecimal totalCancelados; + private BigDecimal totalDevolvidos; + private BigDecimal totalTroca; + private BigDecimal totalReceitas; + private BigDecimal totalDespesas; + private BigDecimal valorDeposito; + private OcdVO totalOcd; + + private List totalFormapago; + + public BigDecimal getTotalVendas() { + return totalVendas; + } + + public void setTotalVendas(BigDecimal totalVendas) { + this.totalVendas = totalVendas; + } + + public BigDecimal getTotalCancelados() { + return totalCancelados; + } + + public void setTotalCancelados(BigDecimal totalCancelados) { + this.totalCancelados = totalCancelados; + } + + public BigDecimal getTotalDevolvidos() { + return totalDevolvidos; + } + + public void setTotalDevolvidos(BigDecimal totalDevolvidos) { + this.totalDevolvidos = totalDevolvidos; + } + + public BigDecimal getTotalTroca() { + return totalTroca; + } + + public void setTotalTroca(BigDecimal totalTroca) { + this.totalTroca = totalTroca; + } + + public BigDecimal getTotalReceitas() { + return totalReceitas; + } + + public void setTotalReceitas(BigDecimal totalReceitas) { + this.totalReceitas = totalReceitas; + } + + public BigDecimal getTotalDespesas() { + return totalDespesas; + } + + public void setTotalDespesas(BigDecimal totalDespesas) { + this.totalDespesas = totalDespesas; + } + + public BigDecimal getValorDeposito() { + return valorDeposito; + } + + public void setValorDeposito(BigDecimal valorDeposito) { + this.valorDeposito = valorDeposito; + } + + public List getTotalFormapago() { + return totalFormapago; + } + + public void setTotalFormapago(List totalFormapago) { + this.totalFormapago = totalFormapago; + } + + public OcdVO getTotalOcd() { + return totalOcd; + } + + public void setTotalOcd(OcdVO totalOcd) { + this.totalOcd = totalOcd; + } + + public String getTotalVendasFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalVendas(), LocaleUtil.getLocale()); + } + + public String getTotalCanceladosFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalCancelados(), LocaleUtil.getLocale()); + } + + public String getTotalDevolvidosFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDevolvidos(), LocaleUtil.getLocale()); + } + + public String getTotalTrocaFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalTroca(), LocaleUtil.getLocale()); + } + + public String getTotalReceitasFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalReceitas(), LocaleUtil.getLocale()); + } + + public String getTotalDespesasFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDespesas(), LocaleUtil.getLocale()); + } + + public BigDecimal getTotalDiferenca() { + return getTotalReceitas().subtract(getTotalDespesas()); + } + + public String getTotalDiferencaFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDiferenca(), LocaleUtil.getLocale()); + } + + public String getValorDepositoFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getValorDeposito(), LocaleUtil.getLocale()); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java new file mode 100644 index 000000000..a727bda18 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.vo.conexion; + +public class ConexionVO { + private String conOrigen; + private String conDestino; + private Integer grupo; + private String tramoOrigen; + private String tramoDestino; + private Long conexionCtrlId; + + public String getConOrigen() { + return conOrigen; + } + + public void setConOrigen(String conOrigen) { + this.conOrigen = conOrigen; + } + + public String getConDestino() { + return conDestino; + } + + public void setConDestino(String conDestino) { + this.conDestino = conDestino; + } + + public Integer getGrupo() { + return grupo; + } + + public void setGrupo(Integer grupo) { + this.grupo = grupo; + } + + public String getTramoOrigen() { + return tramoOrigen; + } + + public void setTramoOrigen(String tramoOrigen) { + this.tramoOrigen = tramoOrigen; + } + + public String getTramoDestino() { + return tramoDestino; + } + + public void setTramoDestino(String tramoDestino) { + this.tramoDestino = tramoDestino; + } + + public Long getConexionCtrlId() { + return conexionCtrlId; + } + + public void setConexionCtrlId(Long conexionCtrlId) { + this.conexionCtrlId = conexionCtrlId; + } + + @Override + public String toString() { + return "ConexionVO [conOrigen=" + conOrigen + ", conDestino=" + conDestino + ", grupo=" + grupo + ", tramoOrigen=" + tramoOrigen + ", tramoDestino=" + tramoDestino + ", conexionCtrlId=" + conexionCtrlId + "]"; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfigCoordenadas.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfigCoordenadas.java new file mode 100644 index 000000000..d0db0be27 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfigCoordenadas.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.vo.configuracioneccomerciales; + +public class ConfigCoordenadas { + private String lbCampo; + private String campo; + private String mensagem; + private Integer linha; + private Integer coluna; + private Integer tamanho; + + public ConfigCoordenadas() { + super(); + } + + public String getLbCampo() { + return lbCampo; + } + + public void setLbCampo(String lbCampo) { + this.lbCampo = lbCampo; + } + + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + public Integer getLinha() { + return linha; + } + + public void setLinha(Integer linha) { + this.linha = linha; + } + + public Integer getColuna() { + return coluna; + } + + public void setColuna(Integer coluna) { + this.coluna = coluna; + } + + public String getMensagem() { + return mensagem; + } + + public void setMensagem(String mensagem) { + this.mensagem = mensagem; + } + + public Integer getTamanho() { + return tamanho; + } + + public void setTamanho(Integer tamanho) { + this.tamanho = tamanho; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((campo == null) ? 0 : campo.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfigCoordenadas other = (ConfigCoordenadas) obj; + if (campo == null) { + if (other.campo != null) + return false; + } else if (!campo.equals(other.campo)) + return false; + return true; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java new file mode 100644 index 000000000..c25edb3af --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java @@ -0,0 +1,150 @@ +package com.rjconsultores.ventaboletos.vo.esquemaoperacional; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public class RutaTramoVO { + + private Boolean ventaHandHeld; + private Boolean solicitaNombrePasajero; + private ClaseServicio claseServicio; + private OrgaoConcedente orgaoConcedente; + private List lsSecuenciaRutaTramoVO; + private List lsCombinacionRutaTramoVO; + private List lsEmpresa; + private CoeficienteTarifa coeficienteDefaul1; + private CoeficienteTarifa coeficienteDefaul2; + private String prefixo; + private String descRuta; + private Boolean indSentidoIda; + private String numRuta; + + public RutaTramoVO() { + lsSecuenciaRutaTramoVO = new ArrayList(); + lsEmpresa = new ArrayList(); + lsCombinacionRutaTramoVO = new ArrayList(); + } + + public Boolean getVentaHandHeld() { + return ventaHandHeld; + } + + public void setVentaHandHeld(Boolean ventaHandHeld) { + this.ventaHandHeld = ventaHandHeld; + } + + public Boolean getSolicitaNombrePasajero() { + return solicitaNombrePasajero; + } + + public void setSolicitaNombrePasajero(Boolean solicitaNombrePasajero) { + this.solicitaNombrePasajero = solicitaNombrePasajero; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + /** + * Regresa una unmodifiable list + * + * @return + */ + public List getLsSecuenciaRutaTramoVO() { + return Collections.unmodifiableList(lsSecuenciaRutaTramoVO); + } + + public void setLsSecuenciaRutaTramoVO(List lsSecuenciaRutaTramoVO) { + this.lsSecuenciaRutaTramoVO = lsSecuenciaRutaTramoVO; + } + + /** + * Regresa una unmodifiable list + * + * @return + */ + public List getLsCombinacionRutaTramoVO() { + return Collections.unmodifiableList(lsCombinacionRutaTramoVO); + } + + public void setLsCombinacionRutaTramoVO(List lsCombinacionRutaTramoVO) { + this.lsCombinacionRutaTramoVO = lsCombinacionRutaTramoVO; + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getDescRuta() { + return descRuta; + } + + public void setDescRuta(String descRuta) { + this.descRuta = descRuta; + } + + public Boolean getIndSentidoIda() { + return indSentidoIda; + } + + public void setIndSentidoIda(Boolean indSentidoIda) { + this.indSentidoIda = indSentidoIda; + } + + public CoeficienteTarifa getCoeficienteDefaul1() { + return coeficienteDefaul1; + } + + public void setCoeficienteDefaul1(CoeficienteTarifa coeficienteDefaul1) { + this.coeficienteDefaul1 = coeficienteDefaul1; + } + + public CoeficienteTarifa getCoeficienteDefaul2() { + return coeficienteDefaul2; + } + + public void setCoeficienteDefaul2(CoeficienteTarifa coeficienteDefaul2) { + this.coeficienteDefaul2 = coeficienteDefaul2; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java new file mode 100644 index 000000000..458c585dc --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java @@ -0,0 +1,207 @@ +package com.rjconsultores.ventaboletos.vo.esquemaoperacional; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; + +public class SecuenciaRutaTramoCoeficienteVO { + + private Parada origen; + private Parada destino; + private Via via; + private Integer secuencia; + private BigDecimal kmReal; + private HoraSistema tiempoRecorrido; + private Integer tramoId; + private Integer tramoServicioId; + private String numRuta; + private Integer orgaoTramoId; + private CoeficienteTarifa coeficienteTarifa1; + private BigDecimal kmCoeficiente1; + private CoeficienteTarifa coeficienteTarifa2; + private BigDecimal kmCoeficiente2; + private Boolean permiteVenda; + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido, String numruta) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido); + this.numRuta = numruta; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Integer secuencia, Via via) { + super(); + this.origen = origen; + this.destino = destino; + this.secuencia = secuencia; + this.via = via; + this.setTiempoRecorrido(null); + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Integer secuencia, Via via, String numruta) { + this(origen, destino, secuencia, via); + this.numRuta = numruta; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + this.tramoId = tramoId; + this.tramoServicioId = tramoId; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId, String numruta) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido, tramoId, tramoServicioId); + this.numRuta = numruta; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public HoraSistema getTiempoRecorrido() { + return tiempoRecorrido; + } + + public void setTiempoRecorrido(HoraSistema tiempoRecorrido) { + if (tiempoRecorrido == null) { + tiempoRecorrido = new HoraSistema(); + } + this.tiempoRecorrido = tiempoRecorrido; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public Integer getSecuencia() { + return secuencia; + } + + public void setSecuencia(Integer secuencia) { + this.secuencia = secuencia; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public Integer getTramoServicioId() { + return tramoServicioId; + } + + public void setTramoServicioId(Integer tramoServicioId) { + this.tramoServicioId = tramoServicioId; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + @Override + public String toString() { + HoraSistema hora = getTiempoRecorrido(); + + return secuencia + ";" + origen + ";" + destino + ";" + via + ";" + kmReal + ";" + + ((hora != null) ? hora.getHora() : "-") + ";" + ((hora != null) ? hora.getMinuto() : "-"); + } + + public Integer getOrgaoTramoId() { + return orgaoTramoId; + } + + public void setOrgaoTramoId(Integer orgaoTramoId) { + this.orgaoTramoId = orgaoTramoId; + } + + public CoeficienteTarifa getCoeficienteTarifa1() { + return coeficienteTarifa1; + } + + public void setCoeficienteTarifa1(CoeficienteTarifa coeficienteTarifa1) { + this.coeficienteTarifa1 = coeficienteTarifa1; + } + + public BigDecimal getKmCoeficiente1() { + return kmCoeficiente1; + } + + public void setKmCoeficiente1(BigDecimal kmCoeficiente1) { + this.kmCoeficiente1 = kmCoeficiente1; + } + + public CoeficienteTarifa getCoeficienteTarifa2() { + return coeficienteTarifa2; + } + + public void setCoeficienteTarifa2(CoeficienteTarifa coeficienteTarifa2) { + this.coeficienteTarifa2 = coeficienteTarifa2; + } + + public BigDecimal getKmCoeficiente2() { + return kmCoeficiente2; + } + + public void setKmCoeficiente2(BigDecimal kmCoeficiente2) { + this.kmCoeficiente2 = kmCoeficiente2; + } + + public Boolean getPermiteVenda() { + return permiteVenda; + } + + public void setPermiteVenda(Boolean permiteVenda) { + this.permiteVenda = permiteVenda; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoVO.java new file mode 100644 index 000000000..c89393089 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoVO.java @@ -0,0 +1,164 @@ +package com.rjconsultores.ventaboletos.vo.esquemaoperacional; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; + +public class SecuenciaRutaTramoVO { + + private Parada origen; + private Parada destino; + private Via via; + private Integer secuencia; + private BigDecimal kmReal; + private HoraSistema tiempoRecorrido; + private Integer tramoId; + private Integer tramoServicioId; + private Boolean indSentidoIda; + private String numRuta; + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido, String numruta, Boolean indSentidoIda) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Integer secuencia, Via via) { + super(); + this.origen = origen; + this.destino = destino; + this.secuencia = secuencia; + this.via = via; + this.setTiempoRecorrido(null); + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Integer secuencia, Via via, String numruta, Boolean indSentidoIda) { + this(origen, destino, secuencia, via); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + this.tramoId = tramoId; + this.tramoServicioId = tramoId; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId, String numruta, Boolean indSentidoIda) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido, tramoId, tramoServicioId); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public HoraSistema getTiempoRecorrido() { + return tiempoRecorrido; + } + + public void setTiempoRecorrido(HoraSistema tiempoRecorrido) { + if (tiempoRecorrido == null) { + tiempoRecorrido = new HoraSistema(); + } + this.tiempoRecorrido = tiempoRecorrido; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public Integer getSecuencia() { + return secuencia; + } + + public void setSecuencia(Integer secuencia) { + this.secuencia = secuencia; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public Integer getTramoServicioId() { + return tramoServicioId; + } + + public void setTramoServicioId(Integer tramoServicioId) { + this.tramoServicioId = tramoServicioId; + } + + public Boolean getIndSentidoIda() { + return indSentidoIda; + } + + public void setIndSentidoIda(Boolean indSentidoIda) { + this.indSentidoIda = indSentidoIda; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + @Override + public String toString() { + HoraSistema hora = getTiempoRecorrido(); + + return secuencia + ";" + origen + ";" + destino + ";" + via + ";" + kmReal + ";" + + ((hora != null) ? hora.getHora() : "-") + ";" + ((hora != null) ? hora.getMinuto() : "-"); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraEcfVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraEcfVO.java new file mode 100644 index 000000000..9aece703b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraEcfVO.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.util.ArrayList; +import java.util.List; + +public class AgpImpressoraEcfVO { + + private String numImpressora; + private String dataEmissao; + + private List itens; + + public AgpImpressoraEcfVO() { + } + + public AgpImpressoraEcfVO(String numImpressora, String dataEmissao) { + super(); + this.numImpressora = numImpressora; + this.dataEmissao = dataEmissao; + this.itens = new ArrayList(); + } + + public String getNumImpressora() { + return numImpressora; + } + + public void setNumImpressora(String numImpressora) { + this.numImpressora = numImpressora; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dataEmissao == null) ? 0 : dataEmissao.hashCode()); + result = prime * result + ((numImpressora == null) ? 0 : numImpressora.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AgpImpressoraEcfVO other = (AgpImpressoraEcfVO) obj; + if (dataEmissao == null) { + if (other.dataEmissao != null) + return false; + } else if (!dataEmissao.equals(other.dataEmissao)) + return false; + if (numImpressora == null) { + if (other.numImpressora != null) + return false; + } else if (!numImpressora.equals(other.numImpressora)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraReducaoZVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraReducaoZVO.java new file mode 100644 index 000000000..eb9b53ef5 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraReducaoZVO.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.util.ArrayList; +import java.util.List; + +public class AgpImpressoraReducaoZVO { + + private String numserie20; + private String datamov; + + private List itens; + + public AgpImpressoraReducaoZVO() { + } + + public AgpImpressoraReducaoZVO(String numserie20, String datamov) { + super(); + this.numserie20 = numserie20; + this.datamov = datamov; + this.itens = new ArrayList(); + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((numserie20 == null) ? 0 : numserie20.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AgpImpressoraReducaoZVO other = (AgpImpressoraReducaoZVO) obj; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (numserie20 == null) { + if (other.numserie20 != null) + return false; + } else if (!numserie20.equals(other.numserie20)) + return false; + return true; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalReducaoZVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalReducaoZVO.java new file mode 100644 index 000000000..4adeed8a9 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalReducaoZVO.java @@ -0,0 +1,262 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ImportacionFiscalReducaoZVO { + + private String datamov; + private String cnpj; + private String numreducoes; + private String crz; + private String numserie20; + private String coo; + private String cooinicial; + private String coofinal; + private BigDecimal vendabrutadiaria; + private String datareducao; + private String horareducao; + private String aliquota; + private BigDecimal imposto; + private BigDecimal valorNaoTributado; + private String numpdv; + private BigDecimal gtFinal; + private BigDecimal gtInicial; + private BigDecimal valorNaoIncluido; + private String status; + private boolean inconsistente; + + public ImportacionFiscalReducaoZVO() { + } + + public ImportacionFiscalReducaoZVO(ImportacionFiscalReducaoZVO item) { + this.datamov = item.getDatamov(); + this.cnpj = item.getCnpj(); + this.numreducoes = item.getNumreducoes(); + this.crz = item.getCrz(); + this.numserie20 = item.getNumserie20(); + this.coo = item.getCoo(); + this.cooinicial = item.getCooinicial(); + this.coofinal = item.getCoofinal(); + this.vendabrutadiaria = item.getVendabrutadiaria(); + this.datareducao = item.getDatareducao(); + this.horareducao = item.getHorareducao(); + this.aliquota = item.getAliquota(); + this.imposto = item.getImposto(); + this.valorNaoTributado = item.getValorNaoTributado(); + this.numpdv = item.getNumpdv(); + this.gtFinal = item.getGtFinal(); + this.gtInicial = item.getGtInicial(); + this.valorNaoIncluido = item.getValorNaoIncluido(); + this.status = item.getStatus(); + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public String getNumreducoes() { + return numreducoes; + } + + public void setNumreducoes(String numreducoes) { + this.numreducoes = numreducoes; + } + + public String getCrz() { + return crz; + } + + public void setCrz(String crz) { + this.crz = crz; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public String getCooinicial() { + return cooinicial; + } + + public void setCooinicial(String cooinicial) { + this.cooinicial = cooinicial; + } + + public String getCoofinal() { + return coofinal; + } + + public void setCoofinal(String coofinal) { + this.coofinal = coofinal; + } + + public BigDecimal getVendabrutadiaria() { + return vendabrutadiaria; + } + + public void setVendabrutadiaria(BigDecimal vendabrutadiaria) { + this.vendabrutadiaria = vendabrutadiaria; + } + + public String getDatareducao() { + return datareducao; + } + + public void setDatareducao(String datareducao) { + this.datareducao = datareducao; + } + + public String getHorareducao() { + return horareducao; + } + + public void setHorareducao(String horareducao) { + this.horareducao = horareducao; + } + + public String getAliquota() { + return aliquota; + } + + public void setAliquota(String aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getImposto() { + return imposto; + } + + public void setImposto(BigDecimal imposto) { + this.imposto = imposto; + } + + public BigDecimal getValorNaoTributado() { + return valorNaoTributado; + } + + public void setValorNaoTributado(BigDecimal valorNaoTributado) { + this.valorNaoTributado = valorNaoTributado; + } + + public String getNumpdv() { + return numpdv; + } + + public void setNumpdv(String numpdv) { + this.numpdv = numpdv; + } + + public BigDecimal getGtFinal() { + return gtFinal; + } + + public void setGtFinal(BigDecimal gtFinal) { + this.gtFinal = gtFinal; + } + + public BigDecimal getGtInicial() { + return gtInicial; + } + + public void setGtInicial(BigDecimal gtInicial) { + this.gtInicial = gtInicial; + } + + public BigDecimal getValorNaoIncluido() { + return valorNaoIncluido; + } + + public void setValorNaoIncluido(BigDecimal valorNaoIncluido) { + this.valorNaoIncluido = valorNaoIncluido; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((coofinal == null) ? 0 : coofinal.hashCode()); + result = prime * result + ((cooinicial == null) ? 0 : cooinicial.hashCode()); + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((datareducao == null) ? 0 : datareducao.hashCode()); + result = prime * result + ((numserie20 == null) ? 0 : numserie20.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ImportacionFiscalReducaoZVO other = (ImportacionFiscalReducaoZVO) obj; + if (coofinal == null) { + if (other.coofinal != null) + return false; + } else if (!coofinal.equals(other.coofinal)) + return false; + if (cooinicial == null) { + if (other.cooinicial != null) + return false; + } else if (!cooinicial.equals(other.cooinicial)) + return false; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (datareducao == null) { + if (other.datareducao != null) + return false; + } else if (!datareducao.equals(other.datareducao)) + return false; + if (numserie20 == null) { + if (other.numserie20 != null) + return false; + } else if (!numserie20.equals(other.numserie20)) + return false; + return true; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public boolean isInconsistente() { + return inconsistente; + } + + public void setInconsistente(boolean inconsistente) { + this.inconsistente = inconsistente; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalVO.java new file mode 100644 index 000000000..4d496a25d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalVO.java @@ -0,0 +1,342 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +public class ImportacionFiscalVO { + + private String numImpressora; + private String coo; + private Long boletoId; + private Integer empresaId; + private String dataEmissao; + private String cnpjCliente; + private String cnpjImpressora; + private Integer origenId; + private String origenUf; + private Integer destinoId; + private String destinoUf; + private String numpdv; + private String modeloImpressora; + private String numCaixa; + private String status; + private String claseServicio; + private String descmotivocancelamento; + private Integer motivocancelacion; + private BigDecimal valorMulta; + private BigDecimal valorTarifa; + private BigDecimal valorPedagio; + private BigDecimal valorEmbarque; + private BigDecimal valorSeguro; + private String cnpjEcf; + private BigDecimal impostoEstado; + private BigDecimal desconto; + private String indcancelamento; + private boolean inconsistente; + + private List itensFiscais; + + public ImportacionFiscalVO() { + super(); + } + + public ImportacionFiscalVO(String numImpressora, String coo, Long boletoId, Integer empresaId, String dataEmissao, String cnpjCliente, String cnpjImpressora, Integer origenId, String origenUf, Integer destinoId, String destinoUf, String numpdv, String modeloImpressora, String numCaixa, String status, Integer motivocancelacion, BigDecimal valorMulta, BigDecimal valorTarifa, BigDecimal valorPedagio, BigDecimal valorEmbarque, BigDecimal valorSeguro, String claseServicio) { + super(); + this.numImpressora = numImpressora; + this.coo = coo; + this.boletoId = boletoId; + this.empresaId = empresaId; + this.dataEmissao = dataEmissao; + this.cnpjCliente = cnpjCliente; + this.cnpjImpressora = cnpjImpressora; + this.origenId = origenId; + this.origenUf = origenUf; + this.destinoId = destinoId; + this.destinoUf = destinoUf; + this.numpdv = numpdv; + this.modeloImpressora = modeloImpressora; + this.numCaixa = numCaixa; + this.status = status; + this.claseServicio = claseServicio; + this.motivocancelacion = motivocancelacion; + this.valorMulta = valorMulta; + this.valorTarifa = valorTarifa; + this.valorPedagio = valorPedagio; + this.valorEmbarque = valorEmbarque; + this.valorSeguro = valorSeguro; + } + + public String getNumImpressora() { + return numImpressora; + } + + public void setNumImpressora(String numImpressora) { + this.numImpressora = numImpressora; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public String getCnpjCliente() { + return cnpjCliente; + } + + public void setCnpjCliente(String cnpjCliente) { + this.cnpjCliente = cnpjCliente; + } + + public String getCnpjImpressora() { + return cnpjImpressora; + } + + public void setCnpjImpressora(String cnpjImpressora) { + this.cnpjImpressora = cnpjImpressora; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public List getItensFiscais() { + if (itensFiscais == null) { + itensFiscais = new ArrayList(); + } + return itensFiscais; + } + + public void setItensFiscais(List itensFiscais) { + this.itensFiscais = itensFiscais; + } + + public String getNumpdv() { + return numpdv; + } + + public void setNumpdv(String numpdv) { + this.numpdv = numpdv; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public String getNumCaixa() { + return numCaixa; + } + + public void setNumCaixa(String numCaixa) { + this.numCaixa = numCaixa; + } + + public String getModeloImpressora() { + return modeloImpressora; + } + + public void setModeloImpressora(String modeloImpressora) { + this.modeloImpressora = modeloImpressora; + } + + public String getOrigenUf() { + return origenUf; + } + + public void setOrigenUf(String origenUf) { + this.origenUf = origenUf; + } + + public String getDestinoUf() { + return destinoUf; + } + + public void setDestinoUf(String destinoUf) { + this.destinoUf = destinoUf; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Integer getMotivocancelacion() { + return motivocancelacion; + } + + public void setMotivocancelacion(Integer motivocancelacion) { + this.motivocancelacion = motivocancelacion; + } + + public BigDecimal getValorMulta() { + return valorMulta; + } + + public void setValorMulta(BigDecimal valorMulta) { + this.valorMulta = valorMulta; + } + + public BigDecimal getValorTarifa() { + return valorTarifa; + } + + public void setValorTarifa(BigDecimal valorTarifa) { + this.valorTarifa = valorTarifa; + } + + public BigDecimal getValorPedagio() { + return valorPedagio; + } + + public void setValorPedagio(BigDecimal valorPedagio) { + this.valorPedagio = valorPedagio; + } + + public BigDecimal getValorEmbarque() { + return valorEmbarque; + } + + public void setValorEmbarque(BigDecimal valorEmbarque) { + this.valorEmbarque = valorEmbarque; + } + + public BigDecimal getValorSeguro() { + return valorSeguro; + } + + public void setValorSeguro(BigDecimal valorSeguro) { + this.valorSeguro = valorSeguro; + } + + public String getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(String claseServicio) { + this.claseServicio = claseServicio; + } + + public String getDescmotivocancelamento() { + return descmotivocancelamento; + } + + public void setDescmotivocancelamento(String descmotivocancelamento) { + this.descmotivocancelamento = descmotivocancelamento; + } + + public String getCnpjEcf() { + return cnpjEcf; + } + + public void setCnpjEcf(String cnpjEcf) { + this.cnpjEcf = cnpjEcf; + } + + public BigDecimal getImpostoEstado() { + return impostoEstado; + } + + public void setImpostoEstado(BigDecimal impostoEstado) { + this.impostoEstado = impostoEstado; + } + + public BigDecimal getDesconto() { + return desconto; + } + + public void setDesconto(BigDecimal desconto) { + this.desconto = desconto; + } + + public String getIndcancelamento() { + return indcancelamento; + } + + public void setIndcancelamento(String indcancelamento) { + this.indcancelamento = indcancelamento; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((boletoId == null) ? 0 : boletoId.hashCode()); + result = prime * result + ((coo == null) ? 0 : coo.hashCode()); + result = prime * result + ((numImpressora == null) ? 0 : numImpressora.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ImportacionFiscalVO other = (ImportacionFiscalVO) obj; + if (boletoId == null) { + if (other.boletoId != null) + return false; + } else if (!boletoId.equals(other.boletoId)) + return false; + if (coo == null) { + if (other.coo != null) + return false; + } else if (!coo.equals(other.coo)) + return false; + if (numImpressora == null) { + if (other.numImpressora != null) + return false; + } else if (!numImpressora.equals(other.numImpressora)) + return false; + return true; + } + + public boolean isInconsistente() { + return inconsistente; + } + + public void setInconsistente(boolean inconsistente) { + this.inconsistente = inconsistente; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionManualFiscalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionManualFiscalVO.java new file mode 100644 index 000000000..ca518d80b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionManualFiscalVO.java @@ -0,0 +1,307 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; +import java.util.List; + +public class ImportacionManualFiscalVO { + + private String numImpressora; + private String coo; + private Long boletoId; + private Integer empresaId; + private String empresa; + private String dataEmissao; + private BigDecimal valorTotal; + private Integer origenId; + private String origenUf; + private Integer destinoId; + private String destinoUf; + private String repTributado; + private BigDecimal valorItem; + private String tipoPassagem; + private String numItem; + private String codProduto; + private String serie; + private BigDecimal icms; + private BigDecimal porctributo; + private Integer estadoIdOrigen; + private Integer estadoIdDestino; + private BigDecimal importetaxaembarque; + private BigDecimal importepedagio; + private BigDecimal importeoutros; + private BigDecimal importeseguro; + private String subSerie; + private String aidf; + private String numpdv; + private String modeloImpressora; + private String numCaixa; + private String status; + private String claseServicio; + + List subItens; + + public String getNumImpressora() { + return numImpressora; + } + + public void setNumImpressora(String numImpressora) { + this.numImpressora = numImpressora; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public String getRepTributado() { + return repTributado; + } + + public void setRepTributado(String repTributado) { + this.repTributado = repTributado; + } + + public BigDecimal getValorItem() { + return valorItem; + } + + public void setValorItem(BigDecimal valorItem) { + this.valorItem = valorItem; + } + + public String getTipoPassagem() { + return tipoPassagem; + } + + public void setTipoPassagem(String tipoPassagem) { + this.tipoPassagem = tipoPassagem; + } + + public String getNumItem() { + return numItem; + } + + public void setNumItem(String numItem) { + this.numItem = numItem; + } + + public String getCodProduto() { + return codProduto; + } + + public void setCodProduto(String codProduto) { + this.codProduto = codProduto; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public BigDecimal getPorctributo() { + return porctributo; + } + + public void setPorctributo(BigDecimal porctributo) { + this.porctributo = porctributo; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + + public List getSubItens() { + return subItens; + } + + public void setSubItens(List subItens) { + this.subItens = subItens; + } + + public Integer getEstadoIdOrigen() { + return estadoIdOrigen; + } + + public void setEstadoIdOrigen(Integer estadoIdOrigen) { + this.estadoIdOrigen = estadoIdOrigen; + } + + public Integer getEstadoIdDestino() { + return estadoIdDestino; + } + + public void setEstadoIdDestino(Integer estadoIdDestino) { + this.estadoIdDestino = estadoIdDestino; + } + + public String getSubSerie() { + return subSerie; + } + + public void setSubSerie(String subSerie) { + this.subSerie = subSerie; + } + + public String getAidf() { + return aidf; + } + + public void setAidf(String aidf) { + this.aidf = aidf; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public String getNumpdv() { + return numpdv; + } + + public void setNumpdv(String numpdv) { + this.numpdv = numpdv; + } + + public String getModeloImpressora() { + return modeloImpressora; + } + + public void setModeloImpressora(String modeloImpressora) { + this.modeloImpressora = modeloImpressora; + } + + public String getNumCaixa() { + return numCaixa; + } + + public void setNumCaixa(String numCaixa) { + this.numCaixa = numCaixa; + } + + public String getOrigenUf() { + return origenUf; + } + + public void setOrigenUf(String origenUf) { + this.origenUf = origenUf; + } + + public String getDestinoUf() { + return destinoUf; + } + + public void setDestinoUf(String destinoUf) { + this.destinoUf = destinoUf; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(String claseServicio) { + this.claseServicio = claseServicio; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionNaoFiscalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionNaoFiscalVO.java new file mode 100644 index 000000000..2beaa2b7f --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionNaoFiscalVO.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class ImportacionNaoFiscalVO { + + private Integer tipoeventoextraId; + private String desctipoevento; + private BigDecimal total; + private Date fechorvta; + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public Date getFechorvta() { + return fechorvta; + } + + public void setFechorvta(Date fechorvta) { + this.fechorvta = fechorvta; + } + + public String getNumeroDocumento() { + return getTipoeventoextraId() + DateUtil.getStringDate(getFechorvta(), "ddMMyy"); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemFiscalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemFiscalVO.java new file mode 100644 index 000000000..22df8027b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemFiscalVO.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ItemFiscalVO extends ImportacionFiscalVO { + + private String numItem; + private String codProduto; + private String repTributado; + private BigDecimal valorItem; + private String tipoPassagem; + private Boolean inconsistencia; + + public ItemFiscalVO() { + super(); + } + + public ItemFiscalVO(ImportacionFiscalVO item) { + super(item.getNumImpressora(), item.getCoo(), item.getBoletoId(), item.getEmpresaId(), item.getDataEmissao(), + item.getCnpjCliente(), item.getCnpjImpressora(), item.getOrigenId(), item.getOrigenUf(), item.getDestinoId(), + item.getDestinoUf(), item.getNumpdv(), item.getModeloImpressora(), item.getNumCaixa(), item.getStatus(), + item.getMotivocancelacion(), item.getValorMulta(), item.getValorTarifa(), item.getValorPedagio(), + item.getValorEmbarque(), item.getValorSeguro(), item.getClaseServicio()); + super.setImpostoEstado(item.getImpostoEstado()); + } + + public String getNumItem() { + return numItem; + } + + public void setNumItem(String numItem) { + this.numItem = numItem; + } + + public String getCodProduto() { + return codProduto; + } + + public void setCodProduto(String codProduto) { + this.codProduto = codProduto; + } + + public String getRepTributado() { + return repTributado; + } + + public void setRepTributado(String repTributado) { + this.repTributado = repTributado; + } + + public BigDecimal getValorItem() { + return valorItem; + } + + public void setValorItem(BigDecimal valorItem) { + this.valorItem = valorItem; + } + + public String getTipoPassagem() { + return tipoPassagem; + } + + public void setTipoPassagem(String tipoPassagem) { + this.tipoPassagem = tipoPassagem; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((super.getBoletoId() == null) ? 0 : super.getBoletoId().hashCode()); + result = prime * result + ((super.getCoo() == null) ? 0 : super.getCoo().hashCode()); + result = prime * result + ((super.getNumImpressora() == null) ? 0 : super.getNumImpressora().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ImportacionFiscalVO other = (ImportacionFiscalVO) obj; + if (super.getBoletoId() == null) { + if (other.getBoletoId() != null) + return false; + } else if (!super.getBoletoId().equals(other.getBoletoId())) + return false; + if (super.getCoo() == null) { + if (other.getCoo() != null) + return false; + } else if (!super.getCoo().equals(other.getCoo())) + return false; + if (super.getNumImpressora() == null) { + if (other.getNumImpressora() != null) + return false; + } else if (!super.getNumImpressora().equals(other.getNumImpressora())) + return false; + return true; + } + + @Override + public String toString() { + return "ItemFiscalVO [numItem=" + numItem + ", codProduto=" + codProduto + ", repTributado=" + repTributado + ", valorItem=" + valorItem + ", tipoPassagem=" + tipoPassagem + ", getNumImpressora()=" + getNumImpressora() + ", getCoo()=" + getCoo() + ", getBoletoId()=" + getBoletoId() + ", getEmpresaId()=" + getEmpresaId() + ", getDataEmissao()=" + getDataEmissao() + ", getCnpjCliente()=" + getCnpjCliente() + ", getCnpjImpressora()=" + getCnpjImpressora() + ", getOrigenId()=" + getOrigenId() + ", getItensFiscais()=" + getItensFiscais() + ", getNumpdv()=" + getNumpdv() + "]"; + } + + public Boolean getInconsistencia() { + return inconsistencia; + } + + public void setInconsistencia(Boolean inconsistencia) { + if (inconsistencia == null) + this.inconsistencia = Boolean.FALSE; + else + this.inconsistencia = inconsistencia; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioFinanceiro.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioFinanceiro.java new file mode 100644 index 000000000..19ea62feb --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioFinanceiro.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ItemRelatorioFinanceiro { + + private String movimentacao; + private String empresa; + private BigDecimal valorEnCaja; + private String tipoVenta; + + public String getMovimentacao() { + return movimentacao; + } + + public void setMovimentacao(String movimentacao) { + this.movimentacao = movimentacao; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public BigDecimal getValorEnCaja() { + return valorEnCaja; + } + + public void setValorEnCaja(BigDecimal valorEnCaja) { + this.valorEnCaja = valorEnCaja; + } + + public String getTipoVenta() { + return tipoVenta; + } + + public void setTipoVenta(String tipoVenta) { + this.tipoVenta = tipoVenta; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioVoucher.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioVoucher.java new file mode 100644 index 000000000..0bf97dca1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioVoucher.java @@ -0,0 +1,98 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ItemRelatorioVoucher { + + private String situacao; + private String competenciaEntrega; + private String competenciaVenda; + private String competenciaCancelamento; + private BigDecimal tarifa; + private BigDecimal pedagio; + private BigDecimal embarque; + private BigDecimal seguro; + private Integer qtde; + + public String getSituacao() { + return situacao; + } + + public void setSituacao(String situacao) { + this.situacao = situacao; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getEmbarque() { + return embarque; + } + + public void setEmbarque(BigDecimal embarque) { + this.embarque = embarque; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + + public Integer getQtde() { + return qtde; + } + + public void setQtde(Integer qtde) { + this.qtde = qtde; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getEmbarque()) + .add(getPedagio()) + .add(getSeguro()) + .add(getTarifa()); + return total; + } + + public String getCompetenciaEntrega() { + return competenciaEntrega; + } + + public void setCompetenciaEntrega(String competenciaEntrega) { + this.competenciaEntrega = competenciaEntrega; + } + + public String getCompetenciaVenda() { + return competenciaVenda; + } + + public void setCompetenciaVenda(String competenciaVenda) { + this.competenciaVenda = competenciaVenda; + } + + public String getCompetenciaCancelamento() { + return competenciaCancelamento; + } + + public void setCompetenciaCancelamento(String competenciaCancelamento) { + this.competenciaCancelamento = competenciaCancelamento; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalReducaoZVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalReducaoZVO.java new file mode 100644 index 000000000..a85c2bfaf --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalReducaoZVO.java @@ -0,0 +1,149 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class LeitorFiscalReducaoZVO implements Comparable { + + private Integer empresaId; + private String nombempresa; + private String cnpj; + private String datamov; + private BigDecimal aliquota; + private BigDecimal imposto; + private BigDecimal valorNaoTributado; + private BigDecimal vendabrutadiaria; + + public LeitorFiscalReducaoZVO() { + super(); + setAliquota(BigDecimal.ZERO); + setImposto(BigDecimal.ZERO); + setValorNaoTributado(BigDecimal.ZERO); + setVendabrutadiaria(BigDecimal.ZERO); + } + + @Override + public int compareTo(LeitorFiscalReducaoZVO o) { + int retorno = getDatamov().compareTo(o.getDatamov()); + if(retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if(retorno == 0) { + retorno = getCnpj().compareTo(o.getCnpj()); + } + if(retorno == 0) { + retorno = getAliquota().compareTo(o.getAliquota()); + } + return retorno; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode()); + result = prime * result + ((getDatamov() == null) ? 0 : getDatamov().hashCode()); + result = prime * result + ((getCnpj() == null) ? 0 : getCnpj().hashCode()); + result = prime * result + ((getAliquota() == null) ? 0 : getAliquota().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + LeitorFiscalReducaoZVO other = (LeitorFiscalReducaoZVO) obj; + if (getEmpresaId() == null) { + if (other.getEmpresaId() != null) + return false; + } else if (!getEmpresaId().equals(other.getEmpresaId())) + return false; + if (getDatamov() == null) { + if (other.getDatamov() != null) + return false; + } else if (!getDatamov().equals(other.getDatamov())) + return false; + if (getCnpj() == null) { + if (other.getCnpj() != null) + return false; + } else if (!getCnpj().equals(other.getCnpj())) + return false; + if (getAliquota() == null) { + if (other.getAliquota() != null) + return false; + } else if (!getAliquota().equals(other.getAliquota())) + return false; + return true; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getImposto() { + return imposto; + } + + public void setImposto(BigDecimal imposto) { + this.imposto = imposto; + } + + public BigDecimal getValorNaoTributado() { + return valorNaoTributado; + } + + public void setValorNaoTributado(BigDecimal valorNaoTributado) { + this.valorNaoTributado = valorNaoTributado; + } + + public BigDecimal getVendabrutadiaria() { + return vendabrutadiaria; + } + + public void setVendabrutadiaria(BigDecimal vendabrutadiaria) { + this.vendabrutadiaria = vendabrutadiaria; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + @Override + public String toString() { + return "LeitorFiscalReducaoZVO [empresaId=" + empresaId + ", nombempresa=" + nombempresa + ", cnpj=" + cnpj + ", datamov=" + datamov + ", aliquota=" + aliquota + ", imposto=" + imposto + ", valorNaoTributado=" + valorNaoTributado + ", vendabrutadiaria=" + vendabrutadiaria + "]"; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalVO.java new file mode 100644 index 000000000..5dbb80e97 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalVO.java @@ -0,0 +1,145 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; + +public class LeitorFiscalVO extends ImportacionFiscalVO implements Comparable { + + private static BigDecimal CEM = new BigDecimal(100); + + private String nombempresa; + private Integer qtdeItens; + private BigDecimal aliquota; + + public LeitorFiscalVO() { + super(); + qtdeItens = 0; + setValorEmbarque(BigDecimal.ZERO); + setValorMulta(BigDecimal.ZERO); + setValorPedagio(BigDecimal.ZERO); + setValorSeguro(BigDecimal.ZERO); + setValorTarifa(BigDecimal.ZERO); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getDataEmissao() == null) ? 0 : getDataEmissao().hashCode()); + result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode()); + result = prime * result + ((getOrigenUf() == null) ? 0 : getOrigenUf().hashCode()); + result = prime * result + ((getDestinoUf() == null) ? 0 : getDestinoUf().hashCode()); + result = prime * result + ((getClaseServicio() == null) ? 0 : getClaseServicio().hashCode()); + result = prime * result + ((getDescmotivocancelamento() == null) ? 0 : getDescmotivocancelamento().hashCode()); + result = prime * result + ((getAliquota() == null) ? 0 : getAliquota().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof LeitorFiscalVO)) + return false; + LeitorFiscalVO other = (LeitorFiscalVO) obj; + if (getDataEmissao() == null) { + if (other.getDataEmissao() != null) + return false; + } else if (!getDataEmissao().equals(other.getDataEmissao())) + return false; + if (getEmpresaId() == null) { + if (other.getEmpresaId() != null) + return false; + } else if (!getEmpresaId().equals(other.getEmpresaId())) + return false; + if (getOrigenUf() == null) { + if (other.getOrigenUf() != null) + return false; + } else if (!getOrigenUf().equals(other.getOrigenUf())) + return false; + if (getDestinoUf() == null) { + if (other.getDestinoUf() != null) + return false; + } else if (!getDestinoUf().equals(other.getDestinoUf())) + return false; + if (getClaseServicio() == null) { + if (other.getClaseServicio() != null) + return false; + } else if (!getClaseServicio().equals(other.getClaseServicio())) + return false; + if (getDescmotivocancelamento() == null) { + if (other.getDescmotivocancelamento() != null) + return false; + } else if (!getDescmotivocancelamento().equals(other.getDescmotivocancelamento())) + return false; + if (getAliquota() == null) { + if (other.getAliquota() != null) + return false; + } else if (!getAliquota().equals(other.getAliquota())) + return false; + return true; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Integer getQtdeItens() { + return qtdeItens; + } + + public void setQtdeItens(Integer qtdeItens) { + this.qtdeItens = qtdeItens; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getValorEmbarque()) + .add(getValorMulta()) + .add(getValorPedagio()) + .add(getValorTarifa()) + .add(getValorSeguro()); + return total; + } + + @Override + public int compareTo(LeitorFiscalVO o) { + int retorno = getDataEmissao().compareTo(o.getDataEmissao()); + if(retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if(retorno == 0) { + retorno = getOrigenUf().compareTo(o.getOrigenUf()); + } + if(retorno == 0) { + retorno = getDestinoUf().compareTo(o.getDestinoUf()); + } + if(retorno == 0) { + retorno = getClaseServicio().compareTo(o.getClaseServicio()); + } + if(retorno == 0) { + retorno = getDescmotivocancelamento().compareTo(o.getDescmotivocancelamento()); + } + return retorno; + } + + public BigDecimal getValorIcms() { + return UtiliteriasFiscal.arredondar(getValorTarifa().multiply(getAliquota().divide(CEM))); + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorManualFiscalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorManualFiscalVO.java new file mode 100644 index 000000000..a8ae8374d --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorManualFiscalVO.java @@ -0,0 +1,129 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class LeitorManualFiscalVO extends ImportacionManualFiscalVO implements Comparable { + + private String nombempresa; + private Integer qtdeItens; + private BigDecimal valorIcms; + + public LeitorManualFiscalVO() { + super(); + qtdeItens = 0; + setImportetaxaembarque(BigDecimal.ZERO); + setImporteoutros(BigDecimal.ZERO); + setImportepedagio(BigDecimal.ZERO); + setImporteseguro(BigDecimal.ZERO); + setValorItem(BigDecimal.ZERO); + setValorIcms(BigDecimal.ZERO); + setValorTotal(BigDecimal.ZERO); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getDataEmissao() == null) ? 0 : getDataEmissao().hashCode()); + result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode()); + result = prime * result + ((getOrigenUf() == null) ? 0 : getOrigenUf().hashCode()); + result = prime * result + ((getDestinoUf() == null) ? 0 : getDestinoUf().hashCode()); + result = prime * result + ((getClaseServicio() == null) ? 0 : getClaseServicio().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getIcms() == null) ? 0 : getIcms().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof LeitorManualFiscalVO)) + return false; + LeitorManualFiscalVO other = (LeitorManualFiscalVO) obj; + if (getDataEmissao() == null) { + if (other.getDataEmissao() != null) + return false; + } else if (!getDataEmissao().equals(other.getDataEmissao())) + return false; + if (getEmpresaId() == null) { + if (other.getEmpresaId() != null) + return false; + } else if (!getEmpresaId().equals(other.getEmpresaId())) + return false; + if (getOrigenUf() == null) { + if (other.getOrigenUf() != null) + return false; + } else if (!getOrigenUf().equals(other.getOrigenUf())) + return false; + if (getDestinoUf() == null) { + if (other.getDestinoUf() != null) + return false; + } else if (!getDestinoUf().equals(other.getDestinoUf())) + return false; + if (getClaseServicio() == null) { + if (other.getClaseServicio() != null) + return false; + } else if (!getClaseServicio().equals(other.getClaseServicio())) + return false; + if (getStatus() == null) { + if (other.getStatus() != null) + return false; + } else if (!getStatus().equals(other.getStatus())) + return false; + if (getIcms() == null) { + if (other.getIcms() != null) + return false; + } else if (!getIcms().equals(other.getIcms())) + return false; + return true; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Integer getQtdeItens() { + return qtdeItens; + } + + public void setQtdeItens(Integer qtdeItens) { + this.qtdeItens = qtdeItens; + } + + @Override + public int compareTo(LeitorManualFiscalVO o) { + int retorno = getDataEmissao().compareTo(o.getDataEmissao()); + if(retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if(retorno == 0) { + retorno = getOrigenUf().compareTo(o.getOrigenUf()); + } + if(retorno == 0) { + retorno = getDestinoUf().compareTo(o.getDestinoUf()); + } + if(retorno == 0) { + retorno = getClaseServicio().compareTo(o.getClaseServicio()); + } + if(retorno == 0) { + retorno = getStatus().compareTo(o.getStatus()); + } + return retorno; + } + + public BigDecimal getValorIcms() { + return this.valorIcms; + } + + public void setValorIcms(BigDecimal valorIcms) { + this.valorIcms = valorIcms; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorNaoFiscalVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorNaoFiscalVO.java new file mode 100644 index 000000000..278a41384 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorNaoFiscalVO.java @@ -0,0 +1,116 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class LeitorNaoFiscalVO implements Comparable { + + private Integer empresaId; + private String nombempresa; + private String datamov; + private Integer tipoeventoextraId; + private String desctipoevento; + private BigDecimal valorTotal; + + public LeitorNaoFiscalVO() { + super(); + setValorTotal(BigDecimal.ZERO); + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((empresaId == null) ? 0 : empresaId.hashCode()); + result = prime * result + ((tipoeventoextraId == null) ? 0 : tipoeventoextraId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + LeitorNaoFiscalVO other = (LeitorNaoFiscalVO) obj; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (empresaId == null) { + if (other.empresaId != null) + return false; + } else if (!empresaId.equals(other.empresaId)) + return false; + if (tipoeventoextraId == null) { + if (other.tipoeventoextraId != null) + return false; + } else if (!tipoeventoextraId.equals(other.tipoeventoextraId)) + return false; + return true; + } + + @Override + public int compareTo(LeitorNaoFiscalVO o) { + int retorno = getDatamov().compareTo(o.getDatamov()); + if (retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if (retorno == 0) { + retorno = getDesctipoevento().compareTo(o.getDesctipoevento()); + } + return retorno; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SiglaMotivoCancelacion.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SiglaMotivoCancelacion.java new file mode 100644 index 000000000..fe4cfbb96 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SiglaMotivoCancelacion.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +public enum SiglaMotivoCancelacion { + + DEVOLUCAO, CANCELAMENTO, CHECKIN, TROCA, TRANSFERENCIA; + + public static SiglaMotivoCancelacion valueOf(Integer motivocancelacionId) { + switch (motivocancelacionId) { + case 31: + return CANCELAMENTO; + + case 32: + return DEVOLUCAO; + + case 10: + return TROCA; + + case 23: + return TRANSFERENCIA; + + case 27: + return CHECKIN; + + default: + return CANCELAMENTO; + } + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SituacaoTributaria.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SituacaoTributaria.java new file mode 100644 index 000000000..db836e0ec --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SituacaoTributaria.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +public enum SituacaoTributaria { + TRIBUTADO("T"), NAO_TRIBUTADO("N1"), CANCELADO("Can-T"), DESCONTO("DT"), NAO_FISCAL("OPNF"); + + private String value; + + private SituacaoTributaria(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SubItens.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SubItens.java new file mode 100644 index 000000000..b0763ac82 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SubItens.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class SubItens { + public SubItens(BigDecimal valor, String codProduto) { + super(); + this.valor = valor; + this.codProduto = codProduto; + } + + private BigDecimal valor; + private String codProduto; + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public String getCodProduto() { + return codProduto; + } + + public void setCodProduto(String codProduto) { + this.codProduto = codProduto; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TipoPendencia.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TipoPendencia.java new file mode 100644 index 000000000..12934e26c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TipoPendencia.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +public enum TipoPendencia { + DIF_RED_Z, DIF_ECF +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TotalRelatorioVoucher.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TotalRelatorioVoucher.java new file mode 100644 index 000000000..d4786f5e2 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TotalRelatorioVoucher.java @@ -0,0 +1,104 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class TotalRelatorioVoucher { + + private String status; + private BigDecimal tarifa; + private BigDecimal pedagio; + private BigDecimal embarque; + private BigDecimal seguro; + + public TotalRelatorioVoucher() { + super(); + this.tarifa = BigDecimal.ZERO; + this.pedagio = BigDecimal.ZERO; + this.embarque = BigDecimal.ZERO; + this.seguro = BigDecimal.ZERO; + } + + public TotalRelatorioVoucher(String status, BigDecimal tarifa, BigDecimal pedagio, BigDecimal embarque, BigDecimal seguro) { + this(); + this.status = status; + this.tarifa = tarifa; + this.pedagio = pedagio; + this.embarque = embarque; + this.seguro = seguro; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getEmbarque() { + return embarque; + } + + public void setEmbarque(BigDecimal embarque) { + this.embarque = embarque; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((status == null) ? 0 : status.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TotalRelatorioVoucher other = (TotalRelatorioVoucher) obj; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + return true; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getTarifa()) + .add(getEmbarque()) + .add(getPedagio()); + + return total; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/segurida/PerfilJerarquia.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/segurida/PerfilJerarquia.java new file mode 100644 index 000000000..522f21f1b --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/segurida/PerfilJerarquia.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.segurida; + +public enum PerfilJerarquia { + + NORMAL(0), ADMIN(1), JERARQUIA_2(2), JERARQUIA_3(3), JERARQUIA_4(4); + + private Integer valor; + + private PerfilJerarquia(Integer valor) { + this.valor = valor; + } + + public Integer getValor() { + return valor; + } + + public static PerfilJerarquia buscar(Integer valor) { + + if (valor == null) + return NORMAL; + + for (PerfilJerarquia jerarquia : PerfilJerarquia.values()) { + if (jerarquia.getValor().equals(valor)) { + return jerarquia; + } + } + return null; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaGroupVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaGroupVO.java new file mode 100644 index 000000000..6052db5d8 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaGroupVO.java @@ -0,0 +1,106 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * + * @author Desenvolvimento + */ +public class TarifaEscalaGroupVO { + + private String DESCRUTA; + private BigDecimal RUTA_ID; + private BigDecimal MONEDA_ID; + private BigDecimal VIGENCIATARIFA_ID; + private BigDecimal MARCA_ID; + private String DESCMONEDA; + private Date FECINICIOVIGENCIA; + private Date FECFINVIGENCIA; + private String DESCMARCA; + private String DESCCLASE; + + public String getDESCCLASE() { + return DESCCLASE; + } + + public void setDESCCLASE(String DESCCLASE) { + this.DESCCLASE = DESCCLASE; + } + + public String getDESCMARCA() { + return DESCMARCA; + } + + public void setDESCMARCA(String DESCMARCA) { + this.DESCMARCA = DESCMARCA; + } + + public String getDESCMONEDA() { + return DESCMONEDA; + } + + public void setDESCMONEDA(String DESCMONEDA) { + this.DESCMONEDA = DESCMONEDA; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public Date getFECFINVIGENCIA() { + return FECFINVIGENCIA; + } + + public void setFECFINVIGENCIA(Date FECFINVIGENCIA) { + this.FECFINVIGENCIA = FECFINVIGENCIA; + } + + public Date getFECINICIOVIGENCIA() { + return FECINICIOVIGENCIA; + } + + public void setFECINICIOVIGENCIA(Date FECINICIOVIGENCIA) { + this.FECINICIOVIGENCIA = FECINICIOVIGENCIA; + } + + public BigDecimal getMARCA_ID() { + return MARCA_ID; + } + + public void setMARCA_ID(BigDecimal MARCA_ID) { + this.MARCA_ID = MARCA_ID; + } + + public BigDecimal getMONEDA_ID() { + return MONEDA_ID; + } + + public void setMONEDA_ID(BigDecimal MONEDA_ID) { + this.MONEDA_ID = MONEDA_ID; + } + + public BigDecimal getRUTA_ID() { + return RUTA_ID; + } + + public void setRUTA_ID(BigDecimal RUTA_ID) { + this.RUTA_ID = RUTA_ID; + } + + public BigDecimal getVIGENCIATARIFA_ID() { + return VIGENCIATARIFA_ID; + } + + public void setVIGENCIATARIFA_ID(BigDecimal VIGENCIATARIFA_ID) { + this.VIGENCIATARIFA_ID = VIGENCIATARIFA_ID; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaVO.java new file mode 100644 index 000000000..87ca2a574 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaVO.java @@ -0,0 +1,99 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; + +/** + * + * @author Desenvolvimento + */ +public class TarifaEscalaVO { + + private String CVEORIGEM; + private String DESCORIGEM; + private String CVEDESTINO; + private String DESCDESTINO; + private BigDecimal NUMSECORIGEM; + private BigDecimal NUMSECDESTINO; + private BigDecimal PRECIO; + private BigDecimal RUTAID; + private String DESCRUTA; + + public TarifaEscalaVO() { + } + + public String getCVEDESTINO() { + return CVEDESTINO; + } + + public void setCVEDESTINO(String CVEDESTINO) { + this.CVEDESTINO = CVEDESTINO; + } + + public String getCVEORIGEM() { + return CVEORIGEM; + } + + public void setCVEORIGEM(String CVEORIGEM) { + this.CVEORIGEM = CVEORIGEM; + } + + public String getDESCDESTINO() { + return DESCDESTINO; + } + + public void setDESCDESTINO(String DESCDESTINO) { + this.DESCDESTINO = DESCDESTINO; + } + + public String getDESCORIGEM() { + return DESCORIGEM; + } + + public void setDESCORIGEM(String DESCORIGEM) { + this.DESCORIGEM = DESCORIGEM; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public BigDecimal getNUMSECDESTINO() { + return NUMSECDESTINO; + } + + public void setNUMSECDESTINO(BigDecimal NUMSECDESTINO) { + this.NUMSECDESTINO = NUMSECDESTINO; + } + + public BigDecimal getNUMSECORIGEM() { + return NUMSECORIGEM; + } + + public void setNUMSECORIGEM(BigDecimal NUMSECORIGEM) { + this.NUMSECORIGEM = NUMSECORIGEM; + } + + public BigDecimal getPRECIO() { + return PRECIO; + } + + public void setPRECIO(BigDecimal PRECIO) { + this.PRECIO = PRECIO; + } + + public BigDecimal getRUTAID() { + return RUTAID; + } + + public void setRUTAID(BigDecimal RUTAID) { + this.RUTAID = RUTAID; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaGroupVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaGroupVO.java new file mode 100644 index 000000000..2d487f7f1 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaGroupVO.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; + +/** + * + * @author Desenvolvimento + */ +public class TarifaOficialEscalaGroupVO { + + private String DESCRUTA; + private BigDecimal RUTA_ID; + private BigDecimal MONEDA_ID; + private BigDecimal MARCA_ID; + private String DESCMONEDA; + private String DESCMARCA; + private String DESCCLASE; + + public String getDESCCLASE() { + return DESCCLASE; + } + + public void setDESCCLASE(String DESCCLASE) { + this.DESCCLASE = DESCCLASE; + } + + public String getDESCMARCA() { + return DESCMARCA; + } + + public void setDESCMARCA(String DESCMARCA) { + this.DESCMARCA = DESCMARCA; + } + + public String getDESCMONEDA() { + return DESCMONEDA; + } + + public void setDESCMONEDA(String DESCMONEDA) { + this.DESCMONEDA = DESCMONEDA; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public BigDecimal getMARCA_ID() { + return MARCA_ID; + } + + public void setMARCA_ID(BigDecimal MARCA_ID) { + this.MARCA_ID = MARCA_ID; + } + + public BigDecimal getMONEDA_ID() { + return MONEDA_ID; + } + + public void setMONEDA_ID(BigDecimal MONEDA_ID) { + this.MONEDA_ID = MONEDA_ID; + } + + public BigDecimal getRUTA_ID() { + return RUTA_ID; + } + + public void setRUTA_ID(BigDecimal RUTA_ID) { + this.RUTA_ID = RUTA_ID; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaVO.java b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaVO.java new file mode 100644 index 000000000..d9533949c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaVO.java @@ -0,0 +1,135 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; + +/** + * + * @author Desenvolvimento + */ +public class TarifaOficialEscalaVO { + + private String CVEORIGEM; + private String DESCORIGEM; + private String CVEDESTINO; + private String DESCDESTINO; + private BigDecimal NUMSECORIGEM; + private BigDecimal NUMSECDESTINO; + private BigDecimal PRECIO; + private BigDecimal TAXAEMBARQUE; + private BigDecimal PEDAGIO; + private BigDecimal OUTROS; + private BigDecimal SEGURO; + private BigDecimal RUTAID; + private String DESCRUTA; + + public TarifaOficialEscalaVO() { + } + + public String getCVEDESTINO() { + return CVEDESTINO; + } + + public void setCVEDESTINO(String CVEDESTINO) { + this.CVEDESTINO = CVEDESTINO; + } + + public String getCVEORIGEM() { + return CVEORIGEM; + } + + public void setCVEORIGEM(String CVEORIGEM) { + this.CVEORIGEM = CVEORIGEM; + } + + public String getDESCDESTINO() { + return DESCDESTINO; + } + + public void setDESCDESTINO(String DESCDESTINO) { + this.DESCDESTINO = DESCDESTINO; + } + + public String getDESCORIGEM() { + return DESCORIGEM; + } + + public void setDESCORIGEM(String DESCORIGEM) { + this.DESCORIGEM = DESCORIGEM; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public BigDecimal getNUMSECDESTINO() { + return NUMSECDESTINO; + } + + public void setNUMSECDESTINO(BigDecimal NUMSECDESTINO) { + this.NUMSECDESTINO = NUMSECDESTINO; + } + + public BigDecimal getNUMSECORIGEM() { + return NUMSECORIGEM; + } + + public void setNUMSECORIGEM(BigDecimal NUMSECORIGEM) { + this.NUMSECORIGEM = NUMSECORIGEM; + } + + public BigDecimal getPRECIO() { + return PRECIO; + } + + public void setPRECIO(BigDecimal PRECIO) { + this.PRECIO = PRECIO; + } + + public BigDecimal getRUTAID() { + return RUTAID; + } + + public void setRUTAID(BigDecimal RUTAID) { + this.RUTAID = RUTAID; + } + + public BigDecimal getOUTROS() { + return OUTROS; + } + + public void setOUTROS(BigDecimal OUTROS) { + this.OUTROS = OUTROS; + } + + public BigDecimal getPEDAGIO() { + return PEDAGIO; + } + + public void setPEDAGIO(BigDecimal PEDAGIO) { + this.PEDAGIO = PEDAGIO; + } + + public BigDecimal getSEGURO() { + return SEGURO; + } + + public void setSEGURO(BigDecimal SEGURO) { + this.SEGURO = SEGURO; + } + + public BigDecimal getTAXAEMBARQUE() { + return TAXAEMBARQUE; + } + + public void setTAXAEMBARQUE(BigDecimal TAXAEMBARQUE) { + this.TAXAEMBARQUE = TAXAEMBARQUE; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java b/modelWeb/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java new file mode 100644 index 000000000..f90b46633 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java @@ -0,0 +1,35 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.utilerias.spring; + +import org.springframework.context.ApplicationContext; + +/** + * This class provides application-wide access to the Spring ApplicationContext. + * The ApplicationContext is injected by the class "ApplicationContextProvider". + * + * @author Siegfried Bolz + */ +public class AppContext { + + private static ApplicationContext ctx; + + /** + * Injected from the class "ApplicationContextProvider" which is automatically + * loaded during Spring-Initialization. + */ + public static void setApplicationContext(ApplicationContext applicationContext) { + ctx = applicationContext; + } + + /** + * Get access to the Spring ApplicationContext from everywhere in your Application. + * + * @return + */ + public static ApplicationContext getApplicationContext() { + return ctx; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/modelWeb/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java new file mode 100644 index 000000000..4210b4f91 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.utilerias.spring; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * This class provides an application-wide access to the + * Spring ApplicationContext! The ApplicationContext is + * injected in a static method of the class "AppContext". + * + * Use AppContext.getApplicationContext() to get access + * to all Spring Beans. + * + * @author Siegfried Bolz + */ +public class ApplicationContextProvider implements ApplicationContextAware { + + public void setApplicationContext(ApplicationContext ctx) throws BeansException { + // Wiring the ApplicationContext into a static method + AppContext.setApplicationContext(ctx); + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosClientePacoteRS.java b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosClientePacoteRS.java new file mode 100644 index 000000000..e3f89b05e --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosClientePacoteRS.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.rjconsultores.ventaboletos.dao.ClientePacoteDAO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("") +public class BusquedaDatosClientePacoteRS { + + private static Logger log = LoggerFactory.getLogger(BusquedaDatosClientePacoteRS.class); + + @GET + @Path("/busquedadatosclientepacote") + @Produces({ MediaType.APPLICATION_XML }) + public List busquedaDatosClientePacote(@QueryParam("cpfcnpj") String cpfCnpjParam) { + try { + ClientePacoteDAO clientePacoteDao = (ClientePacoteDAO)AppContext.getApplicationContext().getBean("clientePacoteDAO"); + return clientePacoteDao.busquedaDatosClientePacote(cpfCnpjParam); + } catch (Exception e) { + log.error(e.getMessage(), e.getCause()); + } + return null; + } + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosTicketsRS.java b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosTicketsRS.java new file mode 100644 index 000000000..f797e0263 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosTicketsRS.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.dao.BusquedaDatosTicketDAO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("") +public class BusquedaDatosTicketsRS { + + @GET + @Path("/busquedadatostickets") + @Produces({ MediaType.APPLICATION_XML }) + public List busquedaDatosTickets(@QueryParam("fecinicial") String fechaIniParam, @QueryParam("fecfinal") String fechaFinParam, @QueryParam("fecventainicial") String fechaVentaIniParam, @QueryParam("fecventafinal") String fechaVentaFinParam) throws ParseException{ + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + + Date fecInicial = sdf.parse(fechaIniParam); + Date fecFinal = sdf.parse(fechaFinParam); + Date fecVentaInicial = StringUtils.isNotBlank(fechaVentaIniParam) ? sdf.parse(fechaVentaIniParam) : null; + Date fecVentaFinal = StringUtils.isNotBlank(fechaVentaFinParam) ? sdf.parse(fechaVentaFinParam) : null; + + BusquedaDatosTicketDAO pacoteDao = (BusquedaDatosTicketDAO)AppContext.getApplicationContext().getBean("busquedaDatosTicketDAO"); + List pacotes = pacoteDao.buscaDatosTickets(fecInicial, fecFinal, fecVentaInicial, fecVentaFinal); + + return pacotes; + } + + +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/CajaCerradoRS.java b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/CajaCerradoRS.java new file mode 100644 index 000000000..f70511e0c --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/CajaCerradoRS.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("/cajas") +public class CajaCerradoRS { + @GET + @Path("/cerrados") + @Produces({ MediaType.APPLICATION_XML }) + public List buscarCajaCerrado(@QueryParam("fecha") String fecha, @QueryParam("cveusuario") String cveusuario, @QueryParam("turnoid") String turnoid) { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + Date fec = new Date(); + + try { + fec = StringUtils.isBlank(fecha) ? new Date() : sdf.parse(fecha); + } catch (Exception e) { + } + + if (cveusuario == null) { + cveusuario = "*"; + } + + if (turnoid == null) { + turnoid = "*"; + } + + CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO"); + List list = cajaDAO.buscarCajaCerrado(fec, cveusuario, turnoid); + + return list; + } + @GET + @Path("/usuarios") + @Produces({ MediaType.APPLICATION_XML }) + public List buscarUsuarioCerrado(@QueryParam("fecha") String fecha) { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + Date fec = new Date(); + + try { + fec = StringUtils.isBlank(fecha) ? new Date() : sdf.parse(fecha); + } catch (Exception e) { + } + + CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO"); + List list = cajaDAO.buscarUsuarioCerrado(fec); + + return list; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/CajaRS.java b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/CajaRS.java new file mode 100644 index 000000000..a6bc21f56 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/CajaRS.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.vo.caja.CajaVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("/cajas") +public class CajaRS { + @GET + @Produces({ MediaType.APPLICATION_XML }) + public List buscarCaja(@QueryParam("yaCerrado") boolean yaCerrado, @QueryParam("fecDesde") String fecDesde, @QueryParam("fecHasta") String fecHasta) { + + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + Date fecDesdeD = new Date(); + Date fecHastaD = new Date(); + + try { + fecDesdeD = StringUtils.isBlank(fecDesde) ? new Date() : sdf.parse(fecDesde); + } catch (Exception e) { + + } + try { + fecHastaD = StringUtils.isBlank(fecHasta) ? new Date() : sdf.parse(fecHasta); + } catch (Exception e) { + + } + + CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO"); + List list = cajaDAO.buscarCajaFecha(yaCerrado, fecDesdeD, fecHastaD); + + return list; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/UsuarioRS.java b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/UsuarioRS.java new file mode 100644 index 000000000..74572daa6 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/UsuarioRS.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import com.rjconsultores.ventaboletos.dao.UsuarioDAO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("/usuarios") +public class UsuarioRS { + @GET + @Produces({ MediaType.APPLICATION_XML }) + public List buscarUsuarios() { + UsuarioDAO dao = (UsuarioDAO) AppContext.getApplicationContext().getBean("usuarioDAO"); + List retorno = dao.buscarUsuariosActivo(); + + return retorno; + } +} diff --git a/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/VendaEmbarcadaRS.java b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/VendaEmbarcadaRS.java new file mode 100644 index 000000000..d38044f79 --- /dev/null +++ b/modelWeb/src/com/rjconsultores/ventaboletos/ws/rs/VendaEmbarcadaRS.java @@ -0,0 +1,103 @@ +package com.rjconsultores.ventaboletos.ws.rs; + + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Date; +import java.text.ParseException; +import java.text.SimpleDateFormat; + +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.slf4j.Logger; + +import com.rjconsultores.ventaboletos.service.VendaEmbarcadaService; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("vendaEmbarcada") +public class VendaEmbarcadaRS { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(VendaEmbarcadaRS.class); + + private final int CATEGORIA_NAO_SUPORTADA = 5; + private final int DATA_COM_FORMATO_INVALIDO = 6; + private final int ERROR_NAO_SUPORTADO_INVALIDO = 7; + + @POST + @Path("/gerarVenda/{numeroAssento}/{categoria}/{origemId}/{destinoId}/{servicoId}/{dataCorrida}/{dataVenda}/{preco}/{tipoVendaId}/{pontoVendaId}/{empresaCorridaId}/{estacaoId}/{usuarioId}/{empresaId}/{taxaEmbarque}/{pedagio}/{outros}/{seguro}/{rutaId}/{formaPagoId}/{classeServicoId}/{numFolioPreImpresso}/{serieImpFiscal}") + @Produces({MediaType.APPLICATION_JSON}) + public String gerarVenda(@PathParam("numeroAssento") String numeroAssento, @PathParam("categoria") String categoria, @PathParam("origemId") Integer origemId, + @PathParam("destinoId") Integer destinoId, @PathParam("servicoId") Integer servicoId, @PathParam("dataCorrida") String dataCorrida, @PathParam("dataVenda") String dataVenda, + @PathParam("preco") BigDecimal preco, @PathParam("tipoVendaId") Integer tipoVendaId, @PathParam("pontoVendaId") Integer pontoVendaId, + @PathParam("empresaCorridaId") Integer empresaCorridaId, @PathParam("estacaoId") Integer estacaoId, @PathParam("usuarioId") Integer usuarioId, + @PathParam("empresaId") BigInteger empresaId, @PathParam("taxaEmbarque") BigDecimal importeTaxaEmbarque, @PathParam("pedagio") BigDecimal importePedagio, + @PathParam("outros") BigDecimal importeOutros, @PathParam("seguro") BigDecimal importeSeguro, @PathParam("rutaId") Integer rutaId, @PathParam("formaPagoId") Integer formaPagoId, + @PathParam("classeServicoId") Integer classeServicoId, @PathParam("numFolioPreImpresso") String numFolioPreImpresso, @PathParam("serieImpFiscal") String serieImpFiscal ){ + + + String retornoJson = "{'response':'"; + + try { + + int categoriaId = 1; + + if (!categoria.equalsIgnoreCase("normal")){ + return retornoJson.concat(CATEGORIA_NAO_SUPORTADA + "'}"); + } + + VendaEmbarcadaVO vendaEmbarcada = new VendaEmbarcadaVO(); + vendaEmbarcada.setUsuarioId(usuarioId); + vendaEmbarcada.setClienteId(vendaEmbarcada.getUsuarioId()); + vendaEmbarcada.setCategoriaId(categoriaId); + vendaEmbarcada.setCorridaId(servicoId); + vendaEmbarcada.setDestinoId(destinoId); + vendaEmbarcada.setOrigemId(origemId); + vendaEmbarcada.setEmpresaCorridaId(empresaCorridaId); + vendaEmbarcada.setTipoVentaId(tipoVendaId); + vendaEmbarcada.setEmpresaId(empresaId); + vendaEmbarcada.setPrecio(preco); + vendaEmbarcada.setNumAsiento(numeroAssento); + vendaEmbarcada.setPuntoVentaId(pontoVendaId); + vendaEmbarcada.setEmpresaPuntoVentaId(empresaId.intValue()); + vendaEmbarcada.setEstacionId(estacaoId); + vendaEmbarcada.setRutaId(rutaId); + vendaEmbarcada.setClaseServicioId(classeServicoId); + vendaEmbarcada.setFormaPagoId(formaPagoId); + + String data[] = dataCorrida.split("__"); + + if (data.length != 2){ + return retornoJson.concat(DATA_COM_FORMATO_INVALIDO + "'}"); + } + + vendaEmbarcada.setFecCorrida(new Date(new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse(data[0].replace("_", "/").concat(" ").concat(data[1].replace("_", ":"))).getTime())); + + vendaEmbarcada.setFechorViaje(vendaEmbarcada.getFecCorrida()); + vendaEmbarcada.setFechorVenta(vendaEmbarcada.getFecCorrida()); + vendaEmbarcada.setMarcaId(empresaId.intValue()); + vendaEmbarcada.setImporteTaxaEmbarque(importeTaxaEmbarque); + vendaEmbarcada.setImportePedagio(importePedagio); + vendaEmbarcada.setImporteOutros(importeOutros); + vendaEmbarcada.setImporteSeguro(importeSeguro); + vendaEmbarcada.setNumFolioPreimpresso(numFolioPreImpresso); + vendaEmbarcada.setSerieImpFiscal(serieImpFiscal); + + VendaEmbarcadaService vendaEmbarcadaService = (VendaEmbarcadaService) AppContext.getApplicationContext().getBean("VendaEmbarcadaService"); + + int retornoVenda = vendaEmbarcadaService.gerarVendaEmbarcada(vendaEmbarcada); + + return retornoJson.concat(retornoVenda + "'}"); + } catch (ParseException e) { + log.error(e.getMessage(), e); + return retornoJson.concat(DATA_COM_FORMATO_INVALIDO + "'}"); + } catch (Exception e) { + log.error(e.getMessage(), e); + return retornoJson.concat(ERROR_NAO_SUPORTADO_INVALIDO + "'}"); + } + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java index 48964b702..f10692eb6 100644 --- a/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java @@ -8,6 +8,7 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.Moneda; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; @@ -53,7 +54,7 @@ public interface TarifaDAO extends GenericDAO { * @param vigencia * @return */ - public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia); + public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia,Empresa empresa); /** * Lista as tarifas que tem a vigencia informada.
@@ -67,7 +68,7 @@ public interface TarifaDAO extends GenericDAO { public boolean buscarTarifaExisteTramo(Tramo tramo) ; - public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, boolean excluirTarifasDestino) throws BusinessException; + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; public boolean existeTarifas(VigenciaTarifa vigenciaTarifa); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java index 5633d0d3a..4da39dbc8 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java @@ -23,6 +23,7 @@ import com.rjconsultores.ventaboletos.dao.RutaDAO; import com.rjconsultores.ventaboletos.dao.TarifaDAO; import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.Moneda; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; @@ -61,7 +62,7 @@ public class TarifaHibernateDAO extends GenericHibernateDAO imp } public boolean existe(Marca marca, Tramo tramo, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente) { - + Validate.notNull(marca); Validate.notNull(tramo); Validate.notNull(moneda); @@ -69,8 +70,7 @@ public class TarifaHibernateDAO extends GenericHibernateDAO imp Validate.notNull(vigenciaTarifa); Validate.notNull(ruta); Validate.notNull(orgaoConcedente); - - + Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("marca", marca)); @@ -80,13 +80,13 @@ public class TarifaHibernateDAO extends GenericHibernateDAO imp c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); c.add(Restrictions.eq("ruta", ruta)); c.add(Restrictions.eq("orgaoConcedente", orgaoConcedente)); - + c.setProjection(Projections.rowCount()); return (HibernateFix.count(c.list()) > 0); } - public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda,ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa,Categoria categoria, TipoPuntoVenta tipoPuntoVenta) { + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Categoria categoria, TipoPuntoVenta tipoPuntoVenta) { Criteria c = getSession().createCriteria(getPersistentClass()); c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); @@ -133,7 +133,7 @@ public class TarifaHibernateDAO extends GenericHibernateDAO imp return c.list(); } - public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("marca", marca)); @@ -151,12 +151,15 @@ public class TarifaHibernateDAO extends GenericHibernateDAO imp return (Tarifa) c.uniqueResult(); } - public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia) { + public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia, Empresa empresa) { Criteria c = getSession().createCriteria(getPersistentClass()); if (vigencia != null) { c.add(Restrictions.eq("vigenciaTarifa", vigencia)); } + if (empresa != null) { + c.createCriteria("marca").add(Restrictions.eq("empresa", empresa)); + } return c.list(); } @@ -168,44 +171,72 @@ public class TarifaHibernateDAO extends GenericHibernateDAO imp return c.list(); } - + public boolean buscarTarifaExisteTramo(Tramo tramo) { - Criteria c = this.makeCriteria(); - c.add(Restrictions.eq("tramo", tramo)); - c.add(Restrictions.eq("activo", Boolean.TRUE)); - c.setProjection(Projections.rowCount()); + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); return (HibernateFix.count(c.list()) > 0); - } + } @Override @Transactional(rollbackFor = BusinessException.class) - public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, boolean excluirTarifasDestino) throws BusinessException { + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { try { StringBuilder sQuery = null; - if(excluirTarifasDestino) { + if (excluirTarifasDestino) { sQuery = new StringBuilder("DELETE FROM TARIFA WHERE VIGENCIATARIFA_ID = :VIGENCIATARIFAID "); SQLQuery qrUpdate = getSession().createSQLQuery(sQuery.toString()); qrUpdate.setParameter("VIGENCIATARIFAID", vigenciaTarifaDestino.getVigenciatarifaId()); qrUpdate.executeUpdate(); } - + sQuery = new StringBuilder("INSERT INTO TARIFA( "); sQuery.append("TARIFA_ID,PRECIO,PRECIOREDABIERTO,TRAMO_ID,MARCA_ID,CLASESERVICIO_ID,PRECIOORIGINAL,MONEDA_ID,VIGENCIATARIFA_ID,STATUSTARIFA,ACTIVO,FECMODIF,") - .append("USUARIO_ID,IMPORTETAXAEMBARQUE,IMPORTEPEDAGIO,IMPORTEOUTROS,IMPORTESEGURO,ORGAOCONCEDENTE_ID,RUTA_ID,ORIGEN_ID,DESTINO_ID) ") - .append("SELECT ") - .append("TARIFA_SEQ.NEXTVAL,PRECIO,PRECIOREDABIERTO,TRAMO_ID,MARCA_ID,CLASESERVICIO_ID,PRECIOORIGINAL,MONEDA_ID,:VIGENCIATARIFAIDDESTINO,STATUSTARIFA,1,sysdate,") - .append(":USUARIOID,IMPORTETAXAEMBARQUE,IMPORTEPEDAGIO,IMPORTEOUTROS,IMPORTESEGURO,ORGAOCONCEDENTE_ID,RUTA_ID,ORIGEN_ID,DESTINO_ID ") - .append("FROM TARIFA ") - .append("WHERE ACTIVO = 1 ") - .append("AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDORIGEM "); - + .append("USUARIO_ID,IMPORTETAXAEMBARQUE,IMPORTEPEDAGIO,IMPORTEOUTROS,IMPORTESEGURO,ORGAOCONCEDENTE_ID,RUTA_ID,ORIGEN_ID,DESTINO_ID) ") + .append(" SELECT " + + "TARIFA_SEQ.NEXTVAL, " + + "PRECIO, " + + "PRECIOREDABIERTO, " + + "TRAMO_ID, " + + "tarifa.MARCA_ID, " + + "CLASESERVICIO_ID, " + + "PRECIOORIGINAL, " + + "MONEDA_ID, " + + ":VIGENCIATARIFAIDDESTINO, " + + "STATUSTARIFA, " + + "1, " + + "sysdate, " + + ":USUARIOID, " + + "IMPORTETAXAEMBARQUE, " + + "IMPORTEPEDAGIO, " + + "IMPORTEOUTROS, " + + "IMPORTESEGURO, " + + "ORGAOCONCEDENTE_ID, " + + "RUTA_ID, " + + "ORIGEN_ID, " + + "DESTINO_ID " + + + "FROM TARIFA tarifa " + + "INNER JOIN MARCA marca ON marca.MARCA_ID = tarifa.MARCA_ID " + + "WHERE tarifa.ACTIVO = 1 AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDORIGEM"); + + if (empresa != null) { + sQuery.append(" AND marca.EMPRESA_ID = :EMPRESA_ID"); + } + SQLQuery qrInsert = getSession().createSQLQuery(sQuery.toString()); qrInsert.setParameter("VIGENCIATARIFAIDORIGEM", vigenciaTarifaOrigem.getVigenciatarifaId()); qrInsert.setParameter("VIGENCIATARIFAIDDESTINO", vigenciaTarifaDestino.getVigenciatarifaId()); qrInsert.setParameter("USUARIOID", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + if (empresa != null) { + qrInsert.setParameter("EMPRESA_ID", empresa.getEmpresaId()); + } qrInsert.executeUpdate(); - + } catch (Exception e) { log.error(e.getMessage()); throw new BusinessException(e.getMessage(), e.getCause()); diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index c9f5de309..64d714cba 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -248,8 +248,7 @@ public class PuntoVenta implements Serializable { public PtovtaTitular getTitularId() { return titularId; } - - public void setTitularId(PtovtaTitular titularId) { +public void setTitularId(PtovtaTitular titularId) { this.titularId = titularId; } diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaService.java index 98882d8d5..d1f2f7e49 100644 --- a/src/com/rjconsultores/ventaboletos/service/TarifaService.java +++ b/src/com/rjconsultores/ventaboletos/service/TarifaService.java @@ -8,6 +8,7 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.Moneda; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; @@ -48,7 +49,7 @@ public interface TarifaService extends GenericService { public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta); - public List buscarPorVigencia(VigenciaTarifa vigencia); + public List buscarPorVigencia(VigenciaTarifa vigencia,Empresa empresa); public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem,Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda); @@ -58,7 +59,7 @@ public interface TarifaService extends GenericService { public boolean buscarTarifaExisteTramo(Tramo tramo); - public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, boolean excluirTarifasDestino) throws BusinessException; + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; public boolean existeTarifas(VigenciaTarifa vigenciaTarifa); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java index d5d35f887..097fd3635 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.TarifaDAO; import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.Moneda; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; @@ -177,8 +178,8 @@ public class TarifaServiceImpl implements TarifaService { return tarifaDAO.buscar(tramo, marca, claseServicio, vigenciaTarifa, moneda, ruta); } - public List buscarPorVigencia(VigenciaTarifa vigencia) { - return tarifaDAO.buscarTarifasAtivasInativasPorVigencia(vigencia); + public List buscarPorVigencia(VigenciaTarifa vigencia, Empresa empresa) { + return tarifaDAO.buscarTarifasAtivasInativasPorVigencia(vigencia, empresa); } public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem, @@ -272,8 +273,8 @@ public class TarifaServiceImpl implements TarifaService { } @Override - public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, boolean excluirTarifasDestino) throws BusinessException { - tarifaDAO.copiarTarifas(vigenciaTarifaOrigem, vigenciaTarifaDestino, excluirTarifasDestino); + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { + tarifaDAO.copiarTarifas(vigenciaTarifaOrigem, vigenciaTarifaDestino, empresa, excluirTarifasDestino); } @Override