%!<(string=add-project-entities)/code> em master há 1 ano
| @@ -35,3 +35,6 @@ out/ | |||
| ### VS Code ### | |||
| .vscode/ | |||
| ### JPA Buddy ### | |||
| .jpb/ | |||
| @@ -1,11 +1,9 @@ | |||
| # Backend readme | |||
| 1. Create a schema named "tsmsdb" in MySQL workbench | |||
| 2. Put the launch.json file into the .vscode folder | |||
| 3. Put the settings.json file into the .vscode folder | |||
| 4. Run and Debug "Launch Local" | |||
| # TSMS Backend | |||
| # launch.json | |||
| ``` | |||
| ## Getting started | |||
| 1. Create a schema named `tsmsdb` in MySQL workbench | |||
| 2. Create a `launch.json` file and put it into the `.vscode` folder | |||
| ```json | |||
| { | |||
| "version": "0.2.0", | |||
| "configurations": [ | |||
| @@ -28,12 +26,24 @@ | |||
| ] | |||
| } | |||
| ``` | |||
| # settings.json | |||
| You may need to change some settings depending on your development environment | |||
| ``` | |||
| 3. Create a `settings.json` file and put it into the `.vscode` folder | |||
| *(You may need to change some settings depending on your development environment)* | |||
| ```json | |||
| { | |||
| "java.configuration.updateBuildConfiguration": "interactive", | |||
| "java.jdt.ls.java.home": "C:\\java\\jdk-17.0.8", | |||
| "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable" | |||
| } | |||
| ``` | |||
| 4. Run and Debug "Launch Local" | |||
| ## Using gradle | |||
| This project can also be run using gradle. | |||
| ### Running the application | |||
| After creating the table in MySQL, run | |||
| ```shell | |||
| SPRING_PROFILES_ACTIVE=db-local,ldap-local ./gradlew bootRun | |||
| ``` | |||
| @@ -2,13 +2,13 @@ plugins { | |||
| id 'java' | |||
| id 'org.springframework.boot' version '3.1.1' | |||
| id 'io.spring.dependency-management' version '1.1.0' | |||
| id 'org.jetbrains.kotlin.jvm' | |||
| } | |||
| group = 'com.ffii' | |||
| version = '0.0.1-SNAPSHOT' | |||
| java { | |||
| sourceCompatibility = '17' | |||
| } | |||
| repositories { | |||
| @@ -35,11 +35,16 @@ dependencies { | |||
| implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2' | |||
| implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.15.2' | |||
| implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2' | |||
| implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: '2.15.2' | |||
| implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5' | |||
| implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5' | |||
| implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5' | |||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" | |||
| implementation "org.jetbrains.kotlin:kotlin-reflect" | |||
| compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | |||
| runtimeOnly 'com.mysql:mysql-connector-j' | |||
| @@ -50,7 +55,10 @@ dependencies { | |||
| } | |||
| configurations { | |||
| all { | |||
| configureEach { | |||
| exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' | |||
| } | |||
| } | |||
| kotlin { | |||
| jvmToolchain(17) | |||
| } | |||
| @@ -1 +1,9 @@ | |||
| pluginManagement { | |||
| plugins { | |||
| id 'org.jetbrains.kotlin.jvm' version '1.9.21' | |||
| } | |||
| } | |||
| plugins { | |||
| id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' | |||
| } | |||
| rootProject.name = 'TSMS-backend' | |||
| @@ -0,0 +1,158 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| import java.time.LocalTime; | |||
| @Entity | |||
| @Table(name = "company") | |||
| public class Company extends BaseEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "companyCode", length = 30) | |||
| private String companyCode; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @Column(name = "brNo", length = 20) | |||
| private String brNo; | |||
| @Column(name = "contactName", length = 30) | |||
| private String contactName; | |||
| @Column(name = "phone", length = 20) | |||
| private String phone; | |||
| @Column(name = "otHourTo") | |||
| private LocalTime otHourTo; | |||
| @Column(name = "otHourFrom") | |||
| private LocalTime otHourFrom; | |||
| @Column(name = "normalHourTo") | |||
| private LocalTime normalHourTo; | |||
| @Column(name = "normalHourFrom") | |||
| private LocalTime normalHourFrom; | |||
| @Column(name = "currency", length = 20) | |||
| private String currency; | |||
| @Column(name = "address", length = 500) | |||
| private String address; | |||
| @Column(name = "district", length = 30) | |||
| private String district; | |||
| @Column(name = "email") | |||
| private String email; | |||
| public LocalTime getOtHourTo() { | |||
| return otHourTo; | |||
| } | |||
| public void setOtHourTo(LocalTime otHourTo) { | |||
| this.otHourTo = otHourTo; | |||
| } | |||
| public LocalTime getOtHourFrom() { | |||
| return otHourFrom; | |||
| } | |||
| public void setOtHourFrom(LocalTime otHourFrom) { | |||
| this.otHourFrom = otHourFrom; | |||
| } | |||
| public LocalTime getNormalHourTo() { | |||
| return normalHourTo; | |||
| } | |||
| public void setNormalHourTo(LocalTime normalHourTo) { | |||
| this.normalHourTo = normalHourTo; | |||
| } | |||
| public LocalTime getNormalHourFrom() { | |||
| return normalHourFrom; | |||
| } | |||
| public void setNormalHourFrom(LocalTime normalHourFrom) { | |||
| this.normalHourFrom = normalHourFrom; | |||
| } | |||
| public String getCurrency() { | |||
| return currency; | |||
| } | |||
| public void setCurrency(String currency) { | |||
| this.currency = currency; | |||
| } | |||
| public String getAddress() { | |||
| return address; | |||
| } | |||
| public void setAddress(String address) { | |||
| this.address = address; | |||
| } | |||
| public String getDistrict() { | |||
| return district; | |||
| } | |||
| public void setDistrict(String district) { | |||
| this.district = district; | |||
| } | |||
| public String getEmail() { | |||
| return email; | |||
| } | |||
| public void setEmail(String email) { | |||
| this.email = email; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| public String getContactName() { | |||
| return contactName; | |||
| } | |||
| public void setContactName(String contactName) { | |||
| this.contactName = contactName; | |||
| } | |||
| public String getBrNo() { | |||
| return brNo; | |||
| } | |||
| public void setBrNo(String brNo) { | |||
| this.brNo = brNo; | |||
| } | |||
| public String getCompanyCode() { | |||
| return companyCode; | |||
| } | |||
| public void setCompanyCode(String companyCode) { | |||
| this.companyCode = companyCode; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| import java.time.LocalDate; | |||
| @Entity | |||
| @Table(name = "company_holiday") | |||
| public class CompanyHoliday extends BaseEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "date") | |||
| private LocalDate date; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| public LocalDate getDate() { | |||
| return date; | |||
| } | |||
| public void setDate(LocalDate date) { | |||
| this.date = date; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface CompanyHolidayRepository extends AbstractRepository<CompanyHoliday, Long> { | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface CompanyRepository extends AbstractRepository<Company, Long> { | |||
| } | |||
| @@ -0,0 +1,101 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "customer") | |||
| public class Customer extends BaseEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| @Column(name = "address", length = 500) | |||
| private String address; | |||
| @Column(name = "district", length = 30) | |||
| private String district; | |||
| @Column(name = "email") | |||
| private String email; | |||
| @Column(name = "phone", length = 20) | |||
| private String phone; | |||
| @Column(name = "contactName", length = 30) | |||
| private String contactName; | |||
| @Column(name = "brNo", length = 20) | |||
| private String brNo; | |||
| public String getAddress() { | |||
| return address; | |||
| } | |||
| public void setAddress(String address) { | |||
| this.address = address; | |||
| } | |||
| public String getDistrict() { | |||
| return district; | |||
| } | |||
| public void setDistrict(String district) { | |||
| this.district = district; | |||
| } | |||
| public String getEmail() { | |||
| return email; | |||
| } | |||
| public void setEmail(String email) { | |||
| this.email = email; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| public String getContactName() { | |||
| return contactName; | |||
| } | |||
| public void setContactName(String contactName) { | |||
| this.contactName = contactName; | |||
| } | |||
| public String getBrNo() { | |||
| return brNo; | |||
| } | |||
| public void setBrNo(String brNo) { | |||
| this.brNo = brNo; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface CustomerRepository extends AbstractRepository<Customer, Long> { | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.IdEntity; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.JoinColumn; | |||
| import jakarta.persistence.ManyToOne; | |||
| import jakarta.persistence.Table; | |||
| @Entity | |||
| @Table(name = "customer_subsidiary") | |||
| public class CustomerSubsidiary extends IdEntity<Long> { | |||
| @ManyToOne | |||
| @JoinColumn(name = "customerId") | |||
| private Customer customer; | |||
| @ManyToOne | |||
| @JoinColumn(name = "subsidiaryId") | |||
| private Subsidiary subsidiary; | |||
| public Subsidiary getSubsidiary() { | |||
| return subsidiary; | |||
| } | |||
| public void setSubsidiary(Subsidiary subsidiary) { | |||
| this.subsidiary = subsidiary; | |||
| } | |||
| public Customer getCustomer() { | |||
| return customer; | |||
| } | |||
| public void setCustomerId(Customer customer) { | |||
| this.customer = customer; | |||
| } | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "department") | |||
| public class Department extends BaseEntity<Long> { | |||
| @Column(name = "description", length = 1500) | |||
| private String description; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| public String getDescription() { | |||
| return description; | |||
| } | |||
| public void setDescription(String description) { | |||
| this.description = description; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface DepartmentRepository extends AbstractRepository<Department, Long> { | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "grade") | |||
| public class Grade extends BaseEntity<Long> { | |||
| @Column(name = "description", length = 1500) | |||
| private String description; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| public String getDescription() { | |||
| return description; | |||
| } | |||
| public void setDescription(String description) { | |||
| this.description = description; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface GradeRepository extends AbstractRepository<Grade, Long> { | |||
| } | |||
| @@ -0,0 +1,81 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| import java.time.LocalDate; | |||
| @Entity | |||
| @Table(name = "internal_rate") | |||
| public class InternalRate extends BaseEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| @Column(name = "effectFrom") | |||
| private LocalDate effectFrom; | |||
| @Column(name = "effectTo") | |||
| private LocalDate effectTo; | |||
| @Column(name = "normalRate") | |||
| private Double normalRate; | |||
| @Column(name = "otRate") | |||
| private Double otRate; | |||
| public Double getOtRate() { | |||
| return otRate; | |||
| } | |||
| public void setOtRate(Double otRate) { | |||
| this.otRate = otRate; | |||
| } | |||
| public Double getNormalRate() { | |||
| return normalRate; | |||
| } | |||
| public void setNormalRate(Double normalRate) { | |||
| this.normalRate = normalRate; | |||
| } | |||
| public LocalDate getEffectTo() { | |||
| return effectTo; | |||
| } | |||
| public void setEffectTo(LocalDate effectTo) { | |||
| this.effectTo = effectTo; | |||
| } | |||
| public LocalDate getEffectFrom() { | |||
| return effectFrom; | |||
| } | |||
| public void setEffectFrom(LocalDate effectFrom) { | |||
| this.effectFrom = effectFrom; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "position") | |||
| public class Position extends BaseEntity<Long> { | |||
| @Column(name = "description", length = 1500) | |||
| private String description; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| public String getDescription() { | |||
| return description; | |||
| } | |||
| public void setDescription(String description) { | |||
| this.description = description; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface PositionRepository extends AbstractRepository<Position, Long> { | |||
| } | |||
| @@ -0,0 +1,81 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| import java.time.LocalDate; | |||
| @Entity | |||
| @Table(name = "rate") | |||
| public class Rate extends BaseEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| @Column(name = "effectFrom") | |||
| private LocalDate effectFrom; | |||
| @Column(name = "effectTo") | |||
| private LocalDate effectTo; | |||
| @Column(name = "normalRate") | |||
| private Double normalRate; | |||
| @Column(name = "otRate") | |||
| private Double otRate; | |||
| public Double getOtRate() { | |||
| return otRate; | |||
| } | |||
| public void setOtRate(Double otRate) { | |||
| this.otRate = otRate; | |||
| } | |||
| public Double getNormalRate() { | |||
| return normalRate; | |||
| } | |||
| public void setNormalRate(Double normalRate) { | |||
| this.normalRate = normalRate; | |||
| } | |||
| public LocalDate getEffectTo() { | |||
| return effectTo; | |||
| } | |||
| public void setEffectTo(LocalDate effectTo) { | |||
| this.effectTo = effectTo; | |||
| } | |||
| public LocalDate getEffectFrom() { | |||
| return effectFrom; | |||
| } | |||
| public void setEffectFrom(LocalDate effectFrom) { | |||
| this.effectFrom = effectFrom; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface RateRepository extends AbstractRepository<Rate, Long> { | |||
| } | |||
| @@ -0,0 +1,59 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.IdEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "salary") | |||
| public class Salary extends IdEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "salaryPoint") | |||
| private Integer salaryPoint; | |||
| @NotNull | |||
| @Column(name = "lowerLimit") | |||
| private Integer lowerLimit; | |||
| @NotNull | |||
| @Column(name = "upperLimit") | |||
| private Integer upperLimit; | |||
| @NotNull | |||
| @Column(name = "increment") | |||
| private Integer increment; | |||
| public Integer getIncrement() { | |||
| return increment; | |||
| } | |||
| public void setIncrement(Integer increment) { | |||
| this.increment = increment; | |||
| } | |||
| public Integer getLowerLimit() { | |||
| return lowerLimit; | |||
| } | |||
| public void setLowerLimit(Integer lowerLimit) { | |||
| this.lowerLimit = lowerLimit; | |||
| } | |||
| public Integer getUpperLimit() { | |||
| return upperLimit; | |||
| } | |||
| public void setUpperLimit(Integer upperLimit) { | |||
| this.upperLimit = upperLimit; | |||
| } | |||
| public void setSalaryPoint(Integer salaryPoint) { | |||
| this.salaryPoint = salaryPoint; | |||
| } | |||
| public Integer getSalaryPoint() { | |||
| return salaryPoint; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.IdEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.JoinColumn; | |||
| import jakarta.persistence.ManyToOne; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| import java.time.LocalDate; | |||
| @Entity | |||
| @Table(name = "salary_effective") | |||
| public class SalaryEffective extends IdEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "date") | |||
| private LocalDate date; | |||
| public LocalDate getDate() { | |||
| return date; | |||
| } | |||
| public void setDate(LocalDate date) { | |||
| this.date = date; | |||
| } | |||
| @ManyToOne | |||
| @JoinColumn(name = "salaryId") | |||
| @NotNull | |||
| private Salary salary; | |||
| public Salary getSalary() { | |||
| return salary; | |||
| } | |||
| public void setSalary(Salary salary) { | |||
| this.salary = salary; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface SalaryRepository extends AbstractRepository<Salary, Long> { | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "service") | |||
| public class Service extends BaseEntity<Long> { | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "type", length = 30) | |||
| private String type; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getType() { | |||
| return type; | |||
| } | |||
| public void setType(String type) { | |||
| this.type = type; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.IdEntity; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.JoinColumn; | |||
| import jakarta.persistence.ManyToOne; | |||
| import jakarta.persistence.Table; | |||
| @Entity | |||
| @Table(name = "service_rate") | |||
| public class ServiceRate extends IdEntity<Long> { | |||
| @ManyToOne | |||
| @JoinColumn(name = "rateId") | |||
| private Rate rate; | |||
| @ManyToOne | |||
| @JoinColumn(name = "serviceId") | |||
| private Service service; | |||
| public Rate getRate() { | |||
| return rate; | |||
| } | |||
| public void setRate(Rate rate) { | |||
| this.rate = rate; | |||
| } | |||
| public Service getService() { | |||
| return service; | |||
| } | |||
| public void setService(Service service) { | |||
| this.service = service; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface ServiceRepository extends AbstractRepository<Service, Long> { | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "skill") | |||
| public class Skill extends BaseEntity<Long> { | |||
| @Column(name = "description", length = 1500) | |||
| private String description; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| public String getDescription() { | |||
| return description; | |||
| } | |||
| public void setDescription(String description) { | |||
| this.description = description; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface SkillRepository extends AbstractRepository<Skill, Long> { | |||
| } | |||
| @@ -0,0 +1,257 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import com.ffii.tsms.modules.user.entity.User; | |||
| import jakarta.persistence.*; | |||
| import jakarta.validation.constraints.NotNull; | |||
| import java.time.LocalDate; | |||
| @Entity | |||
| @Table(name = "staff") | |||
| public class Staff extends BaseEntity<Long> { | |||
| @NotNull | |||
| @OneToOne | |||
| @JoinColumn(name = "userId", unique = true) | |||
| private User user; | |||
| @Column(name = "joinDate") | |||
| private LocalDate joinDate; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "staffId", length = 30) | |||
| private String staffId; | |||
| @ManyToOne | |||
| @JoinColumn(name = "currentPosition") | |||
| private Position currentPosition; | |||
| @ManyToOne | |||
| @JoinColumn(name = "joinPosition") | |||
| private Position joinPosition; | |||
| @NotNull | |||
| @ManyToOne | |||
| @JoinColumn(name = "companyId") | |||
| private Company company; | |||
| @ManyToOne | |||
| @JoinColumn(name = "gradeId") | |||
| private Grade grade; | |||
| @ManyToOne | |||
| @JoinColumn(name = "teamId") | |||
| private Team team; | |||
| @ManyToOne | |||
| @JoinColumn(name = "skillSetId") | |||
| private Skill skill; | |||
| @NotNull | |||
| @ManyToOne | |||
| @JoinColumn(name = "salaryEffId") | |||
| private SalaryEffective salaryEffective; | |||
| @ManyToOne | |||
| @JoinColumn(name = "departmentId") | |||
| private Department department; | |||
| @Column(name = "phone2", length = 20) | |||
| private String phone2; | |||
| @Column(name = "phone1", length = 20) | |||
| private String phone1; | |||
| @Column(name = "email") | |||
| private String email; | |||
| @Column(name = "emergContactName", length = 150) | |||
| private String emergContactName; | |||
| @Column(name = "emergContactPhone", length = 20) | |||
| private String emergContactPhone; | |||
| @Column(name = "employType", length = 30) | |||
| private String employType; | |||
| @Column(name = "departDate") | |||
| private LocalDate departDate; | |||
| @Column(name = "departReason", length = 500) | |||
| private String departReason; | |||
| @Column(name = "remark", length = 1500) | |||
| private String remark; | |||
| public String getRemark() { | |||
| return remark; | |||
| } | |||
| public void setRemark(String remark) { | |||
| this.remark = remark; | |||
| } | |||
| public String getDepartReason() { | |||
| return departReason; | |||
| } | |||
| public void setDepartReason(String departReason) { | |||
| this.departReason = departReason; | |||
| } | |||
| public LocalDate getDepartDate() { | |||
| return departDate; | |||
| } | |||
| public void setDepartDate(LocalDate departDate) { | |||
| this.departDate = departDate; | |||
| } | |||
| public String getEmployType() { | |||
| return employType; | |||
| } | |||
| public void setEmployType(String employType) { | |||
| this.employType = employType; | |||
| } | |||
| public String getEmergContactPhone() { | |||
| return emergContactPhone; | |||
| } | |||
| public void setEmergContactPhone(String emergContactPhone) { | |||
| this.emergContactPhone = emergContactPhone; | |||
| } | |||
| public String getEmergContactName() { | |||
| return emergContactName; | |||
| } | |||
| public void setEmergContactName(String emergContactName) { | |||
| this.emergContactName = emergContactName; | |||
| } | |||
| public String getPhone2() { | |||
| return phone2; | |||
| } | |||
| public void setPhone2(String phone2) { | |||
| this.phone2 = phone2; | |||
| } | |||
| public String getPhone1() { | |||
| return phone1; | |||
| } | |||
| public void setPhone1(String phone1) { | |||
| this.phone1 = phone1; | |||
| } | |||
| public String getEmail() { | |||
| return email; | |||
| } | |||
| public void setEmail(String email) { | |||
| this.email = email; | |||
| } | |||
| public SalaryEffective getSalaryEffective() { | |||
| return salaryEffective; | |||
| } | |||
| public void setSalaryEffective(SalaryEffective salaryEffective) { | |||
| this.salaryEffective = salaryEffective; | |||
| } | |||
| public Skill getSkill() { | |||
| return skill; | |||
| } | |||
| public void setSkill(Skill skill) { | |||
| this.skill = skill; | |||
| } | |||
| public Company getCompany() { | |||
| return company; | |||
| } | |||
| public void setCompany(Company company) { | |||
| this.company = company; | |||
| } | |||
| public Grade getGrade() { | |||
| return grade; | |||
| } | |||
| public void setGrade(Grade grade) { | |||
| this.grade = grade; | |||
| } | |||
| public Team getTeam() { | |||
| return team; | |||
| } | |||
| public void setTeam(Team team) { | |||
| this.team = team; | |||
| } | |||
| public Department getDepartment() { | |||
| return department; | |||
| } | |||
| public void setDepartment(Department department) { | |||
| this.department = department; | |||
| } | |||
| public Position getCurrentPosition() { | |||
| return currentPosition; | |||
| } | |||
| public void setCurrentPosition(Position currentPosition) { | |||
| this.currentPosition = currentPosition; | |||
| } | |||
| public Position getJoinPosition() { | |||
| return joinPosition; | |||
| } | |||
| public void setJoinPosition(Position joinPosition) { | |||
| this.joinPosition = joinPosition; | |||
| } | |||
| public LocalDate getJoinDate() { | |||
| return joinDate; | |||
| } | |||
| public void setJoinDate(LocalDate joinDate) { | |||
| this.joinDate = joinDate; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getStaffId() { | |||
| return staffId; | |||
| } | |||
| public void setStaffId(String staffId) { | |||
| this.staffId = staffId; | |||
| } | |||
| public User getUser() { | |||
| return user; | |||
| } | |||
| public void setUser(User user) { | |||
| this.user = user; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface StaffRepository extends AbstractRepository<Staff, Long> { | |||
| } | |||
| @@ -0,0 +1,103 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| import java.time.LocalTime; | |||
| @Entity | |||
| @Table(name = "subsidiary") | |||
| public class Subsidiary extends BaseEntity<Long> { | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @Column(name = "brNo", length = 20) | |||
| private String brNo; | |||
| @Column(name = "contactName", length = 30) | |||
| private String contactName; | |||
| @Column(name = "phone", length = 20) | |||
| private String phone; | |||
| @Column(name = "address", length = 500) | |||
| private String address; | |||
| @Column(name = "district", length = 30) | |||
| private String district; | |||
| @Column(name = "email") | |||
| private String email; | |||
| public String getAddress() { | |||
| return address; | |||
| } | |||
| public void setAddress(String address) { | |||
| this.address = address; | |||
| } | |||
| public String getDistrict() { | |||
| return district; | |||
| } | |||
| public void setDistrict(String district) { | |||
| this.district = district; | |||
| } | |||
| public String getEmail() { | |||
| return email; | |||
| } | |||
| public void setEmail(String email) { | |||
| this.email = email; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| public String getContactName() { | |||
| return contactName; | |||
| } | |||
| public void setContactName(String contactName) { | |||
| this.contactName = contactName; | |||
| } | |||
| public String getBrNo() { | |||
| return brNo; | |||
| } | |||
| public void setBrNo(String brNo) { | |||
| this.brNo = brNo; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface SubsidiaryRepository extends AbstractRepository<Subsidiary, Long> { | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.entity.BaseEntity; | |||
| import jakarta.persistence.Column; | |||
| import jakarta.persistence.Entity; | |||
| import jakarta.persistence.Table; | |||
| import jakarta.validation.constraints.NotNull; | |||
| @Entity | |||
| @Table(name = "team") | |||
| public class Team extends BaseEntity<Long> { | |||
| @Column(name = "description", length = 1500) | |||
| private String description; | |||
| @NotNull | |||
| @Column(name = "name", length = 150) | |||
| private String name; | |||
| @NotNull | |||
| @Column(name = "code", length = 30) | |||
| private String code; | |||
| public String getDescription() { | |||
| return description; | |||
| } | |||
| public void setDescription(String description) { | |||
| this.description = description; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(String code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.data.entity; | |||
| import com.ffii.core.support.AbstractRepository; | |||
| public interface TeamRepository extends AbstractRepository<Team, Long> { | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.ffii.tsms.modules.project.entity | |||
| import com.ffii.core.entity.IdEntity | |||
| import jakarta.persistence.Column | |||
| import jakarta.persistence.Entity | |||
| import jakarta.persistence.Table | |||
| import jakarta.validation.constraints.NotNull | |||
| @Entity | |||
| @Table(name = "milestone") | |||
| open class PaymentMilestone : IdEntity<Long>() { | |||
| @NotNull | |||
| @Column(name = "name") | |||
| open var name: String? = null | |||
| @NotNull | |||
| @Column(name = "description") | |||
| open var description: String? = null | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.project.entity; | |||
| import com.ffii.core.support.AbstractRepository | |||
| interface PaymentMilestoneRepository : AbstractRepository<PaymentMilestone, Long> { | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| package com.ffii.tsms.modules.project.entity | |||
| import com.ffii.core.entity.BaseEntity | |||
| import com.ffii.tsms.modules.data.entity.Customer | |||
| import com.ffii.tsms.modules.data.entity.Staff | |||
| import jakarta.persistence.* | |||
| import jakarta.validation.constraints.NotNull | |||
| import java.time.LocalDate | |||
| @Entity | |||
| @Table(name = "project") | |||
| open class Project : BaseEntity<Long>() { | |||
| @NotNull | |||
| @Column(name = "name", length = 100) | |||
| open var name: String? = null | |||
| @NotNull | |||
| @Column(name = "description") | |||
| open var description: String? = null | |||
| @Column(name = "planStart") | |||
| open var planStart: LocalDate? = null | |||
| @Column(name = "actualStart") | |||
| open var actualStart: LocalDate? = null | |||
| @Column(name = "planEnd") | |||
| open var planEnd: LocalDate? = null | |||
| @Column(name = "actualEnd") | |||
| open var actualEnd: LocalDate? = null | |||
| @ManyToOne | |||
| @JoinColumn(name = "teamLead") | |||
| open var teamLead: Staff? = null | |||
| @ManyToOne | |||
| @JoinColumn(name = "customerId") | |||
| open var customer: Customer? = null | |||
| @Column(name = "custLeadName", length = 30) | |||
| open var custLeadName: String? = null | |||
| @Column(name = "custLeadPhone", length = 20) | |||
| open var custLeadPhone: String? = null | |||
| @Column(name = "custLeadEmail") | |||
| open var custLeadEmail: String? = null | |||
| @Column(name = "remark", length = 1500) | |||
| open var remark: String? = null | |||
| @Column(name = "billStatus") | |||
| open var billStatus: Boolean? = null | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.project.entity; | |||
| import com.ffii.core.support.AbstractRepository | |||
| interface ProjectRepository : AbstractRepository<Project, Long> { | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| package com.ffii.tsms.modules.project.entity | |||
| import com.ffii.core.entity.IdEntity | |||
| import jakarta.persistence.* | |||
| import jakarta.validation.constraints.NotNull | |||
| @Entity | |||
| @Table(name = "project_task") | |||
| open class ProjectTask : IdEntity<Long>() { | |||
| @NotNull | |||
| @ManyToOne | |||
| open var project: Project? = null | |||
| @ManyToOne | |||
| @JoinColumn(name = "milestoneId") | |||
| open var paymentMilestone: PaymentMilestone? = null | |||
| @NotNull | |||
| @ManyToOne | |||
| open var task: Task? = null | |||
| @NotNull | |||
| @Column(name = "paymentPercentage") | |||
| open var paymentPercentage: Double? = null | |||
| @NotNull | |||
| @Column(name = "reminderPercentage") | |||
| open var reminderPercentage: Double? = null | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.project.entity; | |||
| import com.ffii.core.support.AbstractRepository | |||
| interface ProjectTaskRepository : AbstractRepository<ProjectTask, Long> { | |||
| } | |||
| @@ -0,0 +1,43 @@ | |||
| package com.ffii.tsms.modules.project.entity | |||
| import com.ffii.core.entity.IdEntity | |||
| import com.ffii.tsms.modules.data.entity.Staff | |||
| import jakarta.persistence.* | |||
| import jakarta.validation.constraints.NotNull | |||
| import java.time.LocalDate | |||
| @Entity | |||
| @Table(name = "staff_allocation") | |||
| open class StaffAllocation : IdEntity<Long>() { | |||
| @NotNull | |||
| @ManyToOne | |||
| open var project: Project? = null | |||
| @NotNull | |||
| @ManyToOne | |||
| open var staff: Staff? = null | |||
| @Column(name = "allocatedDateFrom") | |||
| open var allocatedDateFrom: LocalDate? = null | |||
| @Column(name = "allocatedDateTo") | |||
| open var allocatedDateTo: LocalDate? = null | |||
| @Column(name = "normalAllocated") | |||
| open var normalAllocated: Double? = null | |||
| @Column(name = "normalConsumed") | |||
| open var normalConsumed: Double? = null | |||
| @Column(name = "otAllocated") | |||
| open var otAllocated: Double? = null | |||
| @Column(name = "otConsumed") | |||
| open var otConsumed: Double? = null | |||
| @Column(name = "normalBilled") | |||
| open var normalBilled: Double? = null | |||
| @Column(name = "otBilled") | |||
| open var otBilled: Double? = null | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.project.entity; | |||
| import com.ffii.core.support.AbstractRepository | |||
| interface StaffAllocationRepository : AbstractRepository<StaffAllocation, Long> { | |||
| } | |||
| @@ -0,0 +1,34 @@ | |||
| package com.ffii.tsms.modules.project.entity | |||
| import com.ffii.core.entity.BaseEntity | |||
| import jakarta.persistence.* | |||
| import jakarta.validation.constraints.NotNull | |||
| import org.hibernate.proxy.HibernateProxy | |||
| @Entity | |||
| @Table(name = "task") | |||
| open class Task : BaseEntity<Long>() { | |||
| @NotNull | |||
| @Column(name = "name") | |||
| open var name: String? = null | |||
| @Column(name = "description") | |||
| open var description: String? = null | |||
| @ManyToOne | |||
| @JoinColumn(name = "taskGroupId") | |||
| open var taskGroup: TaskGroup? = null | |||
| final override fun equals(other: Any?): Boolean { | |||
| if (this === other) return true | |||
| if (other == null) return false | |||
| val oEffectiveClass = if (other is HibernateProxy) other.hibernateLazyInitializer.persistentClass else other.javaClass | |||
| val thisEffectiveClass = if (this is HibernateProxy) this.hibernateLazyInitializer.persistentClass else this.javaClass | |||
| if (thisEffectiveClass != oEffectiveClass) return false | |||
| other as Task | |||
| return id != null && id == other.id | |||
| } | |||
| final override fun hashCode(): Int = if (this is HibernateProxy) this.hibernateLazyInitializer.persistentClass.hashCode() else javaClass.hashCode() | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.ffii.tsms.modules.project.entity | |||
| import com.ffii.core.entity.IdEntity | |||
| import jakarta.persistence.Column | |||
| import jakarta.persistence.Entity | |||
| import jakarta.persistence.Table | |||
| @Entity | |||
| @Table(name = "task_group") | |||
| open class TaskGroup : IdEntity<Long>() { | |||
| @Column(name = "name") | |||
| open var name: String? = null | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.project.entity; | |||
| import com.ffii.core.support.AbstractRepository | |||
| interface TaskRepository : AbstractRepository<Task, Long> { | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.ffii.tsms.modules.project.entity | |||
| import com.ffii.core.entity.IdEntity | |||
| import jakarta.persistence.* | |||
| import jakarta.validation.constraints.NotNull | |||
| @Entity | |||
| @Table(name = "task_template") | |||
| open class TaskTemplate : IdEntity<Long>() { | |||
| @NotNull | |||
| @Column(name = "code") | |||
| open var code: String? = null | |||
| @NotNull | |||
| @Column(name = "name") | |||
| open var name: String? = null | |||
| @ManyToMany | |||
| @JoinTable(name = "task_template_tasks", | |||
| joinColumns = [JoinColumn(name = "taskTemplateId")], | |||
| inverseJoinColumns = [JoinColumn(name = "tasksId")]) | |||
| @OrderBy | |||
| open var tasks: MutableList<Task> = mutableListOf() | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| package com.ffii.tsms.modules.project.entity; | |||
| import com.ffii.core.support.AbstractRepository | |||
| interface TaskTemplateRepository : AbstractRepository<TaskTemplate, Long> { | |||
| } | |||
| @@ -0,0 +1,31 @@ | |||
| package com.ffii.tsms.modules.project.service | |||
| import com.ffii.tsms.modules.project.entity.Task | |||
| import com.ffii.tsms.modules.project.entity.TaskRepository | |||
| import com.ffii.tsms.modules.project.entity.TaskTemplate | |||
| import com.ffii.tsms.modules.project.entity.TaskTemplateRepository | |||
| import org.springframework.stereotype.Service | |||
| @Service | |||
| class TasksService( | |||
| private val taskTemplateRepository: TaskTemplateRepository, | |||
| private val taskRepository: TaskRepository | |||
| ) { | |||
| fun allTasks(): List<Task> { | |||
| return taskRepository.findAll() | |||
| } | |||
| fun allTaskTemplates(): List<TaskTemplate> { | |||
| return taskTemplateRepository.findAll() | |||
| } | |||
| fun saveTaskTemplate(code: String, name: String, taskIds: List<Long>): TaskTemplate { | |||
| return taskTemplateRepository.save<TaskTemplate>( | |||
| TaskTemplate().apply { | |||
| this.name = name | |||
| this.code = code | |||
| this.tasks = taskRepository.findAllById(taskIds) | |||
| } | |||
| ) | |||
| } | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.ffii.tsms.modules.project.web | |||
| import org.springframework.web.bind.annotation.GetMapping | |||
| import org.springframework.web.bind.annotation.RequestMapping | |||
| import org.springframework.web.bind.annotation.RestController | |||
| @RestController | |||
| @RequestMapping("/projects") | |||
| class ProjectsController { | |||
| @GetMapping | |||
| fun allProjects() { | |||
| } | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.ffii.tsms.modules.project.web | |||
| import com.ffii.tsms.modules.project.entity.Task | |||
| import com.ffii.tsms.modules.project.entity.TaskTemplate | |||
| import com.ffii.tsms.modules.project.service.TasksService | |||
| import com.ffii.tsms.modules.project.web.models.NewTaskTemplateRequest | |||
| import jakarta.validation.Valid | |||
| import org.springframework.web.bind.annotation.GetMapping | |||
| import org.springframework.web.bind.annotation.PostMapping | |||
| import org.springframework.web.bind.annotation.RequestBody | |||
| import org.springframework.web.bind.annotation.RequestMapping | |||
| import org.springframework.web.bind.annotation.RestController | |||
| @RestController | |||
| @RequestMapping("/tasks") | |||
| class TasksController(private val tasksService: TasksService) { | |||
| @GetMapping | |||
| fun allTasks(): List<Task> { | |||
| return tasksService.allTasks() | |||
| } | |||
| @GetMapping("/templates") | |||
| fun allTaskTemplates(): List<TaskTemplate> { | |||
| return tasksService.allTaskTemplates() | |||
| } | |||
| @PostMapping("/templates/new") | |||
| fun saveTaskTemplate(@Valid @RequestBody newTaskTemplate: NewTaskTemplateRequest): TaskTemplate { | |||
| return tasksService.saveTaskTemplate( | |||
| newTaskTemplate.code, | |||
| newTaskTemplate.name, | |||
| newTaskTemplate.taskIds | |||
| ) | |||
| } | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| package com.ffii.tsms.modules.project.web.models | |||
| import jakarta.validation.constraints.NotBlank | |||
| data class NewTaskTemplateRequest( | |||
| @field:NotBlank(message = "code cannot be empty") | |||
| val code: String, | |||
| @field:NotBlank(message = "name cannot be empty") | |||
| val name: String, | |||
| val taskIds: List<Long> = emptyList() | |||
| ) | |||
| @@ -0,0 +1,26 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:company | |||
| CREATE TABLE company ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| companyCode VARCHAR(30) NOT NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| brNo VARCHAR(20) NULL, | |||
| contactName VARCHAR(30) NULL, | |||
| phone VARCHAR(20) NULL, | |||
| otHourTo time NULL, | |||
| otHourFrom time NULL, | |||
| normalHourTo time NULL, | |||
| normalHourFrom time NULL, | |||
| currency VARCHAR(20) NULL, | |||
| address VARCHAR(500) NULL, | |||
| district VARCHAR(30) NULL, | |||
| email VARCHAR(255) NULL, | |||
| CONSTRAINT pk_company PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,15 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:company_holiday | |||
| CREATE TABLE company_holiday ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| date date NOT NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| CONSTRAINT pk_company_holiday PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,21 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:customer | |||
| CREATE TABLE customer ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| address VARCHAR(500) NULL, | |||
| district VARCHAR(30) NULL, | |||
| email VARCHAR(255) NULL, | |||
| phone VARCHAR(20) NULL, | |||
| contactName VARCHAR(30) NULL, | |||
| brNo VARCHAR(20) NULL, | |||
| CONSTRAINT pk_customer PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,21 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:subsidiary | |||
| CREATE TABLE subsidiary ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| code VARCHAR(30) NOT NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| brNo VARCHAR(20) NULL, | |||
| contactName VARCHAR(30) NULL, | |||
| phone VARCHAR(20) NULL, | |||
| address VARCHAR(500) NULL, | |||
| district VARCHAR(30) NULL, | |||
| email VARCHAR(255) NULL, | |||
| CONSTRAINT pk_subsidiary PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,13 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:customer_subsidiary | |||
| CREATE TABLE customer_subsidiary ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| customerId INT NULL, | |||
| subsidiaryId INT NULL, | |||
| CONSTRAINT pk_customer_subsidiary PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE customer_subsidiary ADD CONSTRAINT FK_CUSTOMER_SUBSIDIARY_ON_CUSTOMERID FOREIGN KEY (customerId) REFERENCES customer (id); | |||
| ALTER TABLE customer_subsidiary ADD CONSTRAINT FK_CUSTOMER_SUBSIDIARY_ON_SUBSIDIARYID FOREIGN KEY (subsidiaryId) REFERENCES subsidiary (id); | |||
| @@ -0,0 +1,16 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:department | |||
| CREATE TABLE department ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| `description` VARCHAR(1500) NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| CONSTRAINT pk_department PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,16 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:grade | |||
| CREATE TABLE grade ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| `description` VARCHAR(1500) NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| CONSTRAINT pk_grade PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,19 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:internal_rate | |||
| CREATE TABLE internal_rate ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| effectFrom date NULL, | |||
| effectTo date NULL, | |||
| normalRate DOUBLE NULL, | |||
| otRate DOUBLE NULL, | |||
| CONSTRAINT pk_internal_rate PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,16 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:position | |||
| CREATE TABLE position ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| `description` VARCHAR(1500) NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| CONSTRAINT pk_position PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,19 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:rate | |||
| CREATE TABLE rate ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| effectFrom date NULL, | |||
| effectTo date NULL, | |||
| normalRate DOUBLE NULL, | |||
| otRate DOUBLE NULL, | |||
| CONSTRAINT pk_rate PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,11 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:salary | |||
| CREATE TABLE salary ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| salaryPoint INT NOT NULL, | |||
| lowerLimit INT NOT NULL, | |||
| upperLimit INT NOT NULL, | |||
| increment INT NOT NULL, | |||
| CONSTRAINT pk_salary PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,11 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:salary_effective | |||
| CREATE TABLE salary_effective ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| date date NOT NULL, | |||
| salaryId INT NOT NULL, | |||
| CONSTRAINT pk_salary_effective PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE salary_effective ADD CONSTRAINT FK_SALARY_EFFECTIVE_ON_SALARYID FOREIGN KEY (salaryId) REFERENCES salary (id); | |||
| @@ -0,0 +1,16 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:service | |||
| CREATE TABLE service ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| name VARCHAR(150) NULL, | |||
| type VARCHAR(30) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| CONSTRAINT pk_service PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,13 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:service_rate | |||
| CREATE TABLE service_rate ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| rateId INT NULL, | |||
| serviceId INT NULL, | |||
| CONSTRAINT pk_service_rate PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE service_rate ADD CONSTRAINT FK_SERVICE_RATE_ON_RATEID FOREIGN KEY (rateId) REFERENCES rate (id); | |||
| ALTER TABLE service_rate ADD CONSTRAINT FK_SERVICE_RATE_ON_SERVICEID FOREIGN KEY (serviceId) REFERENCES service (id); | |||
| @@ -0,0 +1,16 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:skill | |||
| CREATE TABLE skill ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| `description` VARCHAR(1500) NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| CONSTRAINT pk_skill PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,16 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:team | |||
| CREATE TABLE team ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| `description` VARCHAR(1500) NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| code VARCHAR(30) NOT NULL, | |||
| CONSTRAINT pk_team PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,54 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:staff | |||
| CREATE TABLE staff ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| userId INT NOT NULL, | |||
| joinDate date NULL, | |||
| name VARCHAR(150) NOT NULL, | |||
| staffId VARCHAR(30) NOT NULL, | |||
| currentPosition INT NULL, | |||
| joinPosition INT NULL, | |||
| companyId INT NOT NULL, | |||
| gradeId INT NULL, | |||
| teamId INT NULL, | |||
| skillSetId INT NULL, | |||
| salaryEffId INT NOT NULL, | |||
| departmentId INT NULL, | |||
| phone2 VARCHAR(20) NULL, | |||
| phone1 VARCHAR(20) NULL, | |||
| email VARCHAR(255) NULL, | |||
| emergContactName VARCHAR(150) NULL, | |||
| emergContactPhone VARCHAR(20) NULL, | |||
| employType VARCHAR(30) NULL, | |||
| departDate date NULL, | |||
| departReason VARCHAR(500) NULL, | |||
| remark VARCHAR(1500) NULL, | |||
| CONSTRAINT pk_staff PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE staff ADD CONSTRAINT uc_staff_userid UNIQUE (userId); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_COMPANYID FOREIGN KEY (companyId) REFERENCES company (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_CURRENTPOSITION FOREIGN KEY (currentPosition) REFERENCES position (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_DEPARTMENTID FOREIGN KEY (departmentId) REFERENCES department (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_GRADEID FOREIGN KEY (gradeId) REFERENCES grade (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_JOINPOSITION FOREIGN KEY (joinPosition) REFERENCES position (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_SALARYEFFID FOREIGN KEY (salaryEffId) REFERENCES salary_effective (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_SKILLSETID FOREIGN KEY (skillSetId) REFERENCES skill (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_TEAMID FOREIGN KEY (teamId) REFERENCES team (id); | |||
| ALTER TABLE staff ADD CONSTRAINT FK_STAFF_ON_USERID FOREIGN KEY (userId) REFERENCES user (id); | |||
| @@ -0,0 +1,30 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:project | |||
| CREATE TABLE project ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| name VARCHAR(100) NOT NULL, | |||
| `description` VARCHAR(255) NOT NULL, | |||
| planStart date NULL, | |||
| actualStart date NULL, | |||
| planEnd date NULL, | |||
| actualEnd date NULL, | |||
| teamLead INT NULL, | |||
| customerId INT NULL, | |||
| custLeadName VARCHAR(30) NULL, | |||
| custLeadPhone VARCHAR(20) NULL, | |||
| custLeadEmail VARCHAR(255) NULL, | |||
| remark VARCHAR(1500) NULL, | |||
| billStatus TINYINT NULL, | |||
| CONSTRAINT pk_project PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE project ADD CONSTRAINT FK_PROJECT_ON_CUSTOMERID FOREIGN KEY (customerId) REFERENCES customer (id); | |||
| ALTER TABLE project ADD CONSTRAINT FK_PROJECT_ON_TEAMLEAD FOREIGN KEY (teamLead) REFERENCES staff (id); | |||
| @@ -0,0 +1,41 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:task | |||
| CREATE TABLE task_group ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| name VARCHAR(255) NULL, | |||
| CONSTRAINT pk_task_group PRIMARY KEY (id) | |||
| ); | |||
| CREATE TABLE task ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| version INT NOT NULL DEFAULT '0', | |||
| created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| createdBy VARCHAR(30) NULL, | |||
| modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
| modifiedBy VARCHAR(30) NULL, | |||
| deleted TINYINT(1) NOT NULL DEFAULT '0', | |||
| name VARCHAR(255) NOT NULL, | |||
| `description` VARCHAR(255) NULL, | |||
| taskGroupId INT NULL, | |||
| CONSTRAINT pk_task PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE task ADD CONSTRAINT FK_TASK_ON_TASKGROUPID FOREIGN KEY (taskGroupId) REFERENCES task_group (id); | |||
| CREATE TABLE task_template ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| code VARCHAR(255) NOT NULL, | |||
| name VARCHAR(255) NOT NULL, | |||
| CONSTRAINT pk_task_template PRIMARY KEY (id) | |||
| ); | |||
| CREATE TABLE task_template_tasks ( | |||
| taskTemplateId INT NOT NULL, | |||
| tasksId INT NOT NULL, | |||
| CONSTRAINT pk_task_template_tasks PRIMARY KEY (taskTemplateId, tasksId) | |||
| ); | |||
| ALTER TABLE task_template_tasks ADD CONSTRAINT fk_tastemtas_on_task FOREIGN KEY (tasksId) REFERENCES task (id); | |||
| ALTER TABLE task_template_tasks ADD CONSTRAINT fk_tastemtas_on_task_template FOREIGN KEY (taskTemplateId) REFERENCES task_template (id); | |||
| @@ -0,0 +1,9 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:milestone | |||
| CREATE TABLE milestone ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| name VARCHAR(255) NOT NULL, | |||
| `description` VARCHAR(255) NOT NULL, | |||
| CONSTRAINT pk_milestone PRIMARY KEY (id) | |||
| ); | |||
| @@ -0,0 +1,18 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:project_task | |||
| CREATE TABLE project_task ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| project_id INT NOT NULL, | |||
| milestoneId INT NULL, | |||
| task_id INT NOT NULL, | |||
| paymentPercentage DOUBLE NOT NULL, | |||
| reminderPercentage DOUBLE NOT NULL, | |||
| CONSTRAINT pk_project_task PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE project_task ADD CONSTRAINT FK_PROJECT_TASK_ON_MILESTONEID FOREIGN KEY (milestoneId) REFERENCES milestone (id); | |||
| ALTER TABLE project_task ADD CONSTRAINT FK_PROJECT_TASK_ON_PROJECT FOREIGN KEY (project_id) REFERENCES project (id); | |||
| ALTER TABLE project_task ADD CONSTRAINT FK_PROJECT_TASK_ON_TASK FOREIGN KEY (task_id) REFERENCES task (id); | |||
| @@ -0,0 +1,21 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:staff_allocation | |||
| CREATE TABLE staff_allocation ( | |||
| id INT NOT NULL AUTO_INCREMENT, | |||
| project_id INT NOT NULL, | |||
| staff_id INT NOT NULL, | |||
| allocatedDateFrom date NULL, | |||
| allocatedDateTo date NULL, | |||
| normalAllocated DOUBLE NULL, | |||
| normalConsumed DOUBLE NULL, | |||
| otAllocated DOUBLE NULL, | |||
| otConsumed DOUBLE NULL, | |||
| normalBilled DOUBLE NULL, | |||
| otBilled DOUBLE NULL, | |||
| CONSTRAINT pk_staff_allocation PRIMARY KEY (id) | |||
| ); | |||
| ALTER TABLE staff_allocation ADD CONSTRAINT FK_STAFF_ALLOCATION_ON_PROJECT FOREIGN KEY (project_id) REFERENCES project (id); | |||
| ALTER TABLE staff_allocation ADD CONSTRAINT FK_STAFF_ALLOCATION_ON_STAFF FOREIGN KEY (staff_id) REFERENCES staff (id); | |||
| @@ -0,0 +1,63 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:task_data | |||
| INSERT | |||
| INTO | |||
| task_group | |||
| (name) | |||
| VALUES | |||
| ('1. Design & Cost Planning / Estimating'), | |||
| ('2. Tender Documentation'), | |||
| ('3. Tender Analysis & Report & Contract Documentation'), | |||
| ('4. Construction / Post Construction'), | |||
| ('5. Miscellaneous'); | |||
| INSERT | |||
| INTO | |||
| task | |||
| (name, taskGroupId) | |||
| VALUES | |||
| ('1.1 Preparation of preliminary Cost Estimate / Cost Plan including Revised & Refined', 1), | |||
| ('1.2 Cash flow forecast', 1), | |||
| ('1.3 Cost studies for alternative design solutions', 1), | |||
| ('1.4 Attend design co-ordination / project review meetings', 1), | |||
| ('1.5 Prepare / Review RIC', 1), | |||
| ('2.1 Advise on tendering & contractual arrangement', 2), | |||
| ('2.2 Drafting / Vetting front-parts (incl. Main Contract, Sub-contracts & Direct Contracts)', 2), | |||
| ('2.3 Carry out pre-qualification exercise / EOI', 2), | |||
| ('2.4 Measurement (incl. billing of items) for Works Packages', 2), | |||
| ('2.5 Measurement (incl. billing of items) for tender addendum for Works Packages', 2), | |||
| ('2.6 Bulk Checking of Bills of Quantities', 2), | |||
| ('2.7 Line through drawings & specifications to check against Bills of Quantities / SOR', 2), | |||
| ('2.8 Update cash flow forecast', 2), | |||
| ('2.9 Edit tender documents (Incl. Bills of Quantities / SOR)', 2), | |||
| ('2.10 Preparation of pre-tender estimates', 2), | |||
| ('2.11 Attend design co-ordination / project review meetings / project meetings', 2), | |||
| ('3.1 Evaluation of tenders (incl. arithmetical checking, submission checking, etc)', 3), | |||
| ('3.2 Preparation of 3-rates bills', 3), | |||
| ('3.3 Preparation of Report on Tenderers (incl. three-rates bills)', 3), | |||
| ('3.4 Preparation of tender queries', 3), | |||
| ('3.5 Attend tender interviews', 3), | |||
| ('3.6 Draft Letter of Acceptance / Award', 3), | |||
| ('3.7 Preparation of Contract Documents for Works Packages', 3), | |||
| ('4.1 Check insurance policies, surety bond, guarantee, etc.', 4), | |||
| ('4.2 Valuation of works completed for progress payment (incl. site visits)', 4), | |||
| ('4.3 Preparation of financial statements (incl. cash flow forecasts)', 4), | |||
| ('4.4 Cost check / advice on a alternative design solutions', 4), | |||
| ('4.5 Cost estimate for draft AIs/EIs/SIs', 4), | |||
| ('4.6 Advise on contractual issues & evaluate monetary contractual claim', 4), | |||
| ('4.7 Attend site meetings / project co-ordination meetings / project meetings', 4), | |||
| ('4.8 Measurement & valuation of variations / prime cost & provisional sums', 4), | |||
| ('4.9 Negotiation and settlement of final accounts (incl. meetings)', 4), | |||
| ('4.10 Preparation of Statement of Final Account', 4), | |||
| ('4.11 Preparation of Cost Analysis for the Completed project', 4), | |||
| ('4.12 Check / Review draft final bills', 4), | |||
| ('4.13 Carry out site check for draft final bills', 4), | |||
| ('5.1 Preparation of Fee Proposal / Expression of Interest', 5), | |||
| ('5.2 Attend Management Meeting / Management Workshop', 5), | |||
| ('5.3 Preparation of project budget i.e. manhours vs fee receivables', 5), | |||
| ('5.4 Attend Local / International Conference / Seminar / Webinar', 5); | |||
| @@ -0,0 +1,57 @@ | |||
| -- liquibase formatted sql | |||
| -- changeset wayne:mock_task_templates | |||
| INSERT INTO task_template (code,name) VALUES | |||
| ('Pre-001','Pre-contract Template'), | |||
| ('Post-001','Post-contract Template'), | |||
| ('Full-001','Full Project Template'); | |||
| INSERT INTO task_template_tasks (taskTemplateId,tasksId) VALUES | |||
| (1,1), | |||
| (2,1), | |||
| (3,1), | |||
| (1,2), | |||
| (3,2), | |||
| (1,3), | |||
| (2,3), | |||
| (3,3), | |||
| (3,4), | |||
| (3,5), | |||
| (1,6), | |||
| (3,6), | |||
| (1,7), | |||
| (3,7), | |||
| (3,8), | |||
| (3,9), | |||
| (3,10), | |||
| (3,11), | |||
| (3,12), | |||
| (3,13), | |||
| (3,14), | |||
| (3,15), | |||
| (3,16), | |||
| (3,17), | |||
| (3,18), | |||
| (3,19), | |||
| (3,20), | |||
| (3,21), | |||
| (3,22), | |||
| (3,23), | |||
| (3,24), | |||
| (3,25), | |||
| (3,26), | |||
| (3,27), | |||
| (3,28), | |||
| (3,29), | |||
| (3,30), | |||
| (3,31), | |||
| (3,32), | |||
| (3,33), | |||
| (3,34), | |||
| (3,35), | |||
| (3,36), | |||
| (3,37), | |||
| (3,38), | |||
| (3,39), | |||
| (3,40); | |||