Skip to content

Commit

Permalink
fixed build error and removed lombok dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
pradipmudi committed Oct 24, 2023
1 parent d781e58 commit f7f477e
Show file tree
Hide file tree
Showing 11 changed files with 308 additions and 49 deletions.
2 changes: 2 additions & 0 deletions application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server:
port: 8080
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-gradle-plugin:3.1.5'
implementation 'org.springframework.boot:spring-boot-starter-web:3.1.5'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:3.1.5'
implementation 'org.projectlombok:lombok:1.18.20'
// implementation 'org.apache.logging.log4j:log4j:2.8.2'

// runtimeOnly 'mysql:mysql-connector-java'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ private ExpenseToReportConvertor() {
}

public List<Report> prepareReportListFromExpenseList(List<Expense> expenseList, ReportRequest reportRequest) {
HashMap<Month, List<Report>> monthReportMap = new HashMap<>();
HashMap<Month, List<ReportInfo>> monthReportInfoMap = new HashMap<>();
HashMap<Month, List<ReportInfo>> monthReportInfoMap;

List<ReportInfo> reportInfoList = new ArrayList<>();
monthReportInfoMap = prepareReportInfoListFromExpenseListByMonth(expenseList, SpentBy.ALL);
return prepareReportInfoFromReportInfoByMonth(monthReportInfoMap, reportRequest);
}
Expand Down
35 changes: 31 additions & 4 deletions src/main/java/com/expensys/entity/CategoryMappingEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

import com.expensys.model.enums.Category;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "category_mappings")
public class CategoryMappingEntity {
Expand All @@ -24,4 +20,35 @@ public class CategoryMappingEntity {
@Column(name = "main_category_type", nullable = false)
Category categoryType;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getSubCategory() {
return subCategory;
}

public void setSubCategory(String subCategory) {
this.subCategory = subCategory;
}

public Category getMainCategory() {
return mainCategory;
}

public void setMainCategory(Category mainCategory) {
this.mainCategory = mainCategory;
}

public Category getCategoryType() {
return categoryType;
}

public void setCategoryType(Category categoryType) {
this.categoryType = categoryType;
}
}
52 changes: 47 additions & 5 deletions src/main/java/com/expensys/entity/ExpenseEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

import com.expensys.model.enums.Category;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;
import java.util.Date;

@Getter
@Setter
@Entity
@Table(name = "expenses")
public class ExpenseEntity {
Expand All @@ -33,4 +28,51 @@ public class ExpenseEntity {
@Column(name = "spent_by", nullable = false)
String spentBy;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public LocalDate getDate() {
return date;
}

public void setDate(LocalDate date) {
this.date = date;
}

public String getItem() {
return item;
}

public void setItem(String item) {
this.item = item;
}

public Category getCategory() {
return category;
}

public void setCategory(Category category) {
this.category = category;
}

public Double getSpent() {
return spent;
}

public void setSpent(Double spent) {
this.spent = spent;
}

public String getSpentBy() {
return spentBy;
}

public void setSpentBy(String spentBy) {
this.spentBy = spentBy;
}
}
27 changes: 23 additions & 4 deletions src/main/java/com/expensys/entity/UnknownCategoryEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

import com.expensys.model.enums.Category;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "unknown_category")
public class UnknownCategoryEntity {
Expand All @@ -21,4 +17,27 @@ public class UnknownCategoryEntity {
@Column(name = "category", nullable = false)
Category category;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getItem() {
return item;
}

public void setItem(String item) {
this.item = item;
}

public Category getCategory() {
return category;
}

public void setCategory(Category category) {
this.category = category;
}
}
53 changes: 47 additions & 6 deletions src/main/java/com/expensys/model/Expense.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,59 @@

import com.expensys.model.enums.Category;
import com.expensys.model.enums.Month;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class Expense {
Month month;
String subCategory;
Category category;
Double spent;
String spentBy;

public Expense(Month month, String subCategory, Category category, Double spent, String spentBy) {
this.month = month;
this.subCategory = subCategory;
this.category = category;
this.spent = spent;
this.spentBy = spentBy;
}

public Month getMonth() {
return month;
}

public void setMonth(Month month) {
this.month = month;
}

public String getSubCategory() {
return subCategory;
}

public void setSubCategory(String subCategory) {
this.subCategory = subCategory;
}

public Category getCategory() {
return category;
}

public void setCategory(Category category) {
this.category = category;
}

public Double getSpent() {
return spent;
}

public void setSpent(Double spent) {
this.spent = spent;
}

public String getSpentBy() {
return spentBy;
}

public void setSpentBy(String spentBy) {
this.spentBy = spentBy;
}
}
54 changes: 48 additions & 6 deletions src/main/java/com/expensys/model/request/ReportRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,59 @@
import com.expensys.model.enums.Category;
import com.expensys.model.enums.Month;
import com.expensys.model.enums.SpentBy;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class ReportRequest {
Month month;
Category category;
SpentBy spentBy;
Boolean showSpendByUserPercentage;
int year;

public ReportRequest(Month month, Category category, SpentBy spentBy, Boolean showSpendByUserPercentage, int year) {
this.month = month;
this.category = category;
this.spentBy = spentBy;
this.showSpendByUserPercentage = showSpendByUserPercentage;
this.year = year;
}

public Month getMonth() {
return month;
}

public void setMonth(Month month) {
this.month = month;
}

public Category getCategory() {
return category;
}

public void setCategory(Category category) {
this.category = category;
}

public SpentBy getSpentBy() {
return spentBy;
}

public void setSpentBy(SpentBy spentBy) {
this.spentBy = spentBy;
}

public Boolean getShowSpendByUserPercentage() {
return showSpendByUserPercentage;
}

public void setShowSpendByUserPercentage(Boolean showSpendByUserPercentage) {
this.showSpendByUserPercentage = showSpendByUserPercentage;
}

public int getYear() {
return year;
}

public void setYear(int year) {
this.year = year;
}
}
30 changes: 24 additions & 6 deletions src/main/java/com/expensys/model/response/Report.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
package com.expensys.model.response;

import com.expensys.model.enums.Month;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;

@ToString
@Getter
@Setter
public class Report {
Month month;
List<ReportInfo> reportInfo;

public Month getMonth() {
return month;
}

public void setMonth(Month month) {
this.month = month;
}

public List<ReportInfo> getReportInfo() {
return reportInfo;
}

public void setReportInfo(List<ReportInfo> reportInfo) {
this.reportInfo = reportInfo;
}

@Override
public String toString() {
return "Report{" +
"month=" + month +
", reportInfo=" + reportInfo +
'}';
}
}
Loading

0 comments on commit f7f477e

Please sign in to comment.