Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6da0fa2626 | |||
| 52a7c4f9cf |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,54 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const inputFile = process.argv[2];
|
||||
const outputFile = process.argv[3];
|
||||
|
||||
if (!inputFile || !outputFile) {
|
||||
console.error("Usage: node convert_salary.js <input> <output>");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(inputFile, 'latin1');
|
||||
const lines = content.split(/\r?\n/);
|
||||
|
||||
const entries = [];
|
||||
const regex = /^(\d+)\s+([A-Z0-9]+)\s+(.+?)\s+((?:\d{1,3}(?:\.\d{3})*(?:,\d{2})?\s+)+)/;
|
||||
|
||||
for (const line of lines) {
|
||||
const match = line.trim().match(regex);
|
||||
if (match) {
|
||||
const code = match[2];
|
||||
let description = match[3].trim();
|
||||
const numbersPart = match[4].trim();
|
||||
|
||||
// Split numbers by whitespace
|
||||
const numbers = numbersPart.split(/\s+/).map(n => parseFloat(n.replace(/\./g, '').replace(',', '.')));
|
||||
|
||||
if (numbers.length >= 2) {
|
||||
const baseSalary = numbers[0];
|
||||
const subsidy = numbers[1];
|
||||
const gross = baseSalary + subsidy; // Calculate Gross sum
|
||||
|
||||
entries.push({
|
||||
code: code,
|
||||
name: description,
|
||||
baseSalary: baseSalary.toFixed(2),
|
||||
subsidy: subsidy.toFixed(2),
|
||||
gross: gross.toFixed(2)
|
||||
});
|
||||
} else if (numbers.length === 1) {
|
||||
// Only base
|
||||
entries.push({
|
||||
code: code,
|
||||
name: description,
|
||||
baseSalary: numbers[0].toFixed(2),
|
||||
subsidy: "0.00",
|
||||
gross: numbers[0].toFixed(2)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Parsed ${entries.length} entries.`);
|
||||
fs.writeFileSync(outputFile, JSON.stringify(entries, null, 2));
|
||||
@@ -0,0 +1,57 @@
|
||||
-- Phase 7 Hardening: Constraints and Indexes
|
||||
|
||||
-- 1. Unique Active Payroll Run
|
||||
-- Prevents duplicate runs for same Period, Ministry, OrgUnit, RunType unless older ones are Closed/Cancelled
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_payroll_run_active_unique
|
||||
ON payroll_run (period_id, ministry_id, org_unit_id, run_type)
|
||||
WHERE status NOT IN ('CLOSED', 'CANCELLED');
|
||||
|
||||
-- 2. Contract Date Validation
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'check_contract_dates') THEN
|
||||
ALTER TABLE agent_contract ADD CONSTRAINT check_contract_dates CHECK (start_date <= end_date OR end_date IS NULL);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- 3. Performance Indexes
|
||||
-- For Batch Fetching Absences (Check table existence first to avoid error if feature disabled)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT FROM pg_tables WHERE schemaname = 'public' AND tablename = 'absence') THEN
|
||||
CREATE INDEX IF NOT EXISTS idx_absence_agent_dates ON absence (agent_id, start_date, end_date);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- For Batch Fetching Attendance
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT FROM pg_tables WHERE schemaname = 'public' AND tablename = 'attendance_record') THEN
|
||||
CREATE INDEX IF NOT EXISTS idx_attendance_agent_date ON attendance_record (agent_id, date);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- For Batch Fetching Budget Lines
|
||||
CREATE INDEX IF NOT EXISTS idx_budget_line_org_econ ON budget_line (org_unit_id, economic_class);
|
||||
|
||||
-- For Batch Fetching Contracts
|
||||
CREATE INDEX IF NOT EXISTS idx_agent_contract_agent_period ON agent_contract (agent_id, start_date, end_date);
|
||||
|
||||
-- 4. Date Integrity Constraints (P15)
|
||||
-- Payroll Period Dates
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'chk_period_dates') THEN
|
||||
ALTER TABLE payroll_period ADD CONSTRAINT chk_period_dates CHECK (start_date <= end_date);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Absence Dates
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT FROM pg_tables WHERE schemaname = 'public' AND tablename = 'absence') THEN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'chk_absence_dates') THEN
|
||||
ALTER TABLE absence ADD CONSTRAINT chk_absence_dates CHECK (start_date <= end_date);
|
||||
END IF;
|
||||
END IF;
|
||||
END $$;
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>SIGEFP - Sistema Integrado de Gestão do Estado</name>
|
||||
<description>Sistema modular para gestão governamental</description>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<spring-boot.version>3.2.0</spring-boot.version>
|
||||
<spring-cloud.version>2023.0.0</spring-cloud.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>sigefp-common</module>
|
||||
<module>sigefp-admin</module>
|
||||
<module>sigefp-org</module>
|
||||
<module>sigefp-rh</module>
|
||||
<module>sigefp-budget</module>
|
||||
<module>sigefp-treasury</module>
|
||||
<module>sigefp-api</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<parameters>true</parameters>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
java : no main
|
||||
manifest attribute,
|
||||
in sigefp-api/target/
|
||||
sigefp-api-1.0.0-SNAP
|
||||
SHOT.jar
|
||||
No linha:1
|
||||
caractere:90
|
||||
+ ... $env:Path";
|
||||
java -jar sigefp-api/
|
||||
target/sigefp-api-1.0
|
||||
.0-SNAPSHOT.jar ...
|
||||
+ ~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
+ CategoryInfo
|
||||
: NotSpe
|
||||
cified: (no main
|
||||
manifes....0-SN
|
||||
APSHOT.jar:Strin
|
||||
g) [], RemoteExc
|
||||
eption
|
||||
+ FullyQualified
|
||||
ErrorId : Native
|
||||
CommandError
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,48 @@
|
||||
[INFO] Scanning for projects...
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Reactor Build Order:
|
||||
[INFO]
|
||||
[INFO] SIGEFP - Sistema Integrado de Gestπo do Estado [pom]
|
||||
[INFO] SIGEFP Common [jar]
|
||||
[INFO] SIGEFP Admin [jar]
|
||||
[INFO] SIGEFP Org [jar]
|
||||
[INFO] SIGEFP Budget [jar]
|
||||
[INFO] SIGEFP RH [jar]
|
||||
[INFO] SIGEFP Treasury [jar]
|
||||
[INFO] SIGEFP API [jar]
|
||||
[INFO]
|
||||
[INFO] --------------------< br.gov.sigefp:sigefp-parent >---------------------
|
||||
[INFO] Building SIGEFP - Sistema Integrado de Gestπo do Estado 1.0.0-SNAPSHOT [1/8]
|
||||
[INFO] from pom.xml
|
||||
[INFO] --------------------------------[ pom ]---------------------------------
|
||||
[INFO]
|
||||
[INFO] >>> spring-boot:3.2.0:run (default-cli) > test-compile @ sigefp-parent >>>
|
||||
[INFO]
|
||||
[INFO] <<< spring-boot:3.2.0:run (default-cli) < test-compile @ sigefp-parent <<<
|
||||
[INFO]
|
||||
[INFO]
|
||||
[INFO] --- spring-boot:3.2.0:run (default-cli) @ sigefp-parent ---
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Reactor Summary for SIGEFP - Sistema Integrado de Gestπo do Estado 1.0.0-SNAPSHOT:
|
||||
[INFO]
|
||||
[INFO] SIGEFP - Sistema Integrado de Gestπo do Estado ..... FAILURE [ 1.117 s]
|
||||
[INFO] SIGEFP Common ...................................... SKIPPED
|
||||
[INFO] SIGEFP Admin ....................................... SKIPPED
|
||||
[INFO] SIGEFP Org ......................................... SKIPPED
|
||||
[INFO] SIGEFP Budget ...................................... SKIPPED
|
||||
[INFO] SIGEFP RH .......................................... SKIPPED
|
||||
[INFO] SIGEFP Treasury .................................... SKIPPED
|
||||
[INFO] SIGEFP API ......................................... SKIPPED
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] BUILD FAILURE
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Total time: 2.371 s
|
||||
[INFO] Finished at: 2025-12-19T20:23:05Z
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.2.0:run (default-cli) on project sigefp-parent: Unable to find a suitable main class, please add a 'mainClass' property -> [Help 1]
|
||||
[ERROR]
|
||||
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
|
||||
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
|
||||
[ERROR]
|
||||
[ERROR] For more information about the errors and possible solutions, please read the following articles:
|
||||
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sigefp-admin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SIGEFP Admin</name>
|
||||
<description>Módulo de administração: utilizadores, perfis, auditoria</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sigefp-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SIGEFP API</name>
|
||||
<description>API REST principal do sistema</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Módulos do sistema -->
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-admin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-org</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-rh</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-budget</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-treasury</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Starters -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Database -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- JWT -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<version>0.12.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<version>0.12.3</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<version>0.12.3</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringDoc OpenAPI (Swagger) -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
-- 1. Ensure Deduction Types exist (With Mandatory field and Valid UUIDs)
|
||||
-- IRPS
|
||||
INSERT INTO deduction_type (id, created_at, updated_at, version, code, name, mandatory, economic_class_code)
|
||||
VALUES ('d0000000-0000-0000-0000-000000000001'::uuid, now(), now(), 0, 'IRPS', 'Imposto Profissional (IRPS)', true, NULL)
|
||||
ON CONFLICT (code) DO UPDATE SET mandatory = EXCLUDED.mandatory;
|
||||
|
||||
-- ID (Democracy)
|
||||
INSERT INTO deduction_type (id, created_at, updated_at, version, code, name, mandatory, economic_class_code)
|
||||
VALUES ('d0000000-0000-0000-0000-000000000002'::uuid, now(), now(), 0, 'ID', 'Imposto de Democracia', true, NULL)
|
||||
ON CONFLICT (code) DO UPDATE SET mandatory = EXCLUDED.mandatory;
|
||||
|
||||
-- ID_REF (Democracy Reformados)
|
||||
INSERT INTO deduction_type (id, created_at, updated_at, version, code, name, mandatory, economic_class_code)
|
||||
VALUES ('d0000000-0000-0000-0000-000000000003'::uuid, now(), now(), 0, 'ID_REF', 'Imposto Democracia (Reformados)', true, NULL)
|
||||
ON CONFLICT (code) DO UPDATE SET mandatory = EXCLUDED.mandatory;
|
||||
|
||||
-- 2. Force Clean Tax Bracket Table
|
||||
DELETE FROM tax_bracket;
|
||||
|
||||
-- 3. Insert IRPS Brackets (Progressive)
|
||||
INSERT INTO tax_bracket (id, created_at, updated_at, version, valid_from, lower_limit, upper_limit, rate_percentage, excess_deduction, fixed_amount, deduction_type_id)
|
||||
VALUES
|
||||
('b0000000-0000-0000-0000-000000000001'::uuid, now(), now(), 0, '2024-01-01', 0.00, 41667.00, 0.0100, 0.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000002'::uuid, now(), now(), 0, '2024-01-01', 41668.00, 83333.00, 0.0600, 2083.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000003'::uuid, now(), now(), 0, '2024-01-01', 83334.00, 208333.00, 0.0800, 3750.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000004'::uuid, now(), now(), 0, '2024-01-01', 208334.00, 300000.00, 0.1000, 7917.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000005'::uuid, now(), now(), 0, '2024-01-01', 300001.00, 400500.00, 0.1200, 13917.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000006'::uuid, now(), now(), 0, '2024-01-01', 400501.00, 750000.00, 0.1400, 21927.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000007'::uuid, now(), now(), 0, '2024-01-01', 750001.00, 1100000.00, 0.1600, 36927.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000008'::uuid, now(), now(), 0, '2024-01-01', 1100001.00, 1500000.00, 0.1800, 58927.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS')),
|
||||
('b0000000-0000-0000-0000-000000000009'::uuid, now(), now(), 0, '2024-01-01', 1500001.00, NULL, 0.2000, 88929.00, NULL, (SELECT id FROM deduction_type WHERE code = 'IRPS'));
|
||||
|
||||
-- 4. Insert Democracy Tax Brackets (Fixed Amount) - ID
|
||||
INSERT INTO tax_bracket (id, created_at, updated_at, version, valid_from, lower_limit, upper_limit, rate_percentage, excess_deduction, fixed_amount, deduction_type_id)
|
||||
VALUES
|
||||
('b0000000-0000-0000-0000-000000000010'::uuid, now(), now(), 0, '2024-01-01', 0.00, 41667.00, NULL, NULL, 500.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000011'::uuid, now(), now(), 0, '2024-01-01', 41668.00, 83333.00, NULL, NULL, 1000.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000012'::uuid, now(), now(), 0, '2024-01-01', 83334.00, 208333.00, NULL, NULL, 2000.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000013'::uuid, now(), now(), 0, '2024-01-01', 208334.00, 300000.00, NULL, NULL, 4000.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000014'::uuid, now(), now(), 0, '2024-01-01', 300001.00, 405500.00, NULL, NULL, 6000.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000015'::uuid, now(), now(), 0, '2024-01-01', 405501.00, 750000.00, NULL, NULL, 10000.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000016'::uuid, now(), now(), 0, '2024-01-01', 750001.00, 1100000.00, NULL, NULL, 15000.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000017'::uuid, now(), now(), 0, '2024-01-01', 1100001.00, 1500000.00, NULL, NULL, 17000.00, (SELECT id FROM deduction_type WHERE code = 'ID')),
|
||||
('b0000000-0000-0000-0000-000000000018'::uuid, now(), now(), 0, '2024-01-01', 1500001.00, NULL, NULL, NULL, 20000.00, (SELECT id FROM deduction_type WHERE code = 'ID'));
|
||||
|
||||
-- 5. Insert Democracy Tax Brackets (Reformados) - ID_REF
|
||||
-- 200.500 (Assuming up to 200.500)
|
||||
INSERT INTO tax_bracket (id, created_at, updated_at, version, valid_from, lower_limit, upper_limit, rate_percentage, excess_deduction, fixed_amount, deduction_type_id)
|
||||
VALUES
|
||||
('b0000000-0000-0000-0000-000000000019'::uuid, now(), now(), 0, '2024-01-01', 0.00, 200500.00, NULL, NULL, 500.00, (SELECT id FROM deduction_type WHERE code = 'ID_REF')),
|
||||
('b0000000-0000-0000-0000-000000000020'::uuid, now(), now(), 0, '2024-01-01', 200501.00, 500000.00, NULL, NULL, 1000.00, (SELECT id FROM deduction_type WHERE code = 'ID_REF')),
|
||||
('b0000000-0000-0000-0000-000000000021'::uuid, now(), now(), 0, '2024-01-01', 500001.00, 1000000.00, NULL, NULL, 2000.00, (SELECT id FROM deduction_type WHERE code = 'ID_REF')),
|
||||
('b0000000-0000-0000-0000-000000000022'::uuid, now(), now(), 0, '2024-01-01', 1000001.00, NULL, NULL, NULL, 3000.00, (SELECT id FROM deduction_type WHERE code = 'ID_REF'));
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sigefp-budget</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SIGEFP Budget</name>
|
||||
<description>Módulo de orçamento: exercícios, linhas orçamentais, execução</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-org</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sigefp-common</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SIGEFP Common</name>
|
||||
<description>Utilitários e classes compartilhadas</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-commons</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok para reduzir boilerplate -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Excel (Apache POI) -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- PDF (OpenPDF) -->
|
||||
<dependency>
|
||||
<groupId>com.github.librepdf</groupId>
|
||||
<artifactId>openpdf</artifactId>
|
||||
<version>1.3.30</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
-- =====================================================
|
||||
-- Script: Recriação completa do schema PUBLIC
|
||||
-- ATENÇÃO: Este script apaga TODOS os dados do banco!
|
||||
-- =====================================================
|
||||
--
|
||||
-- INSTRUÇÕES DE USO:
|
||||
-- 1. Se houver erro de "transação abortada", execute:
|
||||
-- ROLLBACK;
|
||||
-- 2. Depois execute este script completo
|
||||
-- =====================================================
|
||||
|
||||
-- Visualiza quantas tabelas existem antes de apagar
|
||||
SELECT
|
||||
'ATENÇÃO: Existem ' || COUNT(*) || ' tabelas que serão apagadas!' AS aviso
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = 'public';
|
||||
|
||||
-- Apaga o schema public e TODOS os objetos dentro dele
|
||||
-- (tabelas, views, funções, sequences, tipos, etc.)
|
||||
DROP SCHEMA IF EXISTS public CASCADE;
|
||||
|
||||
-- Recria o schema public vazio
|
||||
CREATE SCHEMA public;
|
||||
|
||||
-- Restaura as permissões padrão do PostgreSQL
|
||||
GRANT ALL ON SCHEMA public TO postgres;
|
||||
GRANT ALL ON SCHEMA public TO public;
|
||||
|
||||
-- Confirma que o schema foi recriado
|
||||
SELECT
|
||||
'Schema PUBLIC foi recriado com sucesso!' AS resultado,
|
||||
COUNT(*) AS tabelas_restantes
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = 'public';
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Índices para melhorar a performance de filtragem e busca de agentes
|
||||
CREATE INDEX IF NOT EXISTS idx_agents_org_unit ON agents(org_unit_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_agents_position ON agents(position_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_agents_functional_situation ON agents(functional_situation);
|
||||
CREATE INDEX IF NOT EXISTS idx_agents_appointment_type ON agents(appointment_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_agents_hire_date ON agents(hire_date);
|
||||
|
||||
-- Índices para os relacionamentos carregados em lote (Corrigido para nomes de tabela no singular)
|
||||
CREATE INDEX IF NOT EXISTS idx_agent_contract_active ON agent_contract(agent_id) WHERE is_active = true;
|
||||
CREATE INDEX IF NOT EXISTS idx_agent_bank_account_primary ON agent_bank_account(agent_id) WHERE is_primary = true;
|
||||
|
||||
-- Índices para o módulo de Orçamento
|
||||
CREATE INDEX IF NOT EXISTS idx_budget_execution_line ON budget_execution(budget_line_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_budget_execution_period ON budget_execution(period_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_budget_execution_type ON budget_execution(movement_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_budget_line_fiscal_year ON budget_line(fiscal_year_id);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,445 @@
|
||||
-- ============================================================================
|
||||
-- SCRIPT COMPLETO DE DADOS DE TESTE - SIGEFP
|
||||
-- Popula TODAS as 27 tabelas do sistema com dados realistas
|
||||
-- ============================================================================
|
||||
|
||||
-- Lista de tabelas a popular:
|
||||
-- 1. ministry, 2. org_unit, 3. position
|
||||
-- 4. fiscal_year, 5. budget_line, 6. budget_allocation, 7. budget_execution
|
||||
-- 8. bank
|
||||
-- 9. salary_category, 10. salary_grade, 11. salary_step, 12. salary_grid
|
||||
-- 13. deduction_type, 14. earning_type, 15. global_deduction_rule, 16. tax_bracket
|
||||
-- 17. agents, 18. agent_contract, 19. agent_bank_account, 20. agent_deduction_rule, 21. agent_status_history
|
||||
-- 22. career_events, 23. performance_evaluations
|
||||
-- 24. payroll_period, 25. payroll_run, 26. payroll_item
|
||||
-- 27. user_account, 28. role, 29. user_role, 30. permissions
|
||||
-- 31. payment_batch, 32. payment_order, 33. treasury_payment, 34. payments
|
||||
-- 35. audit_log
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
-- Ministerios
|
||||
v_min_financas UUID;
|
||||
v_min_saude UUID;
|
||||
v_min_educacao UUID;
|
||||
|
||||
-- Unidades Organicas
|
||||
v_ou_tesouro UUID;
|
||||
v_ou_orcamento UUID;
|
||||
v_ou_hospital UUID;
|
||||
v_ou_escola UUID;
|
||||
|
||||
-- Cargos
|
||||
v_pos_diretor UUID;
|
||||
v_pos_tecnico UUID;
|
||||
v_pos_medico UUID;
|
||||
v_pos_professor UUID;
|
||||
|
||||
-- Estrutura Salarial
|
||||
v_cat_ts UUID;
|
||||
v_grade_a UUID;
|
||||
v_step_1 UUID;
|
||||
v_step_2 UUID;
|
||||
v_step_3 UUID;
|
||||
|
||||
-- Tipos de Proventos e Descontos
|
||||
v_earning_vencimento UUID;
|
||||
v_earning_abono UUID;
|
||||
v_deduction_inps UUID;
|
||||
v_deduction_irps UUID;
|
||||
v_deduction_selo UUID;
|
||||
|
||||
-- Ano Fiscal e Linhas Orcamentais
|
||||
v_fy_2025 UUID;
|
||||
v_bl_financas UUID;
|
||||
v_bl_saude UUID;
|
||||
v_bl_educacao UUID;
|
||||
|
||||
-- Agentes
|
||||
v_agent_amilcar UUID;
|
||||
v_agent_francisca UUID;
|
||||
v_agent_joao UUID;
|
||||
v_agent_maria UUID;
|
||||
v_agent_samba UUID;
|
||||
|
||||
-- Periodo e Folha
|
||||
v_period_jan2025 UUID;
|
||||
v_payroll_run UUID;
|
||||
|
||||
-- Usuarios e Roles
|
||||
v_role_admin UUID;
|
||||
v_user_admin UUID;
|
||||
|
||||
-- Bancos
|
||||
v_bank_bceao UUID;
|
||||
BEGIN
|
||||
RAISE NOTICE '=== INICIANDO CARGA DE DADOS COMPLETA ===';
|
||||
|
||||
-- ========================================================================
|
||||
-- 1. MINISTERIOS
|
||||
-- ========================================================================
|
||||
SELECT id INTO v_min_financas FROM ministry WHERE code = 'MIN-001';
|
||||
|
||||
IF v_min_financas IS NULL THEN
|
||||
INSERT INTO ministry (id, code, name, acronym, is_active, created_at, updated_at)
|
||||
VALUES ('11111111-1111-1111-1111-111111111111', 'MIN-001', 'Ministerio das Financas', 'MINFIN', true, now(), now())
|
||||
RETURNING id INTO v_min_financas;
|
||||
END IF;
|
||||
|
||||
INSERT INTO ministry (id, code, name, acronym, is_active, created_at, updated_at) VALUES
|
||||
('22222222-2222-2222-2222-222222222222', 'MIN-002', 'Ministerio da Saude Publica', 'MINSAUDE', true, now(), now()),
|
||||
('33333333-3333-3333-3333-333333333333', 'MIN-003', 'Ministerio da Educacao Nacional', 'MINEDU', true, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_min_saude FROM ministry WHERE code = 'MIN-002';
|
||||
SELECT id INTO v_min_educacao FROM ministry WHERE code = 'MIN-003';
|
||||
|
||||
-- ========================================================================
|
||||
-- 2. UNIDADES ORGANICAS
|
||||
-- ========================================================================
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, unit_type, is_active, created_at, updated_at) VALUES
|
||||
('44444444-4444-4444-4444-444444444444', 'UO-001', 'Direcao-Geral do Tesouro', v_min_financas, 'DIRECTORATE', true, now(), now()),
|
||||
('55555555-5555-5555-5555-555555555555', 'UO-002', 'Direcao-Geral do Orcamento', v_min_financas, 'DIRECTORATE', true, now(), now()),
|
||||
('66666666-6666-6666-6666-666666666666', 'UO-003', 'Hospital Nacional Simao Mendes', v_min_saude, 'HOSPITAL', true, now(), now()),
|
||||
('77777777-7777-7777-7777-777777777777', 'UO-004', 'Escola Secundaria de Bissau', v_min_educacao, 'SCHOOL', true, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_ou_tesouro FROM org_unit WHERE code = 'UO-001';
|
||||
SELECT id INTO v_ou_orcamento FROM org_unit WHERE code = 'UO-002';
|
||||
SELECT id INTO v_ou_hospital FROM org_unit WHERE code = 'UO-003';
|
||||
SELECT id INTO v_ou_escola FROM org_unit WHERE code = 'UO-004';
|
||||
|
||||
-- ========================================================================
|
||||
-- 3. CARGOS (POSITIONS)
|
||||
-- ========================================================================
|
||||
INSERT INTO position (id, code, title, org_unit_id, is_active, created_at, updated_at) VALUES
|
||||
('88888888-8888-8888-8888-888888888888', 'POS-001', 'Diretor-Geral', v_ou_tesouro, true, now(), now()),
|
||||
('99999999-9999-9999-9999-999999999999', 'POS-002', 'Tecnico Superior', v_ou_orcamento, true, now(), now()),
|
||||
('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'POS-003', 'Medico Especialista', v_ou_hospital, true, now(), now()),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'POS-004', 'Professor', v_ou_escola, true, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_pos_diretor FROM position WHERE code = 'POS-001';
|
||||
SELECT id INTO v_pos_tecnico FROM position WHERE code = 'POS-002';
|
||||
SELECT id INTO v_pos_medico FROM position WHERE code = 'POS-003';
|
||||
SELECT id INTO v_pos_professor FROM position WHERE code = 'POS-004';
|
||||
|
||||
-- ========================================================================
|
||||
-- 4. ANO FISCAL
|
||||
-- ========================================================================
|
||||
INSERT INTO fiscal_year (id, year, start_date, end_date, status, created_at, updated_at) VALUES
|
||||
('f2025000-0000-0000-0000-000000000000', 2025, '2025-01-01', '2025-12-31', 'OPEN', now(), now())
|
||||
ON CONFLICT (year) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_fy_2025 FROM fiscal_year WHERE year = 2025;
|
||||
|
||||
-- ========================================================================
|
||||
-- 5. BANCOS
|
||||
-- ========================================================================
|
||||
INSERT INTO bank (id, code, name, swift_code, created_at, updated_at) VALUES
|
||||
('cccccccc-cccc-cccc-cccc-cccccccccccc', 'BCEAO', 'Banco Central dos Estados da Africa Ocidental', 'BCAOXXXX', now(), now()),
|
||||
('dddddddd-dddd-dddd-dddd-dddddddddddd', 'BRS', 'Banco Regional de Solidariedade', 'BRSXGWGW', now(), now()),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', 'BIC', 'Banco Internacional da Guine', 'BICXGWGW', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_bank_bceao FROM bank WHERE code = 'BCEAO';
|
||||
|
||||
-- ========================================================================
|
||||
-- 6. ESTRUTURA SALARIAL
|
||||
-- ========================================================================
|
||||
SELECT id INTO v_cat_ts FROM salary_category WHERE code = 'TS';
|
||||
SELECT id INTO v_grade_a FROM salary_grade WHERE code = 'A' AND category_id = v_cat_ts;
|
||||
SELECT id INTO v_step_1 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 1;
|
||||
|
||||
-- Verificar se os steps já existem antes de inserir
|
||||
IF NOT EXISTS (SELECT 1 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 2) THEN
|
||||
INSERT INTO salary_step (id, grade_id, step_number, created_at, updated_at) VALUES
|
||||
('00000002-0000-0000-0000-000000000000', v_grade_a, 2, now(), now());
|
||||
END IF;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 3) THEN
|
||||
INSERT INTO salary_step (id, grade_id, step_number, created_at, updated_at) VALUES
|
||||
('00000003-0000-0000-0000-000000000000', v_grade_a, 3, now(), now());
|
||||
END IF;
|
||||
|
||||
SELECT id INTO v_step_2 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 2;
|
||||
SELECT id INTO v_step_3 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 3;
|
||||
|
||||
INSERT INTO salary_grid (id, step_id, base_amount, valid_from, created_at, updated_at) VALUES
|
||||
('00000020-0000-0000-0000-000000000000', v_step_2, 550000.00, '2024-01-01', now(), now()),
|
||||
('00000030-0000-0000-0000-000000000000', v_step_3, 600000.00, '2024-01-01', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 7. TIPOS DE PROVENTOS (EARNING_TYPE)
|
||||
-- ========================================================================
|
||||
INSERT INTO earning_type (id, code, name, taxable, economic_class_code, created_at, updated_at) VALUES
|
||||
('00000100-0000-0000-0000-000000000000', 'VENC-BASE', 'Vencimento Base', true, '311100', now(), now()),
|
||||
('00000200-0000-0000-0000-000000000000', 'ABONO-FAM', 'Abono de Familia', false, '311200', now(), now()),
|
||||
('00000300-0000-0000-0000-000000000000', 'SUBSIDIO-FUNC', 'Subsidio de Funcao', true, '311300', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_earning_vencimento FROM earning_type WHERE code = 'VENC-BASE';
|
||||
SELECT id INTO v_earning_abono FROM earning_type WHERE code = 'ABONO-FAM';
|
||||
|
||||
-- ========================================================================
|
||||
-- 8. TIPOS DE DESCONTOS (DEDUCTION_TYPE)
|
||||
-- ========================================================================
|
||||
INSERT INTO deduction_type (id, code, name, mandatory, economic_class_code, created_at, updated_at) VALUES
|
||||
('00001000-0000-0000-0000-000000000000', 'INPS', 'Instituto Nacional de Previdencia Social', true, '321100', now(), now()),
|
||||
('00002000-0000-0000-0000-000000000000', 'IRPS', 'Imposto sobre Rendimento de Pessoas Singulares', true, '321200', now(), now()),
|
||||
('00003000-0000-0000-0000-000000000000', 'SELO', 'Imposto de Selo', true, '321300', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_deduction_inps FROM deduction_type WHERE code = 'INPS';
|
||||
SELECT id INTO v_deduction_irps FROM deduction_type WHERE code = 'IRPS';
|
||||
SELECT id INTO v_deduction_selo FROM deduction_type WHERE code = 'SELO';
|
||||
|
||||
-- ========================================================================
|
||||
-- 9. REGRAS GLOBAIS DE DESCONTO
|
||||
-- ========================================================================
|
||||
INSERT INTO global_deduction_rule (id, deduction_type_id, percentage, active, valid_from, created_at, updated_at) VALUES
|
||||
('00010000-0000-0000-0000-000000000000', v_deduction_inps, 0.0700, true, '2024-01-01', now(), now()),
|
||||
('00020000-0000-0000-0000-000000000000', v_deduction_selo, 0.0030, true, '2024-01-01', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 10. ESCALOES DE IRPS (TAX_BRACKET)
|
||||
-- ========================================================================
|
||||
INSERT INTO tax_bracket (id, deduction_type_id, lower_limit, upper_limit, rate_percentage, excess_deduction, valid_from, created_at, updated_at) VALUES
|
||||
('00010001-0000-0000-0000-000000000000', v_deduction_irps, 0, 50000, 0.0000, 0, '2024-01-01', now(), now()),
|
||||
('00010002-0000-0000-0000-000000000000', v_deduction_irps, 50001, 150000, 0.1000, 5000, '2024-01-01', now(), now()),
|
||||
('00010003-0000-0000-0000-000000000000', v_deduction_irps, 150001, 250000, 0.1500, 12500, '2024-01-01', now(), now()),
|
||||
('00010004-0000-0000-0000-000000000000', v_deduction_irps, 250001, 500000, 0.2000, 25000, '2024-01-01', now(), now()),
|
||||
('00010005-0000-0000-0000-000000000000', v_deduction_irps, 500001, NULL, 0.2500, 50000, '2024-01-01', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 11. LINHAS ORCAMENTAIS
|
||||
-- ========================================================================
|
||||
INSERT INTO budget_line (id, fiscal_year_id, code, description, ministry_id, org_unit_id, economic_class, created_at, updated_at) VALUES
|
||||
('00020001-0000-0000-0000-000000000000', v_fy_2025, '2025-MINFIN-311100', 'Vencimentos Base - Financas', v_min_financas, v_ou_tesouro, '311100', now(), now()),
|
||||
('00020002-0000-0000-0000-000000000000', v_fy_2025, '2025-MINSAUDE-311100', 'Vencimentos Base - Saude', v_min_saude, v_ou_hospital, '311100', now(), now()),
|
||||
('00020003-0000-0000-0000-000000000000', v_fy_2025, '2025-MINEDU-311100', 'Vencimentos Base - Educacao', v_min_educacao, v_ou_escola, '311100', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_bl_financas FROM budget_line WHERE code = '2025-MINFIN-311100';
|
||||
SELECT id INTO v_bl_saude FROM budget_line WHERE code = '2025-MINSAUDE-311100';
|
||||
SELECT id INTO v_bl_educacao FROM budget_line WHERE code = '2025-MINEDU-311100';
|
||||
|
||||
-- ========================================================================
|
||||
-- 12. ALOCACOES ORCAMENTAIS
|
||||
-- ========================================================================
|
||||
INSERT INTO budget_allocation (id, budget_line_id, initial_amount, adjustment_amount, created_at, updated_at) VALUES
|
||||
('00030001-0000-0000-0000-000000000000', v_bl_financas, 50000000.00, 0.00, now(), now()),
|
||||
('00030002-0000-0000-0000-000000000000', v_bl_saude, 30000000.00, 0.00, now(), now()),
|
||||
('00030003-0000-0000-0000-000000000000', v_bl_educacao, 40000000.00, 0.00, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 13. AGENTES
|
||||
-- ========================================================================
|
||||
INSERT INTO agents (
|
||||
id, matricula, nif, bi_number, full_name, birth_date, nationality,
|
||||
email, phone, address, hire_date, posse_date, appointment_type,
|
||||
functional_situation, literary_qualification, status,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
eligible_dependents_count, created_at, updated_at
|
||||
) VALUES
|
||||
('a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1', '2020/001', '100123456', 'BI123456', 'Amilcar Cabral Silva', '1975-03-15', 'Guineense',
|
||||
'amilcar.silva@minfin.gov.gw', '+245 955 123 456', 'Bairro de Penha, Bissau',
|
||||
'2020-01-15', '2020-02-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
v_ou_tesouro, v_pos_diretor, v_cat_ts, v_grade_a, v_step_3, 2, now(), now()),
|
||||
|
||||
('b2b2b2b2-b2b2-b2b2-b2b2-b2b2b2b2b2b2', '2021/045', '100234567', 'BI234567', 'Francisca Pereira Gomes', '1988-07-22', 'Guineense',
|
||||
'francisca.gomes@minfin.gov.gw', '+245 955 234 567', 'Bairro Militar, Bissau',
|
||||
'2021-03-10', '2021-04-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'MESTRADO', 'ACTIVE',
|
||||
v_ou_orcamento, v_pos_tecnico, v_cat_ts, v_grade_a, v_step_2, 1, now(), now()),
|
||||
|
||||
('c3c3c3c3-c3c3-c3c3-c3c3-c3c3c3c3c3c3', '2019/089', '100345678', 'BI345678', 'Dr. Joao Vieira Mendes', '1982-11-30', 'Guineense',
|
||||
'joao.mendes@minsaude.gov.gw', '+245 955 345 678', 'Bairro de Antula, Bissau',
|
||||
'2019-06-01', '2019-07-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'DOUTORAMENTO', 'ACTIVE',
|
||||
v_ou_hospital, v_pos_medico, v_cat_ts, v_grade_a, v_step_3, 3, now(), now()),
|
||||
|
||||
('d4d4d4d4-d4d4-d4d4-d4d4-d4d4d4d4d4d4', '2022/112', '100456789', 'BI456789', 'Maria da Luz Correia', '1990-05-18', 'Guineense',
|
||||
'maria.correia@minedu.gov.gw', '+245 955 456 789', 'Bairro de Quelele, Bissau',
|
||||
'2022-09-01', '2022-10-01', 'NOMEACAO_PROVISORIA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
v_ou_escola, v_pos_professor, v_cat_ts, v_grade_a, v_step_1, 0, now(), now()),
|
||||
|
||||
('e5e5e5e5-e5e5-e5e5-e5e5-e5e5e5e5e5e5', '2024/201', '100567890', 'BI567890', 'Samba Djalo', '1995-09-12', 'Guineense',
|
||||
'samba.djalo@minfin.gov.gw', '+245 955 567 890', 'Bairro de Chao de Papel, Bissau',
|
||||
'2024-11-01', '2024-12-01', 'NOMEACAO_PROVISORIA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
v_ou_tesouro, v_pos_tecnico, v_cat_ts, v_grade_a, v_step_1, 0, now(), now())
|
||||
ON CONFLICT (matricula) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_agent_amilcar FROM agents WHERE matricula = '2020/001';
|
||||
SELECT id INTO v_agent_francisca FROM agents WHERE matricula = '2021/045';
|
||||
SELECT id INTO v_agent_joao FROM agents WHERE matricula = '2019/089';
|
||||
SELECT id INTO v_agent_maria FROM agents WHERE matricula = '2022/112';
|
||||
SELECT id INTO v_agent_samba FROM agents WHERE matricula = '2024/201';
|
||||
|
||||
-- ========================================================================
|
||||
-- 14. CONTAS BANCARIAS DOS AGENTES
|
||||
-- ========================================================================
|
||||
INSERT INTO agent_bank_account (id, agent_id, bank, account_number, branch_code, is_primary, created_at, updated_at) VALUES
|
||||
('00040001-0000-0000-0000-000000000000', v_agent_amilcar, 'BCEAO', '1234567890', '001', true, now(), now()),
|
||||
('00040002-0000-0000-0000-000000000000', v_agent_francisca, 'BRS', '2345678901', '002', true, now(), now()),
|
||||
('00040003-0000-0000-0000-000000000000', v_agent_joao, 'BIC', '3456789012', '003', true, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 15. CONTRATOS DOS AGENTES
|
||||
-- ========================================================================
|
||||
INSERT INTO agent_contract (
|
||||
id, agent_id, contract_type, start_date, is_active,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
base_salary_ref, weekly_hours, created_at, updated_at
|
||||
) VALUES
|
||||
('00050001-0000-0000-0000-000000000000', v_agent_amilcar, 'PERMANENT', '2020-02-01', true,
|
||||
v_ou_tesouro, v_pos_diretor, v_cat_ts, v_grade_a, v_step_3, 600000.00, 40.00, now(), now()),
|
||||
('00050002-0000-0000-0000-000000000000', v_agent_francisca, 'PERMANENT', '2021-04-01', true,
|
||||
v_ou_orcamento, v_pos_tecnico, v_cat_ts, v_grade_a, v_step_2, 550000.00, 40.00, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 16. HISTORICO DE STATUS DOS AGENTES
|
||||
-- ========================================================================
|
||||
INSERT INTO agent_status_history (
|
||||
id, agent_id, changed_at, previous_status, new_status, event_type, reason
|
||||
) VALUES
|
||||
('00060001-0000-0000-0000-000000000000', v_agent_amilcar, '2020-02-01', 'REGISTERED', 'ACTIVE', 'ADMISSAO', 'Nomeacao definitiva'),
|
||||
('00060002-0000-0000-0000-000000000000', v_agent_francisca, '2021-04-01', 'REGISTERED', 'ACTIVE', 'ADMISSAO', 'Nomeacao definitiva')
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 17. EVENTOS DE CARREIRA
|
||||
-- ========================================================================
|
||||
INSERT INTO career_events (
|
||||
id, agent_id, event_type, effective_date, document_ref, reason,
|
||||
new_org_unit, new_position, new_category, new_grade, new_step,
|
||||
total_base_amount, created_at, updated_at
|
||||
) VALUES
|
||||
('00070001-0000-0000-0000-000000000000', v_agent_amilcar, 'ADMISSAO', '2020-02-01', 'DEC-2020-001', 'Admissao por concurso',
|
||||
v_ou_tesouro, v_pos_diretor, v_cat_ts, v_grade_a, v_step_3, 600000.00, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 18. AVALIACOES DE DESEMPENHO
|
||||
-- ========================================================================
|
||||
INSERT INTO performance_evaluations (
|
||||
id, agent_id, reference_year, score, qualitative_mention, evaluation_date, created_at, updated_at
|
||||
) VALUES
|
||||
('00080001-0000-0000-0000-000000000000', v_agent_amilcar, 2024, 18.5, 'EXCELENTE', '2024-12-15', now(), now()),
|
||||
('00080002-0000-0000-0000-000000000000', v_agent_francisca, 2024, 17.0, 'BOM', '2024-12-15', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 19. PERIODO DE FOLHA
|
||||
-- ========================================================================
|
||||
INSERT INTO payroll_period (id, fiscal_year, month, start_date, end_date, status, created_at, updated_at) VALUES
|
||||
('00090001-0000-0000-0000-000000000000', 2025, 1, '2025-01-01', '2025-01-31', 'OPEN', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_period_jan2025 FROM payroll_period WHERE fiscal_year = 2025 AND month = 1;
|
||||
|
||||
-- ========================================================================
|
||||
-- 20. PROCESSAMENTO DE FOLHA
|
||||
-- ========================================================================
|
||||
INSERT INTO payroll_run (id, period_id, ministry_id, run_type, status, created_at, updated_at) VALUES
|
||||
('000a0001-0000-0000-0000-000000000000', v_period_jan2025, v_min_financas, 'REGULAR', 'DRAFT', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_payroll_run FROM payroll_run WHERE period_id = v_period_jan2025;
|
||||
|
||||
-- ========================================================================
|
||||
-- 21. ITENS DE FOLHA
|
||||
-- ========================================================================
|
||||
INSERT INTO payroll_item (
|
||||
id, payroll_run_id, agent_id, line_type, earning_type_id, deduction_type_id,
|
||||
description, unit_amount, quantity, total_amount, budget_line_id, created_at, updated_at
|
||||
) VALUES
|
||||
-- Vencimento Amilcar
|
||||
('000b0001-0000-0000-0000-000000000000', v_payroll_run, v_agent_amilcar, 'EARNING', v_earning_vencimento, NULL,
|
||||
'Vencimento Base', 600000.00, 1.00, 600000.00, v_bl_financas, now(), now()),
|
||||
-- INPS Amilcar
|
||||
('000b0002-0000-0000-0000-000000000000', v_payroll_run, v_agent_amilcar, 'DEDUCTION', NULL, v_deduction_inps,
|
||||
'INPS 7%', 42000.00, 1.00, 42000.00, NULL, now(), now()),
|
||||
-- Vencimento Francisca
|
||||
('000b0003-0000-0000-0000-000000000000', v_payroll_run, v_agent_francisca, 'EARNING', v_earning_vencimento, NULL,
|
||||
'Vencimento Base', 550000.00, 1.00, 550000.00, v_bl_financas, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 22. USUARIOS E ROLES
|
||||
-- ========================================================================
|
||||
INSERT INTO role (id, code, name, description, created_at, updated_at) VALUES
|
||||
('000c0001-0000-0000-0000-000000000000', 'ADMIN', 'Administrador', 'Acesso total ao sistema', now(), now()),
|
||||
('000c0002-0000-0000-0000-000000000000', 'RH_MANAGER', 'Gestor de RH', 'Gestao de recursos humanos', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_role_admin FROM role WHERE code = 'ADMIN';
|
||||
|
||||
INSERT INTO user_account (id, username, email, full_name, password_hash, is_active, created_at, updated_at) VALUES
|
||||
('000d0001-0000-0000-0000-000000000000', 'admin', 'admin@sigefp.gov.gw', 'Administrador do Sistema',
|
||||
'$2a$10$N9qo8uLOickgx2ZMRZoMye1234567890abcdefghijklmnopqrstuvwxyz', true, now(), now())
|
||||
ON CONFLICT (username) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_user_admin FROM user_account WHERE username = 'admin';
|
||||
|
||||
INSERT INTO user_role (id, user_id, role_id, created_at, updated_at) VALUES
|
||||
('000e0001-0000-0000-0000-000000000000', v_user_admin, v_role_admin, now(), now())
|
||||
ON CONFLICT (user_id, role_id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 23. PERMISSOES
|
||||
-- ========================================================================
|
||||
INSERT INTO permissions (id, code, description, module, created_at, updated_at) VALUES
|
||||
('000f0001-0000-0000-0000-000000000000', 'AGENT_VIEW', 'Visualizar agentes', 'RH', now(), now()),
|
||||
('000f0002-0000-0000-0000-000000000000', 'AGENT_CREATE', 'Criar agentes', 'RH', now(), now()),
|
||||
('000f0003-0000-0000-0000-000000000000', 'PAYROLL_PROCESS', 'Processar folha', 'RH', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- 24. AUDIT LOG
|
||||
-- ========================================================================
|
||||
INSERT INTO audit_log (id, user_id, username, module, entity, action, description, created_at) VALUES
|
||||
('00100001-0000-0000-0000-000000000000', v_user_admin, 'admin', 'RH', 'Agent', 'CREATE', 'Criacao de agente Amilcar Cabral Silva', now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
RAISE NOTICE '=== CARGA DE DADOS COMPLETA FINALIZADA ===';
|
||||
RAISE NOTICE 'Total de tabelas populadas: 24+';
|
||||
END $$;
|
||||
|
||||
-- ========================================================================
|
||||
-- VERIFICACAO FINAL
|
||||
-- ========================================================================
|
||||
SELECT 'MINISTERIOS' as tabela, COUNT(*)::text as total FROM ministry
|
||||
UNION ALL SELECT 'UNIDADES ORGANICAS', COUNT(*)::text FROM org_unit
|
||||
UNION ALL SELECT 'CARGOS', COUNT(*)::text FROM position
|
||||
UNION ALL SELECT 'BANCOS', COUNT(*)::text FROM bank
|
||||
UNION ALL SELECT 'ANOS FISCAIS', COUNT(*)::text FROM fiscal_year
|
||||
UNION ALL SELECT 'LINHAS ORCAMENTAIS', COUNT(*)::text FROM budget_line
|
||||
UNION ALL SELECT 'ALOCACOES ORCAMENTAIS', COUNT(*)::text FROM budget_allocation
|
||||
UNION ALL SELECT 'CATEGORIAS SALARIAIS', COUNT(*)::text FROM salary_category
|
||||
UNION ALL SELECT 'GRAUS SALARIAIS', COUNT(*)::text FROM salary_grade
|
||||
UNION ALL SELECT 'ESCALOES SALARIAIS', COUNT(*)::text FROM salary_step
|
||||
UNION ALL SELECT 'GRELHA SALARIAL', COUNT(*)::text FROM salary_grid
|
||||
UNION ALL SELECT 'TIPOS DE PROVENTOS', COUNT(*)::text FROM earning_type
|
||||
UNION ALL SELECT 'TIPOS DE DESCONTOS', COUNT(*)::text FROM deduction_type
|
||||
UNION ALL SELECT 'REGRAS GLOBAIS', COUNT(*)::text FROM global_deduction_rule
|
||||
UNION ALL SELECT 'ESCALOES IRPS', COUNT(*)::text FROM tax_bracket
|
||||
UNION ALL SELECT 'AGENTES', COUNT(*)::text FROM agents
|
||||
UNION ALL SELECT 'CONTAS BANCARIAS', COUNT(*)::text FROM agent_bank_account
|
||||
UNION ALL SELECT 'CONTRATOS', COUNT(*)::text FROM agent_contract
|
||||
UNION ALL SELECT 'HISTORICO STATUS', COUNT(*)::text FROM agent_status_history
|
||||
UNION ALL SELECT 'EVENTOS CARREIRA', COUNT(*)::text FROM career_events
|
||||
UNION ALL SELECT 'AVALIACOES', COUNT(*)::text FROM performance_evaluations
|
||||
UNION ALL SELECT 'PERIODOS FOLHA', COUNT(*)::text FROM payroll_period
|
||||
UNION ALL SELECT 'PROCESSAMENTOS FOLHA', COUNT(*)::text FROM payroll_run
|
||||
UNION ALL SELECT 'ITENS FOLHA', COUNT(*)::text FROM payroll_item
|
||||
UNION ALL SELECT 'ROLES', COUNT(*)::text FROM role
|
||||
UNION ALL SELECT 'USUARIOS', COUNT(*)::text FROM user_account
|
||||
UNION ALL SELECT 'USER_ROLES', COUNT(*)::text FROM user_role
|
||||
UNION ALL SELECT 'PERMISSOES', COUNT(*)::text FROM permissions
|
||||
UNION ALL SELECT 'AUDIT_LOG', COUNT(*)::text FROM audit_log
|
||||
ORDER BY tabela;
|
||||
@@ -0,0 +1,31 @@
|
||||
-- Script Corrigido de Insercao de Dados de Teste
|
||||
|
||||
-- Inserir 2 ministerios adicionais
|
||||
INSERT INTO ministry (id, code, name, created_at, updated_at) VALUES
|
||||
('22222222-2222-2222-2222-222222222222', 'MIN-002', 'Ministerio da Saude Publica', now(), now()),
|
||||
('33333333-3333-3333-3333-333333333333', 'MIN-003', 'Ministerio da Educacao Nacional', now(), now());
|
||||
|
||||
-- Inserir unidades organicas para os novos ministerios
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, parent_id, created_at, updated_at) VALUES
|
||||
('44444444-4444-4444-4444-444444444444', 'UO-001', 'Direcao-Geral do Tesouro', (SELECT id FROM ministry WHERE code = 'MIN-001'), NULL, now(), now()),
|
||||
('55555555-5555-5555-5555-555555555555', 'UO-002', 'Direcao-Geral do Orcamento', (SELECT id FROM ministry WHERE code = 'MIN-001'), NULL, now(), now()),
|
||||
('66666666-6666-6666-6666-666666666666', 'UO-003', 'Hospital Nacional Simao Mendes', '22222222-2222-2222-2222-222222222222', NULL, now(), now()),
|
||||
('77777777-7777-7777-7777-777777777777', 'UO-004', 'Escola Secundaria de Bissau', '33333333-3333-3333-3333-333333333333', NULL, now(), now());
|
||||
|
||||
-- Inserir cargos adicionais (SEM description)
|
||||
INSERT INTO position (id, code, title, created_at, updated_at) VALUES
|
||||
('88888888-8888-8888-8888-888888888888', 'CAR-005', 'Diretor-Geral', now(), now()),
|
||||
('99999999-9999-9999-9999-999999999999', 'CAR-006', 'Tecnico Superior', now(), now()),
|
||||
('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'CAR-007', 'Medico Especialista', now(), now()),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'CAR-008', 'Professor', now(), now());
|
||||
|
||||
-- Verificar resultados
|
||||
SELECT 'MINISTERIOS' as tipo, COUNT(*)::text as total FROM ministry
|
||||
UNION ALL
|
||||
SELECT 'UNIDADES ORGANICAS', COUNT(*)::text FROM org_unit
|
||||
UNION ALL
|
||||
SELECT 'CARGOS', COUNT(*)::text FROM position
|
||||
UNION ALL
|
||||
SELECT 'BANCOS', COUNT(*)::text FROM bank
|
||||
UNION ALL
|
||||
SELECT 'AGENTES', COUNT(*)::text FROM agents;
|
||||
@@ -0,0 +1,186 @@
|
||||
-- ============================================
|
||||
-- SCRIPT COMPLETO DE DADOS DE TESTE - SIGEFP
|
||||
-- Baseado no mapeamento completo de entidades
|
||||
-- ============================================
|
||||
|
||||
-- IMPORTANTE: Este script usa os dados existentes do usuario e adiciona dados complementares
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
-- IDs existentes (do usuario)
|
||||
v_min_existente UUID;
|
||||
v_ou_sec UUID;
|
||||
v_ou_dir UUID;
|
||||
|
||||
-- IDs novos
|
||||
v_min_saude UUID;
|
||||
v_min_educacao UUID;
|
||||
v_ou_tesouro UUID;
|
||||
v_ou_orcamento UUID;
|
||||
v_ou_hospital UUID;
|
||||
v_ou_escola UUID;
|
||||
v_pos_diretor UUID;
|
||||
v_pos_tecnico UUID;
|
||||
v_pos_medico UUID;
|
||||
v_pos_professor UUID;
|
||||
|
||||
-- Estrutura Salarial
|
||||
v_cat_ts UUID;
|
||||
v_grade_a UUID;
|
||||
v_step_1 UUID;
|
||||
v_step_2 UUID;
|
||||
v_step_3 UUID;
|
||||
|
||||
-- Ano Fiscal
|
||||
v_fy_2025 UUID;
|
||||
BEGIN
|
||||
-- ============================================
|
||||
-- 1. OBTER DADOS EXISTENTES
|
||||
-- ============================================
|
||||
SELECT id INTO v_min_existente FROM ministry WHERE code = 'MIN-001';
|
||||
SELECT id INTO v_ou_sec FROM org_unit WHERE code = 'SEC-001';
|
||||
SELECT id INTO v_ou_dir FROM org_unit WHERE code = 'DIR-003';
|
||||
|
||||
RAISE NOTICE 'Ministerio existente: %', v_min_existente;
|
||||
|
||||
-- ============================================
|
||||
-- 2. INSERIR MINISTERIOS ADICIONAIS
|
||||
-- ============================================
|
||||
INSERT INTO ministry (id, code, name, is_active, created_at, updated_at)
|
||||
VALUES
|
||||
('22222222-2222-2222-2222-222222222222', 'MIN-002', 'Ministerio da Saude Publica', true, now(), now()),
|
||||
('33333333-3333-3333-3333-333333333333', 'MIN-003', 'Ministerio da Educacao Nacional', true, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_min_saude FROM ministry WHERE code = 'MIN-002';
|
||||
SELECT id INTO v_min_educacao FROM ministry WHERE code = 'MIN-003';
|
||||
|
||||
-- ============================================
|
||||
-- 3. INSERIR UNIDADES ORGANICAS
|
||||
-- IMPORTANTE: unit_type e OBRIGATORIO!
|
||||
-- ============================================
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, parent_unit_id, unit_type, is_active, created_at, updated_at)
|
||||
VALUES
|
||||
('44444444-4444-4444-4444-444444444444', 'UO-001', 'Direcao-Geral do Tesouro', v_min_existente, NULL, 'DIRECTORATE', true, now(), now()),
|
||||
('55555555-5555-5555-5555-555555555555', 'UO-002', 'Direcao-Geral do Orcamento', v_min_existente, NULL, 'DIRECTORATE', true, now(), now()),
|
||||
('66666666-6666-6666-6666-666666666666', 'UO-003', 'Hospital Nacional Simao Mendes', v_min_saude, NULL, 'HOSPITAL', true, now(), now()),
|
||||
('77777777-7777-7777-7777-777777777777', 'UO-004', 'Escola Secundaria de Bissau', v_min_educacao, NULL, 'SCHOOL', true, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_ou_tesouro FROM org_unit WHERE code = 'UO-001';
|
||||
SELECT id INTO v_ou_orcamento FROM org_unit WHERE code = 'UO-002';
|
||||
SELECT id INTO v_ou_hospital FROM org_unit WHERE code = 'UO-003';
|
||||
SELECT id INTO v_ou_escola FROM org_unit WHERE code = 'UO-004';
|
||||
|
||||
-- ============================================
|
||||
-- 4. INSERIR CARGOS (POSITIONS)
|
||||
-- IMPORTANTE: org_unit_id e OBRIGATORIO!
|
||||
-- ============================================
|
||||
INSERT INTO position (id, code, title, org_unit_id, is_active, created_at, updated_at)
|
||||
VALUES
|
||||
('88888888-8888-8888-8888-888888888888', 'POS-001', 'Diretor-Geral', v_ou_tesouro, true, now(), now()),
|
||||
('99999999-9999-9999-9999-999999999999', 'POS-002', 'Tecnico Superior', v_ou_orcamento, true, now(), now()),
|
||||
('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'POS-003', 'Medico Especialista', v_ou_hospital, true, now(), now()),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'POS-004', 'Professor', v_ou_escola, true, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_pos_diretor FROM position WHERE code = 'POS-001';
|
||||
SELECT id INTO v_pos_tecnico FROM position WHERE code = 'POS-002';
|
||||
SELECT id INTO v_pos_medico FROM position WHERE code = 'POS-003';
|
||||
SELECT id INTO v_pos_professor FROM position WHERE code = 'POS-004';
|
||||
|
||||
-- ============================================
|
||||
-- 5. ESTRUTURA SALARIAL
|
||||
-- ============================================
|
||||
SELECT id INTO v_cat_ts FROM salary_category WHERE code = 'TS';
|
||||
SELECT id INTO v_grade_a FROM salary_grade WHERE code = 'A' AND category_id = v_cat_ts;
|
||||
SELECT id INTO v_step_1 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 1;
|
||||
|
||||
-- Adicionar escaloes 2 e 3
|
||||
INSERT INTO salary_step (id, grade_id, step_number, created_at, updated_at)
|
||||
VALUES
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', v_grade_a, 2, now(), now()),
|
||||
('ffffffff-ffff-ffff-ffff-ffffffffffff', v_grade_a, 3, now(), now())
|
||||
ON CONFLICT (grade_id, step_number) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_step_2 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 2;
|
||||
SELECT id INTO v_step_3 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 3;
|
||||
|
||||
-- Valores da grelha salarial
|
||||
INSERT INTO salary_grid (id, step_id, base_amount, valid_from, created_at, updated_at)
|
||||
VALUES
|
||||
('10101010-1010-1010-1010-101010101010', v_step_2, 550000.00, '2024-01-01', now(), now()),
|
||||
('20202020-2020-2020-2020-202020202020', v_step_3, 600000.00, '2024-01-01', now(), now())
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- ============================================
|
||||
-- 6. ANO FISCAL
|
||||
-- ============================================
|
||||
SELECT id INTO v_fy_2025 FROM fiscal_year WHERE year = 2025;
|
||||
|
||||
-- ============================================
|
||||
-- 7. AGENTES (usando UUIDs simples, nao FKs)
|
||||
-- ============================================
|
||||
INSERT INTO agents (
|
||||
id, matricula, nif, bi_number, full_name, birth_date, nationality,
|
||||
email, phone, address, hire_date, posse_date, appointment_type,
|
||||
functional_situation, literary_qualification, status,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
eligible_dependents_count, created_at, updated_at
|
||||
) VALUES
|
||||
('a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1', '2020/001', '100123456', 'BI123456', 'Amilcar Cabral Silva', '1975-03-15', 'Guineense',
|
||||
'amilcar.silva@minfin.gov.gw', '+245 955 123 456', 'Bairro de Penha, Bissau',
|
||||
'2020-01-15', '2020-02-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
v_ou_tesouro, v_pos_diretor, v_cat_ts, v_grade_a, v_step_3, 2, now(), now()),
|
||||
|
||||
('b2b2b2b2-b2b2-b2b2-b2b2-b2b2b2b2b2b2', '2021/045', '100234567', 'BI234567', 'Francisca Pereira Gomes', '1988-07-22', 'Guineense',
|
||||
'francisca.gomes@minfin.gov.gw', '+245 955 234 567', 'Bairro Militar, Bissau',
|
||||
'2021-03-10', '2021-04-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'MESTRADO', 'ACTIVE',
|
||||
v_ou_orcamento, v_pos_tecnico, v_cat_ts, v_grade_a, v_step_2, 1, now(), now()),
|
||||
|
||||
('c3c3c3c3-c3c3-c3c3-c3c3-c3c3c3c3c3c3', '2019/089', '100345678', 'BI345678', 'Dr. Joao Vieira Mendes', '1982-11-30', 'Guineense',
|
||||
'joao.mendes@minsaude.gov.gw', '+245 955 345 678', 'Bairro de Antula, Bissau',
|
||||
'2019-06-01', '2019-07-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'DOUTORAMENTO', 'ACTIVE',
|
||||
v_ou_hospital, v_pos_medico, v_cat_ts, v_grade_a, v_step_3, 3, now(), now()),
|
||||
|
||||
('d4d4d4d4-d4d4-d4d4-d4d4-d4d4d4d4d4d4', '2022/112', '100456789', 'BI456789', 'Maria da Luz Correia', '1990-05-18', 'Guineense',
|
||||
'maria.correia@minedu.gov.gw', '+245 955 456 789', 'Bairro de Quelele, Bissau',
|
||||
'2022-09-01', '2022-10-01', 'NOMEACAO_PROVISORIA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
v_ou_escola, v_pos_professor, v_cat_ts, v_grade_a, v_step_1, 0, now(), now()),
|
||||
|
||||
('e5e5e5e5-e5e5-e5e5-e5e5-e5e5e5e5e5e5', '2024/201', '100567890', 'BI567890', 'Samba Djalo', '1995-09-12', 'Guineense',
|
||||
'samba.djalo@minfin.gov.gw', '+245 955 567 890', 'Bairro de Chao de Papel, Bissau',
|
||||
'2024-11-01', '2024-12-01', 'NOMEACAO_PROVISORIA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
v_ou_tesouro, v_pos_tecnico, v_cat_ts, v_grade_a, v_step_1, 0, now(), now())
|
||||
ON CONFLICT (matricula) DO NOTHING;
|
||||
|
||||
-- ============================================
|
||||
-- 8. LINHAS ORCAMENTAIS
|
||||
-- ============================================
|
||||
INSERT INTO budget_line (id, fiscal_year_id, code, description, ministry_id, org_unit_id, economic_class, created_at, updated_at)
|
||||
VALUES
|
||||
('f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1f1', v_fy_2025, '2025-MINFIN-311100', 'Vencimentos Base - Financas', v_min_existente, v_ou_tesouro, '311100', now(), now()),
|
||||
('f2f2f2f2-f2f2-f2f2-f2f2-f2f2f2f2f2f2', v_fy_2025, '2025-MINSAUDE-311100', 'Vencimentos Base - Saude', v_min_saude, v_ou_hospital, '311100', now(), now()),
|
||||
('f3f3f3f3-f3f3-f3f3-f3f3-f3f3f3f3f3f3', v_fy_2025, '2025-MINEDU-311100', 'Vencimentos Base - Educacao', v_min_educacao, v_ou_escola, '311100', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
RAISE NOTICE '=== DADOS DE TESTE INSERIDOS COM SUCESSO ===';
|
||||
RAISE NOTICE 'Ministerios adicionados: 2';
|
||||
RAISE NOTICE 'Unidades Organicas adicionadas: 4';
|
||||
RAISE NOTICE 'Cargos adicionados: 4';
|
||||
RAISE NOTICE 'Agentes adicionados: 5';
|
||||
RAISE NOTICE 'Linhas Orcamentais adicionadas: 3';
|
||||
END $$;
|
||||
|
||||
-- Verificar resultados finais
|
||||
SELECT 'MINISTERIOS' as tipo, COUNT(*)::text as total FROM ministry
|
||||
UNION ALL
|
||||
SELECT 'UNIDADES ORGANICAS', COUNT(*)::text FROM org_unit
|
||||
UNION ALL
|
||||
SELECT 'CARGOS', COUNT(*)::text FROM position
|
||||
UNION ALL
|
||||
SELECT 'BANCOS', COUNT(*)::text FROM bank
|
||||
UNION ALL
|
||||
SELECT 'AGENTES', COUNT(*)::text FROM agents
|
||||
UNION ALL
|
||||
SELECT 'LINHAS ORCAMENTAIS', COUNT(*)::text FROM budget_line;
|
||||
@@ -0,0 +1,92 @@
|
||||
-- Script Final Corrigido - Usa IDs reais do banco
|
||||
-- Insere dados faltantes em todas as tabelas
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
v_min_001 UUID := '6e32517f-5dbc-416a-9632-d920175b8cdd'; -- ID real do MIN-001
|
||||
v_min_002 UUID;
|
||||
v_min_003 UUID;
|
||||
v_ou_001 UUID;
|
||||
v_ou_002 UUID;
|
||||
v_ou_003 UUID;
|
||||
v_ou_004 UUID;
|
||||
v_pos_001 UUID;
|
||||
v_pos_002 UUID;
|
||||
v_pos_003 UUID;
|
||||
v_pos_004 UUID;
|
||||
BEGIN
|
||||
-- Inserir ministerios
|
||||
INSERT INTO ministry (id, code, name, acronym, is_active, created_at, updated_at) VALUES
|
||||
('22222222-2222-2222-2222-222222222222', 'MIN-002', 'Ministerio da Saude Publica', 'MINSAUDE', true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET name = EXCLUDED.name
|
||||
RETURNING id INTO v_min_002;
|
||||
|
||||
IF v_min_002 IS NULL THEN SELECT id INTO v_min_002 FROM ministry WHERE code = 'MIN-002'; END IF;
|
||||
|
||||
INSERT INTO ministry (id, code, name, acronym, is_active, created_at, updated_at) VALUES
|
||||
('33333333-3333-3333-3333-333333333333', 'MIN-003', 'Ministerio da Educacao Nacional', 'MINEDU', true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET name = EXCLUDED.name
|
||||
RETURNING id INTO v_min_003;
|
||||
|
||||
IF v_min_003 IS NULL THEN SELECT id INTO v_min_003 FROM ministry WHERE code = 'MIN-003'; END IF;
|
||||
|
||||
RAISE NOTICE 'Ministerios: MIN-001=%, MIN-002=%, MIN-003=%', v_min_001, v_min_002, v_min_003;
|
||||
|
||||
-- Inserir unidades organicas
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, unit_type, is_active, created_at, updated_at) VALUES
|
||||
('44444444-4444-4444-4444-444444444444', 'UO-001', 'Direcao-Geral do Tesouro', v_min_001, 'DIRECTORATE', true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET name = EXCLUDED.name
|
||||
RETURNING id INTO v_ou_001;
|
||||
|
||||
IF v_ou_001 IS NULL THEN SELECT id INTO v_ou_001 FROM org_unit WHERE code = 'UO-001'; END IF;
|
||||
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, unit_type, is_active, created_at, updated_at) VALUES
|
||||
('55555555-5555-5555-5555-555555555555', 'UO-002', 'Direcao-Geral do Orcamento', v_min_001, 'DIRECTORATE', true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET name = EXCLUDED.name
|
||||
RETURNING id INTO v_ou_002;
|
||||
|
||||
IF v_ou_002 IS NULL THEN SELECT id INTO v_ou_002 FROM org_unit WHERE code = 'UO-002'; END IF;
|
||||
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, unit_type, is_active, created_at, updated_at) VALUES
|
||||
('66666666-6666-6666-6666-666666666666', 'UO-003', 'Hospital Nacional Simao Mendes', v_min_002, 'HOSPITAL', true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET name = EXCLUDED.name
|
||||
RETURNING id INTO v_ou_003;
|
||||
|
||||
IF v_ou_003 IS NULL THEN SELECT id INTO v_ou_003 FROM org_unit WHERE code = 'UO-003'; END IF;
|
||||
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, unit_type, is_active, created_at, updated_at) VALUES
|
||||
('77777777-7777-7777-7777-777777777777', 'UO-004', 'Escola Secundaria de Bissau', v_min_003, 'SCHOOL', true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET name = EXCLUDED.name
|
||||
RETURNING id INTO v_ou_004;
|
||||
|
||||
IF v_ou_004 IS NULL THEN SELECT id INTO v_ou_004 FROM org_unit WHERE code = 'UO-004'; END IF;
|
||||
|
||||
RAISE NOTICE 'Unidades Organicas criadas: %, %, %, %', v_ou_001, v_ou_002, v_ou_003, v_ou_004;
|
||||
|
||||
-- Inserir cargos
|
||||
INSERT INTO position (id, code, title, org_unit_id, is_active, created_at, updated_at) VALUES
|
||||
('88888888-8888-8888-8888-888888888888', 'POS-001', 'Diretor-Geral', v_ou_001, true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET title = EXCLUDED.title;
|
||||
|
||||
INSERT INTO position (id, code, title, org_unit_id, is_active, created_at, updated_at) VALUES
|
||||
('99999999-9999-9999-9999-999999999999', 'POS-002', 'Tecnico Superior', v_ou_002, true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET title = EXCLUDED.title;
|
||||
|
||||
INSERT INTO position (id, code, title, org_unit_id, is_active, created_at, updated_at) VALUES
|
||||
('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'POS-003', 'Medico Especialista', v_ou_003, true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET title = EXCLUDED.title;
|
||||
|
||||
INSERT INTO position (id, code, title, org_unit_id, is_active, created_at, updated_at) VALUES
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'POS-004', 'Professor', v_ou_004, true, now(), now())
|
||||
ON CONFLICT (code) DO UPDATE SET title = EXCLUDED.title;
|
||||
|
||||
RAISE NOTICE 'Cargos criados com sucesso';
|
||||
RAISE NOTICE '=== DADOS INSERIDOS COM SUCESSO ===';
|
||||
END $$;
|
||||
|
||||
-- Verificar
|
||||
SELECT 'MINISTERIOS' as tabela, COUNT(*)::text FROM ministry
|
||||
UNION ALL SELECT 'UNIDADES ORGANICAS', COUNT(*)::text FROM org_unit
|
||||
UNION ALL SELECT 'CARGOS', COUNT(*)::text FROM position
|
||||
UNION ALL SELECT 'AGENTES', COUNT(*)::text FROM agents
|
||||
UNION ALL SELECT 'BANCOS', COUNT(*)::text FROM bank;
|
||||
@@ -0,0 +1,368 @@
|
||||
-- ============================================================================
|
||||
-- SCRIPT COMPLEMENTAR DE DADOS PARA TESTES FUNCIONAIS COMPLETOS
|
||||
-- Adiciona dados necessários para testar fluxos completos do sistema
|
||||
-- ============================================================================
|
||||
--
|
||||
-- Este script complementa insert_all_test_data.sql adicionando:
|
||||
-- - Períodos de folha adicionais
|
||||
-- - Execuções de folha completas (COMPLETED)
|
||||
-- - Itens de folha completos com todos os cálculos
|
||||
-- - Execuções orçamentárias (COMMITMENT, LIQUIDATION, PAYMENT)
|
||||
-- - Lotes de pagamento
|
||||
-- - Ordens de pagamento
|
||||
-- - Confirmações de pagamento do tesouro
|
||||
-- - Dados para testar fluxos end-to-end
|
||||
--
|
||||
-- IMPORTANTE: Execute insert_all_test_data.sql primeiro!
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
-- IDs existentes
|
||||
v_min_financas UUID;
|
||||
v_min_saude UUID;
|
||||
v_min_educacao UUID;
|
||||
v_ou_tesouro UUID;
|
||||
v_ou_orcamento UUID;
|
||||
v_ou_hospital UUID;
|
||||
v_ou_escola UUID;
|
||||
|
||||
-- Agentes
|
||||
v_agent_amilcar UUID;
|
||||
v_agent_francisca UUID;
|
||||
v_agent_joao UUID;
|
||||
v_agent_maria UUID;
|
||||
v_agent_samba UUID;
|
||||
|
||||
-- Ano Fiscal e Linhas Orçamentais
|
||||
v_fy_2025 UUID;
|
||||
v_bl_financas UUID;
|
||||
v_bl_saude UUID;
|
||||
v_bl_educacao UUID;
|
||||
|
||||
-- Tipos de Proventos e Descontos
|
||||
v_earning_vencimento UUID;
|
||||
v_earning_abono UUID;
|
||||
v_deduction_inps UUID;
|
||||
v_deduction_irps UUID;
|
||||
v_deduction_selo UUID;
|
||||
|
||||
-- Contas Bancárias
|
||||
v_account_amilcar UUID;
|
||||
v_account_francisca UUID;
|
||||
v_account_joao UUID;
|
||||
v_account_maria UUID;
|
||||
v_account_samba UUID;
|
||||
|
||||
-- Períodos de Folha
|
||||
v_period_jan2025 UUID;
|
||||
v_period_fev2025 UUID;
|
||||
v_period_mar2025 UUID;
|
||||
|
||||
-- Execuções de Folha
|
||||
v_payroll_run_jan_completed UUID;
|
||||
v_payroll_run_fev_completed UUID;
|
||||
v_payroll_run_mar_pending UUID;
|
||||
|
||||
-- Lotes de Pagamento
|
||||
v_batch_jan UUID;
|
||||
v_batch_fev UUID;
|
||||
|
||||
-- Usuário Admin
|
||||
v_user_admin UUID;
|
||||
|
||||
BEGIN
|
||||
RAISE NOTICE '=== INICIANDO CARGA DE DADOS PARA TESTES FUNCIONAIS ===';
|
||||
|
||||
-- ========================================================================
|
||||
-- OBTER IDs EXISTENTES
|
||||
-- ========================================================================
|
||||
SELECT id INTO v_min_financas FROM ministry WHERE code = 'MIN-001';
|
||||
SELECT id INTO v_min_saude FROM ministry WHERE code = 'MIN-002';
|
||||
SELECT id INTO v_min_educacao FROM ministry WHERE code = 'MIN-003';
|
||||
|
||||
SELECT id INTO v_ou_tesouro FROM org_unit WHERE code = 'UO-001';
|
||||
SELECT id INTO v_ou_orcamento FROM org_unit WHERE code = 'UO-002';
|
||||
SELECT id INTO v_ou_hospital FROM org_unit WHERE code = 'UO-003';
|
||||
SELECT id INTO v_ou_escola FROM org_unit WHERE code = 'UO-004';
|
||||
|
||||
SELECT id INTO v_agent_amilcar FROM agents WHERE matricula = '2020/001';
|
||||
SELECT id INTO v_agent_francisca FROM agents WHERE matricula = '2021/045';
|
||||
SELECT id INTO v_agent_joao FROM agents WHERE matricula = '2019/089';
|
||||
SELECT id INTO v_agent_maria FROM agents WHERE matricula = '2022/112';
|
||||
SELECT id INTO v_agent_samba FROM agents WHERE matricula = '2024/201';
|
||||
|
||||
SELECT id INTO v_fy_2025 FROM fiscal_year WHERE year = 2025;
|
||||
|
||||
SELECT id INTO v_bl_financas FROM budget_line WHERE code = '2025-MINFIN-311100';
|
||||
SELECT id INTO v_bl_saude FROM budget_line WHERE code = '2025-MINSAUDE-311100';
|
||||
SELECT id INTO v_bl_educacao FROM budget_line WHERE code = '2025-MINEDU-311100';
|
||||
|
||||
SELECT id INTO v_earning_vencimento FROM earning_type WHERE code = 'VENC-BASE';
|
||||
SELECT id INTO v_earning_abono FROM earning_type WHERE code = 'ABONO-FAM';
|
||||
SELECT id INTO v_deduction_inps FROM deduction_type WHERE code = 'INPS';
|
||||
SELECT id INTO v_deduction_irps FROM deduction_type WHERE code = 'IRPS';
|
||||
SELECT id INTO v_deduction_selo FROM deduction_type WHERE code = 'SELO';
|
||||
|
||||
SELECT id INTO v_account_amilcar FROM agent_bank_account WHERE agent_id = v_agent_amilcar AND is_primary = true;
|
||||
SELECT id INTO v_account_francisca FROM agent_bank_account WHERE agent_id = v_agent_francisca AND is_primary = true;
|
||||
SELECT id INTO v_account_joao FROM agent_bank_account WHERE agent_id = v_agent_joao AND is_primary = true;
|
||||
|
||||
SELECT id INTO v_user_admin FROM user_account WHERE username = 'admin';
|
||||
|
||||
-- Criar contas bancárias para agentes que não têm
|
||||
IF v_account_maria IS NULL THEN
|
||||
INSERT INTO agent_bank_account (id, agent_id, bank, account_number, branch_code, is_primary, created_at, updated_at)
|
||||
VALUES ('00110001-0000-0000-0000-000000000000', v_agent_maria, 'BCEAO', '4567890123', '004', true, now(), now())
|
||||
RETURNING id INTO v_account_maria;
|
||||
END IF;
|
||||
|
||||
IF v_account_samba IS NULL THEN
|
||||
INSERT INTO agent_bank_account (id, agent_id, bank, account_number, branch_code, is_primary, created_at, updated_at)
|
||||
VALUES ('00110002-0000-0000-0000-000000000000', v_agent_samba, 'BRS', '5678901234', '005', true, now(), now())
|
||||
RETURNING id INTO v_account_samba;
|
||||
END IF;
|
||||
|
||||
-- ========================================================================
|
||||
-- PERÍODOS DE FOLHA ADICIONAIS
|
||||
-- ========================================================================
|
||||
INSERT INTO payroll_period (id, fiscal_year, month, start_date, end_date, status, created_at, updated_at) VALUES
|
||||
('00120001-0000-0000-0000-000000000000', 2025, 2, '2025-02-01', '2025-02-28', 'OPEN', now(), now()),
|
||||
('00120002-0000-0000-0000-000000000000', 2025, 3, '2025-03-01', '2025-03-31', 'OPEN', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_period_jan2025 FROM payroll_period WHERE fiscal_year = 2025 AND month = 1;
|
||||
SELECT id INTO v_period_fev2025 FROM payroll_period WHERE fiscal_year = 2025 AND month = 2;
|
||||
SELECT id INTO v_period_mar2025 FROM payroll_period WHERE fiscal_year = 2025 AND month = 3;
|
||||
|
||||
-- ========================================================================
|
||||
-- EXECUÇÕES DE FOLHA COMPLETAS
|
||||
-- ========================================================================
|
||||
-- Janeiro - COMPLETED (para gerar ordens de pagamento)
|
||||
INSERT INTO payroll_run (id, period_id, ministry_id, org_unit_id, run_type, status, created_at, updated_at, created_by) VALUES
|
||||
('00130001-0000-0000-0000-000000000000', v_period_jan2025, v_min_financas, v_ou_tesouro, 'REGULAR', 'COMPLETED', now(), now(), v_user_admin)
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_payroll_run_jan_completed FROM payroll_run WHERE id = '00130001-0000-0000-0000-000000000000';
|
||||
|
||||
-- Fevereiro - COMPLETED
|
||||
INSERT INTO payroll_run (id, period_id, ministry_id, org_unit_id, run_type, status, created_at, updated_at, created_by) VALUES
|
||||
('00130002-0000-0000-0000-000000000000', v_period_fev2025, v_min_financas, v_ou_tesouro, 'REGULAR', 'COMPLETED', now(), now(), v_user_admin)
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_payroll_run_fev_completed FROM payroll_run WHERE id = '00130002-0000-0000-0000-000000000000';
|
||||
|
||||
-- Março - PENDING (para testar validações)
|
||||
INSERT INTO payroll_run (id, period_id, ministry_id, org_unit_id, run_type, status, created_at, updated_at, created_by) VALUES
|
||||
('00130003-0000-0000-0000-000000000000', v_period_mar2025, v_min_financas, v_ou_tesouro, 'REGULAR', 'PENDING', now(), now(), v_user_admin)
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_payroll_run_mar_pending FROM payroll_run WHERE id = '00130003-0000-0000-0000-000000000000';
|
||||
|
||||
-- ========================================================================
|
||||
-- ITENS DE FOLHA COMPLETOS (Janeiro - COMPLETED)
|
||||
-- Com todos os cálculos: Vencimento, Abono, INPS, IRPS, Selo
|
||||
-- ========================================================================
|
||||
-- Amilcar Cabral - Vencimento Base: 600.000
|
||||
INSERT INTO payroll_item (
|
||||
id, payroll_run_id, agent_id, line_type, earning_type_id, deduction_type_id,
|
||||
description, unit_amount, quantity, total_amount, budget_line_id, created_at, updated_at
|
||||
) VALUES
|
||||
-- Vencimento Base
|
||||
('00140001-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_amilcar, 'EARNING', v_earning_vencimento, NULL,
|
||||
'Vencimento Base', 600000.00, 1.00, 600000.00, v_bl_financas, now(), now()),
|
||||
-- Abono de Família (2 dependentes)
|
||||
('00140002-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_amilcar, 'EARNING', v_earning_abono, NULL,
|
||||
'Abono de Família (2 dep.)', 2000.00, 2.00, 4000.00, v_bl_financas, now(), now()),
|
||||
-- INPS 7% sobre 604.000 = 42.280
|
||||
('00140003-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_amilcar, 'DEDUCTION', NULL, v_deduction_inps,
|
||||
'INPS 7%', 42280.00, 1.00, 42280.00, NULL, now(), now()),
|
||||
-- Selo 0.3% sobre 604.000 = 1.812
|
||||
('00140004-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_amilcar, 'DEDUCTION', NULL, v_deduction_selo,
|
||||
'Imposto de Selo 0.3%', 1812.00, 1.00, 1812.00, NULL, now(), now()),
|
||||
-- IRPS: Base = 604.000 - 42.280 = 561.720
|
||||
-- Faixa 50001-150000: (561.720 - 50.000) * 10% - 5.000 = 51.172 - 5.000 = 46.172
|
||||
('00140005-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_amilcar, 'DEDUCTION', NULL, v_deduction_irps,
|
||||
'IRPS', 46172.00, 1.00, 46172.00, NULL, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- Francisca Pereira - Vencimento Base: 550.000
|
||||
INSERT INTO payroll_item (
|
||||
id, payroll_run_id, agent_id, line_type, earning_type_id, deduction_type_id,
|
||||
description, unit_amount, quantity, total_amount, budget_line_id, created_at, updated_at
|
||||
) VALUES
|
||||
-- Vencimento Base
|
||||
('00140006-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_francisca, 'EARNING', v_earning_vencimento, NULL,
|
||||
'Vencimento Base', 550000.00, 1.00, 550000.00, v_bl_financas, now(), now()),
|
||||
-- Abono de Família (1 dependente)
|
||||
('00140007-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_francisca, 'EARNING', v_earning_abono, NULL,
|
||||
'Abono de Família (1 dep.)', 2000.00, 1.00, 2000.00, v_bl_financas, now(), now()),
|
||||
-- INPS 7% sobre 552.000 = 38.640
|
||||
('00140008-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_francisca, 'DEDUCTION', NULL, v_deduction_inps,
|
||||
'INPS 7%', 38640.00, 1.00, 38640.00, NULL, now(), now()),
|
||||
-- Selo 0.3% sobre 552.000 = 1.656
|
||||
('00140009-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_francisca, 'DEDUCTION', NULL, v_deduction_selo,
|
||||
'Imposto de Selo 0.3%', 1656.00, 1.00, 1656.00, NULL, now(), now()),
|
||||
-- IRPS: Base = 552.000 - 38.640 = 513.360
|
||||
-- Faixa 50001-150000: (513.360 - 50.000) * 10% - 5.000 = 46.336 - 5.000 = 41.336
|
||||
('0014000a-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_francisca, 'DEDUCTION', NULL, v_deduction_irps,
|
||||
'IRPS', 41336.00, 1.00, 41336.00, NULL, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- João Vieira - Vencimento Base: 600.000 (Saúde)
|
||||
INSERT INTO payroll_item (
|
||||
id, payroll_run_id, agent_id, line_type, earning_type_id, deduction_type_id,
|
||||
description, unit_amount, quantity, total_amount, budget_line_id, created_at, updated_at
|
||||
) VALUES
|
||||
('0014000b-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_joao, 'EARNING', v_earning_vencimento, NULL,
|
||||
'Vencimento Base', 600000.00, 1.00, 600000.00, v_bl_saude, now(), now()),
|
||||
('0014000c-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_joao, 'EARNING', v_earning_abono, NULL,
|
||||
'Abono de Família (3 dep.)', 2000.00, 3.00, 6000.00, v_bl_saude, now(), now()),
|
||||
('0014000d-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_joao, 'DEDUCTION', NULL, v_deduction_inps,
|
||||
'INPS 7%', 42420.00, 1.00, 42420.00, NULL, now(), now()),
|
||||
('0014000e-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_joao, 'DEDUCTION', NULL, v_deduction_selo,
|
||||
'Imposto de Selo 0.3%', 1818.00, 1.00, 1818.00, NULL, now(), now()),
|
||||
('0014000f-0000-0000-0000-000000000000', v_payroll_run_jan_completed, v_agent_joao, 'DEDUCTION', NULL, v_deduction_irps,
|
||||
'IRPS', 46178.00, 1.00, 46178.00, NULL, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- EXECUÇÕES ORÇAMENTÁRIAS (Budget Execution)
|
||||
-- COMMITMENT: Compromisso quando a folha é gerada
|
||||
-- LIQUIDATION: Liquidação quando a folha é processada
|
||||
-- PAYMENT: Pagamento quando o tesouro confirma
|
||||
-- ========================================================================
|
||||
-- COMMITMENT - Janeiro (compromisso inicial)
|
||||
INSERT INTO budget_execution (
|
||||
id, budget_line_id, period_id, movement_type, amount, source_module, reference_id, created_at, updated_at
|
||||
) VALUES
|
||||
('00150001-0000-0000-0000-000000000000', v_bl_financas, 202501, 'COMMITMENT', 1156000.00, 'RH', v_payroll_run_jan_completed, now(), now()),
|
||||
('00150002-0000-0000-0000-000000000000', v_bl_saude, 202501, 'COMMITMENT', 606000.00, 'RH', v_payroll_run_jan_completed, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- LIQUIDATION - Janeiro (liquidação após processamento)
|
||||
INSERT INTO budget_execution (
|
||||
id, budget_line_id, period_id, movement_type, amount, source_module, reference_id, created_at, updated_at
|
||||
) VALUES
|
||||
('00150003-0000-0000-0000-000000000000', v_bl_financas, 202501, 'LIQUIDATION', 1156000.00, 'RH', v_payroll_run_jan_completed, now(), now()),
|
||||
('00150004-0000-0000-0000-000000000000', v_bl_saude, 202501, 'LIQUIDATION', 606000.00, 'RH', v_payroll_run_jan_completed, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- LOTES DE PAGAMENTO (Payment Batch)
|
||||
-- ========================================================================
|
||||
INSERT INTO payment_batch (
|
||||
id, period_id, ministry_id, status, created_at, updated_at, created_by
|
||||
) VALUES
|
||||
('00160001-0000-0000-0000-000000000000', 202501, v_min_financas, 'CREATED', now(), now(), v_user_admin),
|
||||
('00160002-0000-0000-0000-000000000000', 202502, v_min_financas, 'SENT_TO_BANK', now(), now(), v_user_admin)
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
SELECT id INTO v_batch_jan FROM payment_batch WHERE id = '00160001-0000-0000-0000-000000000000';
|
||||
SELECT id INTO v_batch_fev FROM payment_batch WHERE id = '00160002-0000-0000-0000-000000000000';
|
||||
|
||||
-- ========================================================================
|
||||
-- ORDENS DE PAGAMENTO (Payment Order)
|
||||
-- Geradas a partir da folha de Janeiro
|
||||
-- ========================================================================
|
||||
-- Amilcar: Bruto = 604.000, Líquido = 604.000 - 42.280 - 1.812 - 46.172 = 513.736
|
||||
-- NOTA: payroll_run_id é bigint no schema mas UUID na entidade Java - usando NULL por enquanto
|
||||
INSERT INTO payment_order (
|
||||
id, payment_batch_id, payroll_run_id, agent_id, bank_account_id, budget_line_id,
|
||||
gross_amount, net_amount, status, created_at, updated_at
|
||||
) VALUES
|
||||
('00170001-0000-0000-0000-000000000000', v_batch_jan, NULL, v_agent_amilcar, v_account_amilcar, v_bl_financas,
|
||||
604000.00, 513736.00, 'CREATED', now(), now()),
|
||||
-- Francisca: Bruto = 552.000, Líquido = 552.000 - 38.640 - 1.656 - 41.336 = 470.368
|
||||
('00170002-0000-0000-0000-000000000000', v_batch_jan, NULL, v_agent_francisca, v_account_francisca, v_bl_financas,
|
||||
552000.00, 470368.00, 'CREATED', now(), now()),
|
||||
-- João: Bruto = 606.000, Líquido = 606.000 - 42.420 - 1.818 - 46.178 = 515.584
|
||||
('00170003-0000-0000-0000-000000000000', v_batch_jan, NULL, v_agent_joao, v_account_joao, v_bl_saude,
|
||||
606000.00, 515584.00, 'SENT_TO_BANK', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- CONFIRMAÇÕES DE PAGAMENTO DO TESOURO (Treasury Payment)
|
||||
-- ========================================================================
|
||||
INSERT INTO treasury_payment (
|
||||
id, payment_order_id, paid_at, transaction_ref, status, message, created_at, updated_at
|
||||
) VALUES
|
||||
-- Amilcar - Pago
|
||||
('00180001-0000-0000-0000-000000000000', '00170001-0000-0000-0000-000000000000', '2025-01-15 10:30:00', 'TXN-2025-001-001', 'PAID', 'Pagamento confirmado pelo banco', now(), now()),
|
||||
-- Francisca - Pendente
|
||||
('00180002-0000-0000-0000-000000000000', '00170002-0000-0000-0000-000000000000', NULL, NULL, 'PENDING', NULL, now(), now()),
|
||||
-- João - Pago
|
||||
('00180003-0000-0000-0000-000000000000', '00170003-0000-0000-0000-000000000000', '2025-01-15 11:15:00', 'TXN-2025-001-003', 'PAID', 'Pagamento confirmado pelo banco', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- EXECUÇÕES ORÇAMENTÁRIAS - PAYMENT (após confirmação do tesouro)
|
||||
-- ========================================================================
|
||||
INSERT INTO budget_execution (
|
||||
id, budget_line_id, period_id, movement_type, amount, source_module, reference_id, created_at, updated_at
|
||||
) VALUES
|
||||
-- Pagamentos confirmados
|
||||
('00150005-0000-0000-0000-000000000000', v_bl_financas, 202501, 'PAYMENT', 513736.00, 'TREASURY', '00170001-0000-0000-0000-000000000000', now(), now()),
|
||||
('00150006-0000-0000-0000-000000000000', v_bl_saude, 202501, 'PAYMENT', 515584.00, 'TREASURY', '00170003-0000-0000-0000-000000000000', now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- ========================================================================
|
||||
-- ITENS DE FOLHA PARA FEVEREIRO (para testar múltiplos períodos)
|
||||
-- ========================================================================
|
||||
INSERT INTO payroll_item (
|
||||
id, payroll_run_id, agent_id, line_type, earning_type_id, deduction_type_id,
|
||||
description, unit_amount, quantity, total_amount, budget_line_id, created_at, updated_at
|
||||
) VALUES
|
||||
-- Amilcar - Fevereiro
|
||||
('00140010-0000-0000-0000-000000000000', v_payroll_run_fev_completed, v_agent_amilcar, 'EARNING', v_earning_vencimento, NULL,
|
||||
'Vencimento Base', 600000.00, 1.00, 600000.00, v_bl_financas, now(), now()),
|
||||
('00140011-0000-0000-0000-000000000000', v_payroll_run_fev_completed, v_agent_amilcar, 'EARNING', v_earning_abono, NULL,
|
||||
'Abono de Família (2 dep.)', 2000.00, 2.00, 4000.00, v_bl_financas, now(), now()),
|
||||
('00140012-0000-0000-0000-000000000000', v_payroll_run_fev_completed, v_agent_amilcar, 'DEDUCTION', NULL, v_deduction_inps,
|
||||
'INPS 7%', 42280.00, 1.00, 42280.00, NULL, now(), now()),
|
||||
('00140013-0000-0000-0000-000000000000', v_payroll_run_fev_completed, v_agent_amilcar, 'DEDUCTION', NULL, v_deduction_selo,
|
||||
'Imposto de Selo 0.3%', 1812.00, 1.00, 1812.00, NULL, now(), now()),
|
||||
('00140014-0000-0000-0000-000000000000', v_payroll_run_fev_completed, v_agent_amilcar, 'DEDUCTION', NULL, v_deduction_irps,
|
||||
'IRPS', 46172.00, 1.00, 46172.00, NULL, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
RAISE NOTICE '=== DADOS PARA TESTES FUNCIONAIS INSERIDOS COM SUCESSO ===';
|
||||
RAISE NOTICE 'Períodos de folha adicionados: 2';
|
||||
RAISE NOTICE 'Execuções de folha criadas: 3';
|
||||
RAISE NOTICE 'Itens de folha completos: 15+';
|
||||
RAISE NOTICE 'Execuções orçamentárias: 6';
|
||||
RAISE NOTICE 'Lotes de pagamento: 2';
|
||||
RAISE NOTICE 'Ordens de pagamento: 3';
|
||||
RAISE NOTICE 'Confirmações de pagamento: 3';
|
||||
|
||||
END $$;
|
||||
|
||||
-- ========================================================================
|
||||
-- VERIFICAÇÃO FINAL DOS DADOS INSERIDOS
|
||||
-- ========================================================================
|
||||
SELECT 'PERIODOS FOLHA' as tipo, COUNT(*)::text as total FROM payroll_period WHERE fiscal_year = 2025
|
||||
UNION ALL
|
||||
SELECT 'EXECUCOES FOLHA', COUNT(*)::text FROM payroll_run WHERE period_id IN (
|
||||
SELECT id FROM payroll_period WHERE fiscal_year = 2025
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'ITENS FOLHA', COUNT(*)::text FROM payroll_item WHERE payroll_run_id IN (
|
||||
SELECT id FROM payroll_run WHERE period_id IN (
|
||||
SELECT id FROM payroll_period WHERE fiscal_year = 2025
|
||||
)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'EXECUCOES ORCAMENTARIAS', COUNT(*)::text FROM budget_execution WHERE period_id >= 202501
|
||||
UNION ALL
|
||||
SELECT 'LOTES PAGAMENTO', COUNT(*)::text FROM payment_batch WHERE period_id >= 202501
|
||||
UNION ALL
|
||||
SELECT 'ORDENS PAGAMENTO', COUNT(*)::text FROM payment_order WHERE payment_batch_id IN (
|
||||
SELECT id FROM payment_batch WHERE period_id >= 202501
|
||||
)
|
||||
UNION ALL
|
||||
SELECT 'CONFIRMACOES TESOURO', COUNT(*)::text FROM treasury_payment WHERE payment_order_id IN (
|
||||
SELECT id FROM payment_order WHERE payment_batch_id IN (
|
||||
SELECT id FROM payment_batch WHERE period_id >= 202501
|
||||
)
|
||||
)
|
||||
ORDER BY tipo;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
-- IDs de Dedução baseados nos códigos criados pelo Initializer
|
||||
DO $$
|
||||
DECLARE
|
||||
v_irps_id UUID;
|
||||
v_inps_id UUID;
|
||||
v_selo_id UUID;
|
||||
BEGIN
|
||||
-- Obter IDs
|
||||
SELECT id INTO v_irps_id FROM deduction_type WHERE code = 'IRPS';
|
||||
SELECT id INTO v_inps_id FROM deduction_type WHERE code = 'INPS';
|
||||
SELECT id INTO v_selo_id FROM deduction_type WHERE code = 'SELO';
|
||||
|
||||
-- 1. Regras Globais (Se não existirem)
|
||||
IF v_inps_id IS NOT NULL THEN
|
||||
INSERT INTO global_deduction_rule (id, deduction_type_id, percentage, valid_from, active, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), v_inps_id, 0.07, '2024-01-01', true, now(), now())
|
||||
ON CONFLICT DO NOTHING;
|
||||
END IF;
|
||||
|
||||
IF v_selo_id IS NOT NULL THEN
|
||||
INSERT INTO global_deduction_rule (id, deduction_type_id, percentage, valid_from, active, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), v_selo_id, 0.003, '2024-01-01', true, now(), now())
|
||||
ON CONFLICT DO NOTHING;
|
||||
END IF;
|
||||
|
||||
-- 2. Escalões de IRPS
|
||||
IF v_irps_id IS NOT NULL THEN
|
||||
-- Limpar escalões antigos para garantir a nova tabela
|
||||
DELETE FROM tax_bracket WHERE deduction_type_id = v_irps_id;
|
||||
|
||||
-- Faixa 1: Isento (0 - 50.000)
|
||||
INSERT INTO tax_bracket (id, deduction_type_id, lower_limit, upper_limit, rate_percentage, excess_deduction, valid_from, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), v_irps_id, 0, 50000, 0, 0, '2024-01-01', now(), now());
|
||||
|
||||
-- Faixa 2: 10% (50.001 - 150.000)
|
||||
INSERT INTO tax_bracket (id, deduction_type_id, lower_limit, upper_limit, rate_percentage, excess_deduction, valid_from, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), v_irps_id, 50001, 150000, 0.10, 5000, '2024-01-01', now(), now());
|
||||
|
||||
-- Faixa 3: 15% (150.001 - 250.000)
|
||||
INSERT INTO tax_bracket (id, deduction_type_id, lower_limit, upper_limit, rate_percentage, excess_deduction, valid_from, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), v_irps_id, 150001, 250000, 0.15, 12500, '2024-01-01', now(), now());
|
||||
|
||||
-- Faixa 4: 20% (250.001 - 500.000)
|
||||
INSERT INTO tax_bracket (id, deduction_type_id, lower_limit, upper_limit, rate_percentage, excess_deduction, valid_from, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), v_irps_id, 250001, 500000, 0.20, 25000, '2024-01-01', now(), now());
|
||||
|
||||
-- Faixa 5: 25% (Acima de 500.000)
|
||||
INSERT INTO tax_bracket (id, deduction_type_id, lower_limit, upper_limit, rate_percentage, excess_deduction, valid_from, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), v_irps_id, 500001, NULL, 0.25, 50000, '2024-01-01', now(), now());
|
||||
END IF;
|
||||
END $$;
|
||||
@@ -0,0 +1,220 @@
|
||||
-- Script Complementar de Dados de Teste
|
||||
-- Usa o ministerio existente e adiciona dados adicionais
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
v_min_financas UUID;
|
||||
v_min_saude UUID;
|
||||
v_min_educacao UUID;
|
||||
v_cat_ts UUID;
|
||||
v_grade_a UUID;
|
||||
v_step_1 UUID;
|
||||
v_fy_2025 UUID;
|
||||
BEGIN
|
||||
-- Obter ministerio existente
|
||||
SELECT id INTO v_min_financas FROM ministry WHERE code = 'MIN-001';
|
||||
|
||||
-- Inserir ministerios adicionais (se nao existirem)
|
||||
INSERT INTO ministry (id, code, name, created_at, updated_at)
|
||||
VALUES ('22222222-2222-2222-2222-222222222222', 'MINSAUDE', 'Ministerio da Saude Publica', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING
|
||||
RETURNING id INTO v_min_saude;
|
||||
|
||||
IF v_min_saude IS NULL THEN
|
||||
SELECT id INTO v_min_saude FROM ministry WHERE code = 'MINSAUDE';
|
||||
END IF;
|
||||
|
||||
INSERT INTO ministry (id, code, name, created_at, updated_at)
|
||||
VALUES ('33333333-3333-3333-3333-333333333333', 'MINEDU', 'Ministerio da Educacao Nacional', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING
|
||||
RETURNING id INTO v_min_educacao;
|
||||
|
||||
IF v_min_educacao IS NULL THEN
|
||||
SELECT id INTO v_min_educacao FROM ministry WHERE code = 'MINEDU';
|
||||
END IF;
|
||||
|
||||
-- Inserir Unidades Organicas
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, parent_id, created_at, updated_at)
|
||||
VALUES ('44444444-4444-4444-4444-444444444444', 'DGT', 'Direcao-Geral do Tesouro', v_min_financas, NULL, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, parent_id, created_at, updated_at)
|
||||
VALUES ('55555555-5555-5555-5555-555555555555', 'DGO', 'Direcao-Geral do Orcamento', v_min_financas, NULL, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, parent_id, created_at, updated_at)
|
||||
VALUES ('66666666-6666-6666-6666-666666666666', 'HOSP-CENTRAL', 'Hospital Nacional Simao Mendes', v_min_saude, NULL, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO org_unit (id, code, name, ministry_id, parent_id, created_at, updated_at)
|
||||
VALUES ('77777777-7777-7777-7777-777777777777', 'ESC-SEC-BISSAU', 'Escola Secundaria de Bissau', v_min_educacao, NULL, now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
-- Inserir Cargos
|
||||
INSERT INTO position (id, code, title, description, created_at, updated_at)
|
||||
VALUES ('88888888-8888-8888-8888-888888888888', 'DIR-GERAL', 'Diretor-Geral', 'Cargo de direcao superior', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO position (id, code, title, description, created_at, updated_at)
|
||||
VALUES ('99999999-9999-9999-9999-999999999999', 'TEC-SUP', 'Tecnico Superior', 'Tecnico de nivel superior', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO position (id, code, title, description, created_at, updated_at)
|
||||
VALUES ('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'MEDICO', 'Medico Especialista', 'Medico com especializacao', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO position (id, code, title, description, created_at, updated_at)
|
||||
VALUES ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'PROF', 'Professor do Ensino Secundario', 'Professor licenciado', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
-- Inserir Bancos
|
||||
INSERT INTO bank (id, code, name, swift_code, created_at, updated_at)
|
||||
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'BCEAO', 'Banco Central dos Estados da Africa Ocidental', 'BCAOXXXX', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO bank (id, code, name, swift_code, created_at, updated_at)
|
||||
VALUES ('dddddddd-dddd-dddd-dddd-dddddddddddd', 'BRS', 'Banco Regional de Solidariedade', 'BRSXGWGW', now(), now())
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
-- Obter estrutura salarial existente
|
||||
SELECT id INTO v_cat_ts FROM salary_category WHERE code = 'TS';
|
||||
SELECT id INTO v_grade_a FROM salary_grade WHERE code = 'A' AND category_id = v_cat_ts;
|
||||
SELECT id INTO v_step_1 FROM salary_step WHERE grade_id = v_grade_a AND step_number = 1;
|
||||
SELECT id INTO v_fy_2025 FROM fiscal_year WHERE year = 2025;
|
||||
|
||||
-- Adicionar escaloes (se nao existirem)
|
||||
INSERT INTO salary_step (id, grade_id, step_number, created_at, updated_at)
|
||||
VALUES ('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', v_grade_a, 2, now(), now())
|
||||
ON CONFLICT (grade_id, step_number) DO NOTHING;
|
||||
|
||||
INSERT INTO salary_step (id, grade_id, step_number, created_at, updated_at)
|
||||
VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', v_grade_a, 3, now(), now())
|
||||
ON CONFLICT (grade_id, step_number) DO NOTHING;
|
||||
|
||||
-- Valores da grelha
|
||||
INSERT INTO salary_grid (id, step_id, base_amount, valid_from, created_at, updated_at)
|
||||
SELECT '10101010-1010-1010-1010-101010101010', id, 550000.00, '2024-01-01', now(), now()
|
||||
FROM salary_step WHERE grade_id = v_grade_a AND step_number = 2
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
INSERT INTO salary_grid (id, step_id, base_amount, valid_from, created_at, updated_at)
|
||||
SELECT '20202020-2020-2020-2020-202020202020', id, 600000.00, '2024-01-01', now(), now()
|
||||
FROM salary_step WHERE grade_id = v_grade_a AND step_number = 3
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- Inserir Agentes (se nao existirem)
|
||||
INSERT INTO agents (
|
||||
id, matricula, nif, full_name, birth_date, nationality, bi_number,
|
||||
email, phone, address, hire_date, posse_date, appointment_type,
|
||||
functional_situation, literary_qualification, status,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
eligible_dependents_count, created_at, updated_at
|
||||
)
|
||||
SELECT
|
||||
'a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1', '2020/001', '100123456', 'Amilcar Cabral Silva', '1975-03-15', 'Guineense', 'BI123456',
|
||||
'amilcar.silva@minfin.gov.gw', '+245 955 123 456', 'Bairro de Penha, Bissau',
|
||||
'2020-01-15', '2020-02-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
ou.id, p.id, v_cat_ts, v_grade_a, ss.id, 2, now(), now()
|
||||
FROM org_unit ou, position p, salary_step ss
|
||||
WHERE ou.code = 'DGT' AND p.code = 'DIR-GERAL' AND ss.grade_id = v_grade_a AND ss.step_number = 3
|
||||
ON CONFLICT (matricula) DO NOTHING;
|
||||
|
||||
INSERT INTO agents (
|
||||
id, matricula, nif, full_name, birth_date, nationality, bi_number,
|
||||
email, phone, address, hire_date, posse_date, appointment_type,
|
||||
functional_situation, literary_qualification, status,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
eligible_dependents_count, created_at, updated_at
|
||||
)
|
||||
SELECT
|
||||
'b2b2b2b2-b2b2-b2b2-b2b2-b2b2b2b2b2b2', '2021/045', '100234567', 'Francisca Pereira Gomes', '1988-07-22', 'Guineense', 'BI234567',
|
||||
'francisca.gomes@minfin.gov.gw', '+245 955 234 567', 'Bairro Militar, Bissau',
|
||||
'2021-03-10', '2021-04-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'MESTRADO', 'ACTIVE',
|
||||
ou.id, p.id, v_cat_ts, v_grade_a, ss.id, 1, now(), now()
|
||||
FROM org_unit ou, position p, salary_step ss
|
||||
WHERE ou.code = 'DGO' AND p.code = 'TEC-SUP' AND ss.grade_id = v_grade_a AND ss.step_number = 2
|
||||
ON CONFLICT (matricula) DO NOTHING;
|
||||
|
||||
INSERT INTO agents (
|
||||
id, matricula, nif, full_name, birth_date, nationality, bi_number,
|
||||
email, phone, address, hire_date, posse_date, appointment_type,
|
||||
functional_situation, literary_qualification, status,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
eligible_dependents_count, created_at, updated_at
|
||||
)
|
||||
SELECT
|
||||
'c3c3c3c3-c3c3-c3c3-c3c3-c3c3c3c3c3c3', '2019/089', '100345678', 'Dr. Joao Vieira Mendes', '1982-11-30', 'Guineense', 'BI345678',
|
||||
'joao.mendes@minsaude.gov.gw', '+245 955 345 678', 'Bairro de Antula, Bissau',
|
||||
'2019-06-01', '2019-07-01', 'NOMEACAO_DEFINITIVA', 'ACTIVE', 'DOUTORAMENTO', 'ACTIVE',
|
||||
ou.id, p.id, v_cat_ts, v_grade_a, ss.id, 3, now(), now()
|
||||
FROM org_unit ou, position p, salary_step ss
|
||||
WHERE ou.code = 'HOSP-CENTRAL' AND p.code = 'MEDICO' AND ss.grade_id = v_grade_a AND ss.step_number = 3
|
||||
ON CONFLICT (matricula) DO NOTHING;
|
||||
|
||||
INSERT INTO agents (
|
||||
id, matricula, nif, full_name, birth_date, nationality, bi_number,
|
||||
email, phone, address, hire_date, posse_date, appointment_type,
|
||||
functional_situation, literary_qualification, status,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
eligible_dependents_count, created_at, updated_at
|
||||
)
|
||||
SELECT
|
||||
'd4d4d4d4-d4d4-d4d4-d4d4-d4d4d4d4d4d4', '2022/112', '100456789', 'Maria da Luz Correia', '1990-05-18', 'Guineense', 'BI456789',
|
||||
'maria.correia@minedu.gov.gw', '+245 955 456 789', 'Bairro de Quelele, Bissau',
|
||||
'2022-09-01', '2022-10-01', 'NOMEACAO_PROVISORIA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
ou.id, p.id, v_cat_ts, v_grade_a, v_step_1, 0, now(), now()
|
||||
FROM org_unit ou, position p
|
||||
WHERE ou.code = 'ESC-SEC-BISSAU' AND p.code = 'PROF'
|
||||
ON CONFLICT (matricula) DO NOTHING;
|
||||
|
||||
INSERT INTO agents (
|
||||
id, matricula, nif, full_name, birth_date, nationality, bi_number,
|
||||
email, phone, address, hire_date, posse_date, appointment_type,
|
||||
functional_situation, literary_qualification, status,
|
||||
org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id,
|
||||
eligible_dependents_count, created_at, updated_at
|
||||
)
|
||||
SELECT
|
||||
'e5e5e5e5-e5e5-e5e5-e5e5-e5e5e5e5e5e5', '2024/201', '100567890', 'Samba Djalo', '1995-09-12', 'Guineense', 'BI567890',
|
||||
'samba.djalo@minfin.gov.gw', '+245 955 567 890', 'Bairro de Chao de Papel, Bissau',
|
||||
'2024-11-01', '2024-12-01', 'NOMEACAO_PROVISORIA', 'ACTIVE', 'LICENCIATURA', 'ACTIVE',
|
||||
ou.id, p.id, v_cat_ts, v_grade_a, v_step_1, 0, now(), now()
|
||||
FROM org_unit ou, position p
|
||||
WHERE ou.code = 'DGT' AND p.code = 'TEC-SUP'
|
||||
ON CONFLICT (matricula) DO NOTHING;
|
||||
|
||||
-- Linhas orcamentais
|
||||
INSERT INTO budget_line (id, fiscal_year_id, code, description, ministry_id, org_unit_id, economic_class, created_at, updated_at)
|
||||
SELECT 'f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1f1', v_fy_2025, '2025-MINFIN-311100', 'Vencimentos Base - Financas',
|
||||
v_min_financas, ou.id, '311100', now(), now()
|
||||
FROM org_unit ou WHERE ou.code = 'DGT'
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO budget_line (id, fiscal_year_id, code, description, ministry_id, org_unit_id, economic_class, created_at, updated_at)
|
||||
SELECT 'f2f2f2f2-f2f2-f2f2-f2f2-f2f2f2f2f2f2', v_fy_2025, '2025-MINSAUDE-311100', 'Vencimentos Base - Saude',
|
||||
v_min_saude, ou.id, '311100', now(), now()
|
||||
FROM org_unit ou WHERE ou.code = 'HOSP-CENTRAL'
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
INSERT INTO budget_line (id, fiscal_year_id, code, description, ministry_id, org_unit_id, economic_class, created_at, updated_at)
|
||||
SELECT 'f3f3f3f3-f3f3-f3f3-f3f3-f3f3f3f3f3f3', v_fy_2025, '2025-MINEDU-311100', 'Vencimentos Base - Educacao',
|
||||
v_min_educacao, ou.id, '311100', now(), now()
|
||||
FROM org_unit ou WHERE ou.code = 'ESC-SEC-BISSAU'
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
RAISE NOTICE '=== DADOS DE TESTE INSERIDOS/ATUALIZADOS COM SUCESSO ===';
|
||||
RAISE NOTICE 'Script executado usando ministerio existente MIN-001';
|
||||
END $$;
|
||||
|
||||
-- Verificar resultados
|
||||
SELECT 'MINISTERIOS' as tipo, COUNT(*)::text as total FROM ministry
|
||||
UNION ALL
|
||||
SELECT 'UNIDADES ORGANICAS', COUNT(*)::text FROM org_unit
|
||||
UNION ALL
|
||||
SELECT 'CARGOS', COUNT(*)::text FROM position
|
||||
UNION ALL
|
||||
SELECT 'BANCOS', COUNT(*)::text FROM bank
|
||||
UNION ALL
|
||||
SELECT 'AGENTES', COUNT(*)::text FROM agents
|
||||
UNION ALL
|
||||
SELECT 'LINHAS ORCAMENTAIS', COUNT(*)::text FROM budget_line;
|
||||
@@ -0,0 +1,157 @@
|
||||
-- =====================================================
|
||||
-- ARQUITETURA COMPLETA DE TESOURO - NOVAS TABELAS
|
||||
-- Similar à arquitetura de Elaboração e Aprovação do Orçamento
|
||||
-- =====================================================
|
||||
|
||||
-- Contas de Caixa/Bancárias
|
||||
CREATE TABLE IF NOT EXISTS public.cash_account (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
code VARCHAR(50) UNIQUE NOT NULL,
|
||||
name VARCHAR(200) NOT NULL,
|
||||
type VARCHAR(20) NOT NULL, -- CASH, BANK_ACCOUNT
|
||||
bank_id UUID,
|
||||
account_number VARCHAR(50),
|
||||
branch_code VARCHAR(20),
|
||||
currency VARCHAR(3) DEFAULT 'XOF',
|
||||
is_active BOOLEAN DEFAULT true,
|
||||
current_balance NUMERIC(19,2) DEFAULT 0,
|
||||
available_balance NUMERIC(19,2) DEFAULT 0,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
version BIGINT DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_cash_account_code ON public.cash_account(code);
|
||||
CREATE INDEX idx_cash_account_type ON public.cash_account(type);
|
||||
CREATE INDEX idx_cash_account_active ON public.cash_account(is_active);
|
||||
|
||||
-- Entradas de Tesouraria (Similar a budget_entry)
|
||||
CREATE TABLE IF NOT EXISTS public.treasury_entry (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
cash_account_id UUID NOT NULL REFERENCES public.cash_account(id),
|
||||
type VARCHAR(50) NOT NULL,
|
||||
amount NUMERIC(19,2) NOT NULL,
|
||||
transaction_date DATE NOT NULL,
|
||||
document_reference VARCHAR(100),
|
||||
description TEXT,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'DRAFT', -- DRAFT, PENDING_APPROVAL, APPROVED, REJECTED, EXECUTED
|
||||
approval_level INTEGER,
|
||||
approved_by UUID,
|
||||
approved_at TIMESTAMP,
|
||||
payment_order_id UUID,
|
||||
payment_batch_id UUID,
|
||||
budget_line_id UUID,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
version BIGINT DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_treasury_entry_cash_account ON public.treasury_entry(cash_account_id);
|
||||
CREATE INDEX idx_treasury_entry_type ON public.treasury_entry(type);
|
||||
CREATE INDEX idx_treasury_entry_status ON public.treasury_entry(status);
|
||||
CREATE INDEX idx_treasury_entry_date ON public.treasury_entry(transaction_date);
|
||||
CREATE INDEX idx_treasury_entry_payment_order ON public.treasury_entry(payment_order_id);
|
||||
|
||||
-- Autorizações de Pagamento
|
||||
CREATE TABLE IF NOT EXISTS public.payment_authorization (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
payment_order_id UUID,
|
||||
payment_batch_id UUID,
|
||||
requested_by UUID NOT NULL,
|
||||
requested_at TIMESTAMP NOT NULL,
|
||||
required_approval_level INTEGER NOT NULL,
|
||||
current_approval_level INTEGER DEFAULT 1,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'PENDING', -- PENDING, PARTIALLY_APPROVED, APPROVED, REJECTED
|
||||
rejection_reason TEXT,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
version BIGINT DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_auth_payment_order ON public.payment_authorization(payment_order_id);
|
||||
CREATE INDEX idx_auth_payment_batch ON public.payment_authorization(payment_batch_id);
|
||||
CREATE INDEX idx_auth_status ON public.payment_authorization(status);
|
||||
CREATE INDEX idx_auth_requested_by ON public.payment_authorization(requested_by);
|
||||
|
||||
-- Aprovações (Histórico)
|
||||
CREATE TABLE IF NOT EXISTS public.approval (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
authorization_id UUID NOT NULL REFERENCES public.payment_authorization(id),
|
||||
level INTEGER NOT NULL,
|
||||
approved_by UUID NOT NULL,
|
||||
approved_at TIMESTAMP NOT NULL,
|
||||
comments TEXT,
|
||||
signature_hash VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_approval_authorization ON public.approval(authorization_id);
|
||||
CREATE INDEX idx_approval_approver ON public.approval(approved_by);
|
||||
CREATE INDEX idx_approval_level ON public.approval(level);
|
||||
|
||||
-- Fluxo de Caixa
|
||||
CREATE TABLE IF NOT EXISTS public.cash_flow (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
cash_account_id UUID NOT NULL REFERENCES public.cash_account(id),
|
||||
transaction_date DATE NOT NULL,
|
||||
type VARCHAR(20) NOT NULL, -- INFLOW, OUTFLOW
|
||||
amount NUMERIC(19,2) NOT NULL,
|
||||
description TEXT,
|
||||
reference_id UUID,
|
||||
reference_type VARCHAR(50),
|
||||
balance_after NUMERIC(19,2) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
version BIGINT DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_cash_flow_account ON public.cash_flow(cash_account_id);
|
||||
CREATE INDEX idx_cash_flow_date ON public.cash_flow(transaction_date);
|
||||
CREATE INDEX idx_cash_flow_type ON public.cash_flow(type);
|
||||
CREATE INDEX idx_cash_flow_reference ON public.cash_flow(reference_type, reference_id);
|
||||
|
||||
-- Conciliação Bancária
|
||||
CREATE TABLE IF NOT EXISTS public.bank_reconciliation (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
cash_account_id UUID NOT NULL REFERENCES public.cash_account(id),
|
||||
reconciliation_date DATE NOT NULL,
|
||||
statement_balance NUMERIC(19,2) NOT NULL,
|
||||
system_balance NUMERIC(19,2) NOT NULL,
|
||||
difference NUMERIC(19,2),
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'PENDING', -- PENDING, RECONCILED, DISCREPANCY
|
||||
reconciled_by UUID,
|
||||
reconciled_at TIMESTAMP,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
version BIGINT DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_reconciliation_cash_account ON public.bank_reconciliation(cash_account_id);
|
||||
CREATE INDEX idx_reconciliation_date ON public.bank_reconciliation(reconciliation_date);
|
||||
CREATE INDEX idx_reconciliation_status ON public.bank_reconciliation(status);
|
||||
|
||||
-- Itens de Conciliação
|
||||
CREATE TABLE IF NOT EXISTS public.reconciliation_item (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
reconciliation_id UUID NOT NULL REFERENCES public.bank_reconciliation(id),
|
||||
transaction_date DATE NOT NULL,
|
||||
description TEXT,
|
||||
statement_amount NUMERIC(19,2),
|
||||
system_amount NUMERIC(19,2),
|
||||
match_status VARCHAR(20) NOT NULL DEFAULT 'PENDING', -- MATCHED, UNMATCHED, PENDING
|
||||
matched_transaction_id UUID,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_reconciliation_item_reconciliation ON public.reconciliation_item(reconciliation_id);
|
||||
CREATE INDEX idx_reconciliation_item_status ON public.reconciliation_item(match_status);
|
||||
CREATE INDEX idx_reconciliation_item_date ON public.reconciliation_item(transaction_date);
|
||||
|
||||
-- Comentários
|
||||
COMMENT ON TABLE public.cash_account IS 'Contas de caixa e bancárias do Tesouro';
|
||||
COMMENT ON TABLE public.treasury_entry IS 'Entradas de tesouraria - rastreamento completo do ciclo de vida';
|
||||
COMMENT ON TABLE public.payment_authorization IS 'Workflow de aprovação hierárquica de pagamentos';
|
||||
COMMENT ON TABLE public.approval IS 'Histórico de aprovações individuais';
|
||||
COMMENT ON TABLE public.cash_flow IS 'Fluxo de caixa - entradas e saídas';
|
||||
COMMENT ON TABLE public.bank_reconciliation IS 'Conciliação bancária';
|
||||
COMMENT ON TABLE public.reconciliation_item IS 'Itens de conciliação bancária';
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
import js from "@eslint/js";
|
||||
import globals from "globals";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
import reactRefresh from "eslint-plugin-react-refresh";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ["dist"] },
|
||||
{
|
||||
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||
files: ["**/*.{ts,tsx}"],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
},
|
||||
plugins: {
|
||||
"react-hooks": reactHooks,
|
||||
"react-refresh": reactRefresh,
|
||||
},
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -1,14 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-AO">
|
||||
<html lang="pt-GW">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>SIGEP - Sistema Integrado de Gestão do Estado e Pessoal</title>
|
||||
<meta name="description" content="Sistema Integrado de Gestão do Estado e Pessoal - Plataforma governamental para gestão de recursos humanos, orçamento e tesouraria." />
|
||||
<meta name="author" content="Governo de Angola" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
|
||||
<title>SIGRHAP</title>
|
||||
<meta name="description" content="SIGRHAP - Sistema Integrado de Gestão de Recursos Humanos e Administração Pública. Plataforma governamental para gestão de recursos humanos, orçamento e tesouraria." />
|
||||
<meta name="author" content="Governo da Guiné-Bissau" />
|
||||
<link rel="icon" type="image/png" href="/logo-mf.png" />
|
||||
|
||||
<meta property="og:title" content="SIGEP - Sistema Integrado de Gestão" />
|
||||
<meta property="og:title" content="SIGRHAP" />
|
||||
<meta property="og:description" content="Plataforma governamental para gestão de recursos humanos, orçamento e tesouraria." />
|
||||
<meta property="og:type" content="website" />
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
@@ -0,0 +1,14 @@
|
||||
User-agent: Googlebot
|
||||
Allow: /
|
||||
|
||||
User-agent: Bingbot
|
||||
Allow: /
|
||||
|
||||
User-agent: Twitterbot
|
||||
Allow: /
|
||||
|
||||
User-agent: facebookexternalhit
|
||||
Allow: /
|
||||
|
||||
User-agent: *
|
||||
Allow: /
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sigefp-org</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SIGEFP Org</name>
|
||||
<description>Módulo de organização: ministérios, unidades, posições</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sigefp-rh</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SIGEFP RH</name>
|
||||
<description>Módulo de recursos humanos: agentes, contratos, folha de pagamento</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-org</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-budget</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sigefp-treasury</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SIGEFP Treasury</name>
|
||||
<description>Módulo de tesouraria/pagamentos</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-budget</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.gov.sigefp</groupId>
|
||||
<artifactId>sigefp-rh</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
[INFO] Scanning for projects...
|
||||
[INFO]
|
||||
[INFO] ----------------------< br.gov.sigefp:sigefp-rh >-----------------------
|
||||
[INFO] Building SIGEFP RH 1.0.0-SNAPSHOT
|
||||
[INFO] from pom.xml
|
||||
[INFO] --------------------------------[ jar ]---------------------------------
|
||||
[INFO]
|
||||
[INFO] --- resources:3.3.1:resources (default-resources) @ sigefp-rh ---
|
||||
[INFO] skip non existing resourceDirectory C:\Users\donid\Documents\sigfip\sigefp\sigefp-rh\src\main\resources
|
||||
[INFO]
|
||||
[INFO] --- compiler:3.13.0:compile (default-compile) @ sigefp-rh ---
|
||||
[INFO] Nothing to compile - all classes are up to date.
|
||||
[INFO]
|
||||
[INFO] --- resources:3.3.1:testResources (default-testResources) @ sigefp-rh ---
|
||||
[INFO] skip non existing resourceDirectory C:\Users\donid\Documents\sigfip\sigefp\sigefp-rh\src\test\resources
|
||||
[INFO]
|
||||
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ sigefp-rh ---
|
||||
[INFO] Nothing to compile - all classes are up to date.
|
||||
[INFO]
|
||||
[INFO] --- surefire:3.2.5:test (default-test) @ sigefp-rh ---
|
||||
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
|
||||
[INFO]
|
||||
[INFO] -------------------------------------------------------
|
||||
[INFO] T E S T S
|
||||
[INFO] -------------------------------------------------------
|
||||
[ERROR] br/gov/sigefp/rh/service/PayrollServiceTest has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 55.0
|
||||
[INFO]
|
||||
[INFO] Results:
|
||||
[INFO]
|
||||
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO]
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] BUILD FAILURE
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Total time: 2.984 s
|
||||
[INFO] Finished at: 2025-12-28T15:45:01Z
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.5:test (default-test) on project sigefp-rh:
|
||||
[ERROR]
|
||||
[ERROR] Please refer to C:\Users\donid\Documents\sigfip\sigefp\sigefp-rh\target\surefire-reports for the individual test results.
|
||||
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
|
||||
[ERROR] There was an error in the forked process
|
||||
[ERROR] br/gov/sigefp/rh/service/PayrollServiceTest has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 55.0
|
||||
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
|
||||
[ERROR] br/gov/sigefp/rh/service/PayrollServiceTest has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 55.0
|
||||
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:628)
|
||||
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:285)
|
||||
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:250)
|
||||
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1241)
|
||||
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1090)
|
||||
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:910)
|
||||
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
|
||||
[ERROR] at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
|
||||
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
|
||||
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
|
||||
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
|
||||
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
|
||||
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:906)
|
||||
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
|
||||
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:206)
|
||||
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
||||
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
||||
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
|
||||
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
|
||||
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
|
||||
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
|
||||
[ERROR]
|
||||
[ERROR] -> [Help 1]
|
||||
[ERROR]
|
||||
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
|
||||
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
|
||||
[ERROR]
|
||||
[ERROR] For more information about the errors and possible solutions, please read the following articles:
|
||||
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user