예산편성 수정중.
parent
da6386d0ea
commit
735f7c9b35
|
|
@ -36,3 +36,5 @@ out/
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
.vs/
|
.vs/
|
||||||
|
src/main/resources/application-cks1.properties
|
||||||
|
src/main/resources/application-cks2.properties
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.dbnt.faisp.main.budget;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.budget.common.ResultResponseCode;
|
import com.dbnt.faisp.main.budget.common.ResultResponseCode;
|
||||||
import com.dbnt.faisp.main.budget.model.*;
|
import com.dbnt.faisp.main.budget.model.*;
|
||||||
import com.dbnt.faisp.main.budget.repository.BudgetRepository.*;
|
import com.dbnt.faisp.main.budget.model.result.*;
|
||||||
import com.dbnt.faisp.main.budget.service.BudgetService;
|
import com.dbnt.faisp.main.budget.service.BudgetService;
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||||||
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
||||||
|
|
@ -84,8 +84,7 @@ public class BudgetController {
|
||||||
//예산편성 - 항목추가
|
//예산편성 - 항목추가
|
||||||
@PostMapping("/budgeting/code")
|
@PostMapping("/budgeting/code")
|
||||||
public ResultResponse<?> insertBudgeting(@AuthenticationPrincipal UserInfo loginUser, BudgetDto.BudgetingInsertReqeust requestDto) {
|
public ResultResponse<?> insertBudgeting(@AuthenticationPrincipal UserInfo loginUser, BudgetDto.BudgetingInsertReqeust requestDto) {
|
||||||
budgetService.insertBudgetingList(loginUser, requestDto);
|
return new ResultResponse(budgetService.insertBudgetingList(loginUser, requestDto));
|
||||||
return new ResultResponse().successResponse(ResultResponseCode.SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//예산편성 - 항목변경
|
//예산편성 - 항목변경
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
package com.dbnt.faisp.main.budget.mapper;
|
package com.dbnt.faisp.main.budget.mapper;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.authMgt.model.AccessConfig;
|
|
||||||
import com.dbnt.faisp.main.authMgt.model.ApprovalConfig;
|
|
||||||
import com.dbnt.faisp.main.budget.model.*;
|
import com.dbnt.faisp.main.budget.model.*;
|
||||||
import com.dbnt.faisp.main.budget.repository.BudgetRepository;
|
import com.dbnt.faisp.main.budget.model.result.*;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface BudgetMapper {
|
public interface BudgetMapper {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model;
|
||||||
|
|
||||||
import com.dbnt.faisp.config.BaseModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.dbnt.faisp.main.budget.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "tbl_budget_code_l1")
|
||||||
|
public class TblBudgetCodeL1 {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "l1_code")
|
||||||
|
private String l1Code;
|
||||||
|
@Column(name = "l1_name")
|
||||||
|
private String l1Name;
|
||||||
|
@Column(name = "l1_year")
|
||||||
|
private String l1Year;
|
||||||
|
@Column(name = "use_tag")
|
||||||
|
private String useTag;
|
||||||
|
@Column(name = "seq_ord")
|
||||||
|
private Integer seqOrd;
|
||||||
|
@Column(name = "remark")
|
||||||
|
private String remark;
|
||||||
|
@Column(name = "modi_date")
|
||||||
|
private LocalDateTime modiDate;
|
||||||
|
|
||||||
|
public void setData(String l1Code, String l1Name, String l1Year, String useTag, Integer seqOrd, String remark, LocalDateTime modiDate){
|
||||||
|
this.l1Code = l1Code;
|
||||||
|
this.l1Name = l1Name;
|
||||||
|
this.l1Year = l1Year;
|
||||||
|
this.useTag = useTag;
|
||||||
|
this.seqOrd = seqOrd;
|
||||||
|
this.remark = remark;
|
||||||
|
this.modiDate = modiDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.dbnt.faisp.main.budget.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "tbl_budget_code_l2")
|
||||||
|
public class TblBudgetCodeL2 {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "l2_code")
|
||||||
|
private String l2Code;
|
||||||
|
@Column(name = "l2_name")
|
||||||
|
private String l2Name;
|
||||||
|
@Column(name = "l1_code")
|
||||||
|
private String l1Code;
|
||||||
|
@Column(name = "use_tag")
|
||||||
|
private String useTag;
|
||||||
|
@Column(name = "seq_ord")
|
||||||
|
private Integer seqOrd;
|
||||||
|
@Column(name = "remark")
|
||||||
|
private String remark;
|
||||||
|
@Column(name = "modi_date")
|
||||||
|
private LocalDateTime modiDate;
|
||||||
|
|
||||||
|
|
||||||
|
public void setData(String l2Code, String l2Name, String l1Code, String useTag, Integer seqOrd, String remark, LocalDateTime modiDate){
|
||||||
|
this.l2Code = l2Code;
|
||||||
|
this.l2Name = l2Name;
|
||||||
|
this.l1Code = l1Code;
|
||||||
|
this.useTag = useTag;
|
||||||
|
this.seqOrd = seqOrd;
|
||||||
|
this.remark = remark;
|
||||||
|
this.modiDate = modiDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.dbnt.faisp.main.budget.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "tbl_budget_code_l3")
|
||||||
|
public class TblBudgetCodeL3 {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "l3_code")
|
||||||
|
private String l3Code;
|
||||||
|
@Column(name = "l3_name")
|
||||||
|
private String l3Name;
|
||||||
|
@Column(name = "l2_code")
|
||||||
|
private String l2Code;
|
||||||
|
@Column(name = "use_tag")
|
||||||
|
private String useTag;
|
||||||
|
@Column(name = "seq_ord")
|
||||||
|
private Integer seqOrd;
|
||||||
|
@Column(name = "remark")
|
||||||
|
private String remark;
|
||||||
|
@Column(name = "modi_date")
|
||||||
|
private LocalDateTime modiDate;
|
||||||
|
|
||||||
|
public void setData(String l3Code, String l3Name, String l2Code, String useTag, Integer seqOrd, String remark, LocalDateTime modiDate){
|
||||||
|
this.l3Code = l3Code;
|
||||||
|
this.l3Name = l3Name;
|
||||||
|
this.l2Code = l2Code;
|
||||||
|
this.useTag = useTag;
|
||||||
|
this.seqOrd = seqOrd;
|
||||||
|
this.remark = remark;
|
||||||
|
this.modiDate = modiDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.dbnt.faisp.main.budget.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "tbl_budget_history")
|
||||||
|
public class TblBudgetHistory {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "seq")
|
||||||
|
private Integer seq;
|
||||||
|
@Column(name = "budget_code")
|
||||||
|
private String budgetCode;
|
||||||
|
@Column(name = "org_code")
|
||||||
|
private String orgCode;
|
||||||
|
@Column(name = "update_title")
|
||||||
|
private String updateTitle;
|
||||||
|
@Column(name = "old_amount")
|
||||||
|
private Integer oldAmount;
|
||||||
|
@Column(name = "new_amount")
|
||||||
|
private Integer newAmonut;
|
||||||
|
@Column(name = "modi_id")
|
||||||
|
private String modiId;
|
||||||
|
@Column(name = "modi_date")
|
||||||
|
private LocalDateTime modiDate;
|
||||||
|
|
||||||
|
public void setData(String budgetCode, String orgCode, String updateTitle, Integer oldAmount, Integer newAmonut, String modiId, LocalDateTime modiDate){
|
||||||
|
this.budgetCode = budgetCode;
|
||||||
|
this.orgCode = orgCode;
|
||||||
|
this.updateTitle = updateTitle;
|
||||||
|
this.oldAmount = oldAmount;
|
||||||
|
this.newAmonut = newAmonut;
|
||||||
|
this.modiId = modiId;
|
||||||
|
this.modiDate = modiDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.dbnt.faisp.main.budget.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "tbl_budget_plan")
|
||||||
|
public class TblBudgetPlan {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "seq")
|
||||||
|
private Integer seq;
|
||||||
|
@Column(name = "budget_code")
|
||||||
|
private String budgetCode;
|
||||||
|
@Column(name = "org_code")
|
||||||
|
private String orgCode;
|
||||||
|
@Column(name = "amount")
|
||||||
|
private Integer amount;
|
||||||
|
@Column(name = "remark")
|
||||||
|
private String remark;
|
||||||
|
@Column(name = "modi_id")
|
||||||
|
private String modiId;
|
||||||
|
@Column(name = "modi_date")
|
||||||
|
private LocalDateTime modiDate;
|
||||||
|
|
||||||
|
public void setData(String budgetCode, String orgCode, Integer amount, String remark, String modiId, LocalDateTime modiDate){
|
||||||
|
this.budgetCode = budgetCode;
|
||||||
|
this.orgCode = orgCode;
|
||||||
|
this.amount = amount;
|
||||||
|
this.remark = remark;
|
||||||
|
this.modiId = modiId;
|
||||||
|
this.modiDate = modiDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.budget.common.ResultResponseCode;
|
import com.dbnt.faisp.main.budget.common.ResultResponseCode;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.dbnt.faisp.main.budget.model;
|
package com.dbnt.faisp.main.budget.model.result;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.dbnt.faisp.main.budget.repository;
|
package com.dbnt.faisp.main.budget.repository;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.budget.model.*;
|
import com.dbnt.faisp.main.budget.model.*;
|
||||||
|
import com.dbnt.faisp.main.budget.model.result.*;
|
||||||
import com.dbnt.faisp.main.codeMgt.model.CodeCatg;
|
import com.dbnt.faisp.main.codeMgt.model.CodeCatg;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.dbnt.faisp.main.budget.repository;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.main.budget.model.TblBudgetCodeL1;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface TblBudgetCodeL1Repository extends JpaRepository<TblBudgetCodeL1, String> {
|
||||||
|
Optional<TblBudgetCodeL1> findByL1NameAndL1YearAndUseTag(String l1Name, String l1Year, String useTag);
|
||||||
|
Optional<TblBudgetCodeL1> findTop1ByL1YearAndUseTagOrderByL1CodeDesc(String l1Year, String useTag);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.dbnt.faisp.main.budget.repository;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.main.budget.model.TblBudgetCodeL2;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface TblBudgetCodeL2Repository extends JpaRepository<TblBudgetCodeL2, String> {
|
||||||
|
Optional<TblBudgetCodeL2> findByL2NameAndL1CodeAndUseTag(String codeL2Name, String l1Code, String y);
|
||||||
|
|
||||||
|
Optional<TblBudgetCodeL2> findTop1ByL1CodeAndUseTagOrderByL2CodeDesc(String l1Code, String useTag);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.dbnt.faisp.main.budget.repository;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.main.budget.model.TblBudgetCodeL3;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface TblBudgetCodeL3Repository extends JpaRepository<TblBudgetCodeL3, String> {
|
||||||
|
Optional<TblBudgetCodeL3> findByL3NameAndL2CodeAndUseTag(String codeL3Name, String l2Code, String y);
|
||||||
|
|
||||||
|
Optional<TblBudgetCodeL3> findTop1ByL2CodeAndUseTagOrderByL3CodeDesc(String l2Code, String y);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.dbnt.faisp.main.budget.repository;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.main.budget.model.TblBudgetHistory;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface TblBudgetHistoryRepository extends JpaRepository<TblBudgetHistory, Integer> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.dbnt.faisp.main.budget.repository;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.main.budget.model.TblBudgetHistory;
|
||||||
|
import com.dbnt.faisp.main.budget.model.TblBudgetPlan;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface TblBudgetPlanRepository extends JpaRepository<TblBudgetPlan, Integer> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,9 +5,8 @@ import com.dbnt.faisp.main.budget.common.BaseException;
|
||||||
import com.dbnt.faisp.main.budget.common.ResultResponseCode;
|
import com.dbnt.faisp.main.budget.common.ResultResponseCode;
|
||||||
import com.dbnt.faisp.main.budget.mapper.BudgetMapper;
|
import com.dbnt.faisp.main.budget.mapper.BudgetMapper;
|
||||||
import com.dbnt.faisp.main.budget.model.*;
|
import com.dbnt.faisp.main.budget.model.*;
|
||||||
import com.dbnt.faisp.main.budget.repository.BudgetRepository;
|
import com.dbnt.faisp.main.budget.model.result.*;
|
||||||
import com.dbnt.faisp.main.budget.repository.BudgetRepository.*;
|
import com.dbnt.faisp.main.budget.repository.*;
|
||||||
import com.dbnt.faisp.main.equip.model.Equip;
|
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -15,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -24,6 +24,11 @@ import java.util.*;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class BudgetService {
|
public class BudgetService {
|
||||||
|
|
||||||
|
private final TblBudgetCodeL1Repository codeL1Repository;
|
||||||
|
private final TblBudgetCodeL2Repository codeL2Repository;
|
||||||
|
private final TblBudgetCodeL3Repository codeL3Repository;
|
||||||
|
private final TblBudgetHistoryRepository historyRepository;
|
||||||
|
private final TblBudgetPlanRepository planRepository;
|
||||||
private final BudgetRepository budgetRepository;
|
private final BudgetRepository budgetRepository;
|
||||||
private final BudgetMapper budgetMapper;
|
private final BudgetMapper budgetMapper;
|
||||||
|
|
||||||
|
|
@ -93,8 +98,8 @@ public class BudgetService {
|
||||||
|
|
||||||
//예산편성 - 항목추가
|
//예산편성 - 항목추가
|
||||||
@Transactional
|
@Transactional
|
||||||
public void insertBudgetingList(UserInfo loginUser, BudgetDto.BudgetingInsertReqeust requestDto){
|
public ResultResponseCode insertBudgetingList(UserInfo loginUser, BudgetDto.BudgetingInsertReqeust requestDto){
|
||||||
UpdateResult result = budgetRepository.callSpAddBudgetPlanCodeName(requestDto.getYear(),requestDto.getNameL1(),requestDto.getNameL2(),requestDto.getNameL3(), "OG001", "admin");
|
// UpdateResult result = budgetRepository.callSpAddBudgetPlanCodeName(requestDto.getYear(),requestDto.getNameL1(),requestDto.getNameL2(),requestDto.getNameL3(), "OG001", "admin");
|
||||||
// BudgetParams params = new BudgetParams();
|
// BudgetParams params = new BudgetParams();
|
||||||
// params.setYear(requestDto.getYear());
|
// params.setYear(requestDto.getYear());
|
||||||
// params.setCode1(requestDto.getNameL1());
|
// params.setCode1(requestDto.getNameL1());
|
||||||
|
|
@ -104,17 +109,65 @@ public class BudgetService {
|
||||||
// params.setId("admin");
|
// params.setId("admin");
|
||||||
// UpdateResult result = budgetMapper.callSpAddBudgetPlanCodeName(params);
|
// UpdateResult result = budgetMapper.callSpAddBudgetPlanCodeName(params);
|
||||||
|
|
||||||
if(result.getResultCode().equals("100")) {
|
LocalDateTime modiDate = LocalDateTime.now();
|
||||||
return;
|
String year = requestDto.getYear();
|
||||||
} else {
|
String codeL1Name = requestDto.getNameL1();
|
||||||
throw new BaseException(ResultResponseCode.DUPLICATE_CODE);
|
String codeL2Name = requestDto.getNameL2();
|
||||||
|
String codeL3Name = requestDto.getNameL3();
|
||||||
|
|
||||||
|
TblBudgetCodeL1 codeL1 = codeL1Repository.findByL1NameAndL1YearAndUseTag(codeL1Name, year, "Y").orElse(new TblBudgetCodeL1());
|
||||||
|
if(codeL1.getL1Code() == null){
|
||||||
|
TblBudgetCodeL1 lastL1Code = codeL1Repository.findTop1ByL1YearAndUseTagOrderByL1CodeDesc(year, "Y").orElse(null);
|
||||||
|
String l1Code = makeCode(year.substring(2), lastL1Code==null?null:lastL1Code.getL1Code());
|
||||||
|
Integer seqOrd = lastL1Code==null?1:(lastL1Code.getSeqOrd()+1);
|
||||||
|
codeL1.setData(l1Code, codeL1Name, year, "Y", seqOrd, "항목추가", modiDate);
|
||||||
|
codeL1Repository.save(codeL1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String l1Code = codeL1.getL1Code();
|
||||||
|
TblBudgetCodeL2 codeL2 = codeL2Repository.findByL2NameAndL1CodeAndUseTag(codeL2Name, l1Code, "Y").orElse(new TblBudgetCodeL2());;
|
||||||
|
if(codeL2.getL1Code() == null){
|
||||||
|
TblBudgetCodeL2 lastL2Code = codeL2Repository.findTop1ByL1CodeAndUseTagOrderByL2CodeDesc(l1Code, "Y").orElse(null);
|
||||||
|
String l2Code = makeCode(l1Code, lastL2Code==null?null: lastL2Code.getL2Code());
|
||||||
|
Integer seqOrd = lastL2Code==null?1:(lastL2Code.getSeqOrd()+1);
|
||||||
|
codeL2.setData(l2Code, codeL1Name, l1Code, "Y", seqOrd, "항목추가", modiDate);
|
||||||
|
codeL2Repository.save(codeL2);
|
||||||
|
}
|
||||||
|
|
||||||
|
String l2Code = codeL2.getL2Code();
|
||||||
|
TblBudgetCodeL3 codeL3 = codeL3Repository.findByL3NameAndL2CodeAndUseTag(codeL3Name, l2Code, "Y").orElse(new TblBudgetCodeL3());;
|
||||||
|
if(codeL3.getL3Code() == null){
|
||||||
|
TblBudgetCodeL3 lastL3Code = codeL3Repository.findTop1ByL2CodeAndUseTagOrderByL3CodeDesc(l2Code, "Y").orElse(null);
|
||||||
|
String l3Code = makeCode(l2Code, lastL3Code==null?null: lastL3Code.getL3Code());
|
||||||
|
Integer seqOrd = lastL3Code==null?1:(lastL3Code.getSeqOrd()+1);
|
||||||
|
codeL3.setData(l3Code, codeL3Name, l2Code, "Y", seqOrd, "항목추가", modiDate);
|
||||||
|
codeL3Repository.save(codeL3);
|
||||||
|
}else{
|
||||||
|
// throw new BaseException(ResultResponseCode.DUPLICATE_CODE);
|
||||||
|
return ResultResponseCode.DUPLICATE_CODE;
|
||||||
|
}
|
||||||
|
String l3Code = codeL3.getL3Code();
|
||||||
|
TblBudgetHistory history = new TblBudgetHistory();
|
||||||
|
history.setData(l3Code, loginUser.getOgCd(), "예산편성 등록", 0, 0, loginUser.getUserId(), modiDate);
|
||||||
|
historyRepository.save(history);
|
||||||
|
TblBudgetPlan plan = new TblBudgetPlan();
|
||||||
|
plan.setData(l3Code, loginUser.getOgCd(), 0, null, loginUser.getUserId(), modiDate);
|
||||||
|
planRepository.save(plan);
|
||||||
|
|
||||||
|
return ResultResponseCode.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String makeCode(String upCode, String lastCode){
|
||||||
|
if (lastCode==null){
|
||||||
|
return upCode+"001";
|
||||||
|
}else{
|
||||||
|
String codeSeq = "00"+(Integer.parseInt(lastCode.substring(lastCode.length()-3))+1);
|
||||||
|
return upCode+codeSeq.substring(codeSeq.length()-3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//예산편성 - 항목변경
|
//예산편성 - 항목변경
|
||||||
public void updateBudgetingList(UserInfo loginUser, BudgetDto.BudgetingUpdateReqeust requestDto){
|
public void updateBudgetingList(UserInfo loginUser, BudgetDto.BudgetingUpdateReqeust requestDto){
|
||||||
// System.out.println(requestDto.getYear()+","+ requestDto.getPrevNameL1()+","+requestDto.getPrevNameL2()+","+requestDto.getPrevNameL3()+","+requestDto.getNameL1()+","+requestDto.getNameL2()+","+requestDto.getNameL3());
|
|
||||||
// UpdateResult result = budgetRepository.callSpUpdateBudgetPlanCodeName( requestDto.getYear(), requestDto.getPrevNameL1(), requestDto.getPrevNameL2(), requestDto.getPrevNameL3(),requestDto.getNameL1(),requestDto.getNameL2(),requestDto.getNameL3(), "OG001", "admin");
|
// UpdateResult result = budgetRepository.callSpUpdateBudgetPlanCodeName( requestDto.getYear(), requestDto.getPrevNameL1(), requestDto.getPrevNameL2(), requestDto.getPrevNameL3(),requestDto.getNameL1(),requestDto.getNameL2(),requestDto.getNameL3(), "OG001", "admin");
|
||||||
BudgetParams params = new BudgetParams();
|
BudgetParams params = new BudgetParams();
|
||||||
params.setYear(requestDto.getYear());
|
params.setYear(requestDto.getYear());
|
||||||
|
|
@ -127,10 +180,7 @@ public class BudgetService {
|
||||||
params.setOrg("OG001");
|
params.setOrg("OG001");
|
||||||
params.setId("admin");
|
params.setId("admin");
|
||||||
UpdateResult result = budgetMapper.callSpUpdateBudgetPlanCodeName(params);
|
UpdateResult result = budgetMapper.callSpUpdateBudgetPlanCodeName(params);
|
||||||
// System.out.println(result.getErrorMessage());
|
|
||||||
// System.out.println(result.getResultCode());
|
|
||||||
// System.out.println(result.getResultCount());
|
|
||||||
// System.out.println(result);
|
|
||||||
if(result.getResultCode().equals("100")) {
|
if(result.getResultCode().equals("100")) {
|
||||||
return;
|
return;
|
||||||
} else if (result.getResultCode().equals("91")) {
|
} else if (result.getResultCode().equals("91")) {
|
||||||
|
|
@ -144,15 +194,15 @@ public class BudgetService {
|
||||||
// System.out.println(requestDto.getNameL1());
|
// System.out.println(requestDto.getNameL1());
|
||||||
// System.out.println(requestDto.getNameL2());
|
// System.out.println(requestDto.getNameL2());
|
||||||
// System.out.println(requestDto.getNameL3());
|
// System.out.println(requestDto.getNameL3());
|
||||||
// UpdateResult result = budgetRepository.callSpDeleteBudgetPlanCodeName(requestDto.getYear(),requestDto.getNameL1(),requestDto.getNameL2(),requestDto.getNameL3(), "OG001", "admin");
|
UpdateResult result = budgetRepository.callSpDeleteBudgetPlanCodeName(requestDto.getYear(),requestDto.getNameL1(),requestDto.getNameL2(),requestDto.getNameL3(), "OG001", "admin");
|
||||||
BudgetParams params = new BudgetParams();
|
// BudgetParams params = new BudgetParams();
|
||||||
params.setYear(requestDto.getYear());
|
// params.setYear(requestDto.getYear());
|
||||||
params.setCode1(requestDto.getNameL1());
|
// params.setCode1(requestDto.getNameL1());
|
||||||
params.setCode2(requestDto.getNameL2());
|
// params.setCode2(requestDto.getNameL2());
|
||||||
params.setCode3(requestDto.getNameL3());
|
// params.setCode3(requestDto.getNameL3());
|
||||||
params.setOrg("OG001");
|
// params.setOrg("OG001");
|
||||||
params.setId("admin");
|
// params.setId("admin");
|
||||||
UpdateResult result = budgetMapper.callSpDeleteBudgetPlanCodeName(params);
|
// UpdateResult result = budgetMapper.callSpDeleteBudgetPlanCodeName(params);
|
||||||
|
|
||||||
// System.out.println(result.getErrorMessage());
|
// System.out.println(result.getErrorMessage());
|
||||||
// System.out.println(result.getResultCode());
|
// System.out.println(result.getResultCode());
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class UnlawfulFishingParam extends BaseModel {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*사용되는 조건인지 확인이 필요함*/
|
||||||
private Integer year;
|
private Integer year;
|
||||||
private Integer month;
|
private Integer month;
|
||||||
private Double tonMin;
|
private Double tonMin;
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@
|
||||||
<select id="callBruteForceDeleteBudgetItem" resultType="UpdateResult" parameterType="BudgetParams">
|
<select id="callBruteForceDeleteBudgetItem" resultType="UpdateResult" parameterType="BudgetParams">
|
||||||
call sp_brute_force_delete_budget_item(#{year}, #{id},NULL,NULL,NULL)
|
call sp_brute_force_delete_budget_item(#{year}, #{id},NULL,NULL,NULL)
|
||||||
</select>
|
</select>
|
||||||
<select id="callSpAddBudgetPlanCodeName" resultType="UpdateResult" parameterType="BudgetParams">
|
|
||||||
call sp_add_budget_plan_codename (#{year}, #{code1}, #{code2}, #{code3}, #{org}, #{id} ,NULL, NULL, NULL)
|
|
||||||
</select>
|
|
||||||
<select id="callSpUpdateBudgetPlanCodeName" resultType="UpdateResult" parameterType="BudgetParams">
|
<select id="callSpUpdateBudgetPlanCodeName" resultType="UpdateResult" parameterType="BudgetParams">
|
||||||
call sp_update_budget_plan_codename(#{year}, #{code1}, #{code2}, #{code3}, #{newCode1}, #{newCode2}, #{newCode3}, #{org},#{id},NULL,NULL,NULL)
|
call sp_update_budget_plan_codename(#{year}, #{code1}, #{code2}, #{code3}, #{newCode1}, #{newCode2}, #{newCode3}, #{org},#{id},NULL,NULL,NULL)
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue