|
@@ -24,7 +24,7 @@ import (
|
|
"go.mod/web/viewmodels"
|
|
"go.mod/web/viewmodels"
|
|
)
|
|
)
|
|
|
|
|
|
-//定义项目用户Service接口
|
|
|
|
|
|
+// 定义项目用户Service接口
|
|
type ContractService interface {
|
|
type ContractService interface {
|
|
ValidRuleDepth(ctx iris.Context) (*viewmodels.TreeSectionContract, error)
|
|
ValidRuleDepth(ctx iris.Context) (*viewmodels.TreeSectionContract, error)
|
|
ValidRuleTemplate(ctx iris.Context) (*viewmodels.TreeSectionContract, error)
|
|
ValidRuleTemplate(ctx iris.Context) (*viewmodels.TreeSectionContract, error)
|
|
@@ -64,7 +64,7 @@ type ContractService interface {
|
|
Add(contractData *viewmodels.Contracts, projectId int, bidsectionId int, treeId int) error
|
|
Add(contractData *viewmodels.Contracts, projectId int, bidsectionId int, treeId int) error
|
|
Update(contractData *viewmodels.Contracts, projectId int, bidsectionId int, treeId int) error
|
|
Update(contractData *viewmodels.Contracts, projectId int, bidsectionId int, treeId int) error
|
|
Delete(projectId int, bidsectionId int, treeId int, id int) error
|
|
Delete(projectId int, bidsectionId int, treeId int, id int) error
|
|
- Close(projectId int, bidsectionId int, treeId int, id int, treeType int) error
|
|
|
|
|
|
+ Close(projectId int, bidsectionId int, treeId int, id int, treeType int, settlementCode string) error
|
|
Unlock(projectId int, bidsectionId int, treeId int, id int, treeType int) error
|
|
Unlock(projectId int, bidsectionId int, treeId int, id int, treeType int) error
|
|
GetSurvey(bidsectionId int, projectId int, contractsType int) map[string]interface{}
|
|
GetSurvey(bidsectionId int, projectId int, contractsType int) map[string]interface{}
|
|
|
|
|
|
@@ -85,7 +85,7 @@ type ContractService interface {
|
|
PaidDelete(projectId int, bidsectionId int, contractsId int, id int) error
|
|
PaidDelete(projectId int, bidsectionId int, contractsId int, id int) error
|
|
}
|
|
}
|
|
|
|
|
|
-//返回service操作类
|
|
|
|
|
|
+// 返回service操作类
|
|
type contractService struct {
|
|
type contractService struct {
|
|
treeContractDao *dao.TreeContractDao
|
|
treeContractDao *dao.TreeContractDao
|
|
contractDao *dao.ContractDao
|
|
contractDao *dao.ContractDao
|
|
@@ -95,7 +95,7 @@ type contractService struct {
|
|
annexDao *dao.AnnexDao
|
|
annexDao *dao.AnnexDao
|
|
}
|
|
}
|
|
|
|
|
|
-//创建项目用户service
|
|
|
|
|
|
+// 创建项目用户service
|
|
func NewContractService() ContractService {
|
|
func NewContractService() ContractService {
|
|
return &contractService{
|
|
return &contractService{
|
|
treeContractDao: dao.NewTreeContractDao(datasource.InstanceDbMaster()),
|
|
treeContractDao: dao.NewTreeContractDao(datasource.InstanceDbMaster()),
|
|
@@ -323,7 +323,7 @@ func (s *contractService) ValidRuleContractClose(ctx iris.Context) (*viewmodels.
|
|
return contractsVaild, nil
|
|
return contractsVaild, nil
|
|
}
|
|
}
|
|
|
|
|
|
-//------------------------------------------------------------
|
|
|
|
|
|
+// ------------------------------------------------------------
|
|
// 获得项目节
|
|
// 获得项目节
|
|
func (s *contractService) Get(treeId int, bidsectionId int, projectId int, treeType int) *viewmodels.TreeSectionContract {
|
|
func (s *contractService) Get(treeId int, bidsectionId int, projectId int, treeType int) *viewmodels.TreeSectionContract {
|
|
// 1.获得项目节
|
|
// 1.获得项目节
|
|
@@ -507,7 +507,7 @@ func (s *contractService) Delete(projectId int, bidsectionId int, treeId int, id
|
|
}
|
|
}
|
|
|
|
|
|
// 关闭合同
|
|
// 关闭合同
|
|
-func (s *contractService) Close(projectId int, bidsectionId int, treeId int, id int, treeType int) error {
|
|
|
|
|
|
+func (s *contractService) Close(projectId int, bidsectionId int, treeId int, id int, treeType int, settlementCode string) error {
|
|
// 1. 项目节存在
|
|
// 1. 项目节存在
|
|
contractsTree := s.treeContractDao.Get(treeId, bidsectionId, projectId, treeType)
|
|
contractsTree := s.treeContractDao.Get(treeId, bidsectionId, projectId, treeType)
|
|
if contractsTree.Id == 0 {
|
|
if contractsTree.Id == 0 {
|
|
@@ -524,7 +524,7 @@ func (s *contractService) Close(projectId int, bidsectionId int, treeId int, id
|
|
}
|
|
}
|
|
|
|
|
|
// 关闭合同
|
|
// 关闭合同
|
|
- err := s.contractDao.Close(projectId, bidsectionId, treeId, id)
|
|
|
|
|
|
+ err := s.contractDao.Close(projectId, bidsectionId, treeId, id, settlementCode)
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -553,7 +553,7 @@ func (s *contractService) Unlock(projectId int, bidsectionId int, treeId int, id
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-//获得合同收入概况
|
|
|
|
|
|
+// 获得合同收入概况
|
|
func (s *contractService) GetSurvey(bidsectionId int, projectId int, contractsType int) map[string]interface{} {
|
|
func (s *contractService) GetSurvey(bidsectionId int, projectId int, contractsType int) map[string]interface{} {
|
|
// 1.获得收入合同
|
|
// 1.获得收入合同
|
|
year := time.Now().Year()
|
|
year := time.Now().Year()
|
|
@@ -719,6 +719,7 @@ func (s *contractService) makeContractVM(contract *models.CmContracts) viewmodel
|
|
contractsVM.Paid = contract.Paid
|
|
contractsVM.Paid = contract.Paid
|
|
contractsVM.Status = contract.Status
|
|
contractsVM.Status = contract.Status
|
|
contractsVM.Locking = contract.Locking
|
|
contractsVM.Locking = contract.Locking
|
|
|
|
+ contractsVM.ContractDeductionTotal = contract.ContractDeductionTotal
|
|
|
|
|
|
contractsVM.CreateTime = contract.CreateTime.Format(conf.SysTimeform)
|
|
contractsVM.CreateTime = contract.CreateTime.Format(conf.SysTimeform)
|
|
contractsVM.UpdateTime = contract.UpdateTime.Format(conf.SysTimeform)
|
|
contractsVM.UpdateTime = contract.UpdateTime.Format(conf.SysTimeform)
|