|
@@ -303,82 +303,10 @@ func (s *contractService) Get(treeId int, bidsectionId int, projectId int, treeT
|
|
|
func (s *contractService) GetContract(contractId int) *viewmodels.Contracts {
|
|
|
contract := s.contractDao.Get(contractId)
|
|
|
|
|
|
- contractsVM := makeContractVM(contract)
|
|
|
-
|
|
|
- // contractsVM := &viewmodels.Contracts{}
|
|
|
-
|
|
|
- // id, _ := comm.AesEncrypt(strconv.Itoa(contract.Id), conf.SignSecret)
|
|
|
- // treeId, _ := comm.AesEncrypt(strconv.Itoa(contract.TreeId), conf.SignSecret)
|
|
|
- // bidsectionId, _ := comm.AesEncrypt(strconv.Itoa(contract.BidsectionId), conf.SignSecret)
|
|
|
-
|
|
|
- // contractsVM.Id = id
|
|
|
- // contractsVM.TreeId = treeId
|
|
|
- // contractsVM.ContractsType = contract.ContractsType
|
|
|
- // contractsVM.BidsectionId = bidsectionId
|
|
|
-
|
|
|
- // contractsVM.Name = contract.Name
|
|
|
- // contractsVM.Content = contract.Content
|
|
|
- // contractsVM.Code = contract.Code
|
|
|
- // contractsVM.PartyA = contract.PartyA
|
|
|
- // contractsVM.PartyASigner = contract.PartyASigner
|
|
|
- // contractsVM.PartyB = contract.PartyB
|
|
|
- // contractsVM.PartyBSigner = contract.PartyBSigner
|
|
|
- // contractsVM.Remarks = contract.Remarks
|
|
|
- // contractsVM.Price = contract.Price
|
|
|
- // contractsVM.Returned = contract.Returned
|
|
|
- // contractsVM.Paid = contract.Paid
|
|
|
- // contractsVM.Status = contract.Status
|
|
|
- // contractsVM.Locking = contract.Locking
|
|
|
-
|
|
|
- // contractsVM.CreateTime = contract.CreateTime.Format(conf.SysTimeform)
|
|
|
- // contractsVM.UpdateTime = contract.UpdateTime.Format(conf.SysTimeform)
|
|
|
- // contractsVM.SignerTime = contract.SignerTime.Format(conf.SysTimeform)
|
|
|
-
|
|
|
+ contractsVM := s.makeContractVM(contract)
|
|
|
return &contractsVM
|
|
|
}
|
|
|
|
|
|
-// 构建合同详情视图
|
|
|
-func makeContractVM(contract *models.CmContracts) viewmodels.Contracts {
|
|
|
- contractsVM := viewmodels.Contracts{}
|
|
|
- if contract.Id == 0 {
|
|
|
- return contractsVM
|
|
|
- }
|
|
|
-
|
|
|
- id, _ := comm.AesEncrypt(strconv.Itoa(contract.Id), conf.SignSecret)
|
|
|
- treeId, _ := comm.AesEncrypt(strconv.Itoa(contract.TreeId), conf.SignSecret)
|
|
|
- bidsectionId, _ := comm.AesEncrypt(strconv.Itoa(contract.BidsectionId), conf.SignSecret)
|
|
|
-
|
|
|
- contractsVM.Id = id
|
|
|
- contractsVM.TreeId = treeId
|
|
|
- contractsVM.ContractsType = contract.ContractsType
|
|
|
- contractsVM.BidsectionId = bidsectionId
|
|
|
-
|
|
|
- contractsVM.Name = contract.Name
|
|
|
- contractsVM.Content = contract.Content
|
|
|
- contractsVM.Code = contract.Code
|
|
|
- contractsVM.PartyA = contract.PartyA
|
|
|
- contractsVM.PartyASigner = contract.PartyASigner
|
|
|
- contractsVM.PartyB = contract.PartyB
|
|
|
- contractsVM.PartyBSigner = contract.PartyBSigner
|
|
|
- contractsVM.Remarks = contract.Remarks
|
|
|
- contractsVM.Price = contract.Price
|
|
|
- contractsVM.Returned = contract.Returned
|
|
|
- contractsVM.Paid = contract.Paid
|
|
|
- contractsVM.Status = contract.Status
|
|
|
- contractsVM.Locking = contract.Locking
|
|
|
-
|
|
|
- contractsVM.CreateTime = contract.CreateTime.Format(conf.SysTimeform)
|
|
|
- contractsVM.UpdateTime = contract.UpdateTime.Format(conf.SysTimeform)
|
|
|
- // nilTime := time.Time{}
|
|
|
- // contract.SignerTime != nilTime
|
|
|
-
|
|
|
- if !contract.SignerTime.IsZero() {
|
|
|
- contractsVM.SignerTime = contract.SignerTime.Format(conf.SysTimeform)
|
|
|
- }
|
|
|
-
|
|
|
- return contractsVM
|
|
|
-}
|
|
|
-
|
|
|
// 新增合同
|
|
|
func (s *contractService) Add(contractData *viewmodels.Contracts, projectId int, bidsectionId int, treeId int) error {
|
|
|
// 1. 项目节存在
|
|
@@ -656,3 +584,45 @@ func (s *contractService) getContractTotalAndPrice(bidsectionId int, projectId i
|
|
|
|
|
|
return contractTotal, priceTotal
|
|
|
}
|
|
|
+
|
|
|
+// 构建合同详情视图
|
|
|
+func (s *contractService) makeContractVM(contract *models.CmContracts) viewmodels.Contracts {
|
|
|
+ contractsVM := viewmodels.Contracts{}
|
|
|
+ if contract.Id == 0 {
|
|
|
+ return contractsVM
|
|
|
+ }
|
|
|
+
|
|
|
+ id, _ := comm.AesEncrypt(strconv.Itoa(contract.Id), conf.SignSecret)
|
|
|
+ treeId, _ := comm.AesEncrypt(strconv.Itoa(contract.TreeId), conf.SignSecret)
|
|
|
+ bidsectionId, _ := comm.AesEncrypt(strconv.Itoa(contract.BidsectionId), conf.SignSecret)
|
|
|
+
|
|
|
+ contractsVM.Id = id
|
|
|
+ contractsVM.TreeId = treeId
|
|
|
+ contractsVM.ContractsType = contract.ContractsType
|
|
|
+ contractsVM.BidsectionId = bidsectionId
|
|
|
+
|
|
|
+ contractsVM.Name = contract.Name
|
|
|
+ contractsVM.Content = contract.Content
|
|
|
+ contractsVM.Code = contract.Code
|
|
|
+ contractsVM.PartyA = contract.PartyA
|
|
|
+ contractsVM.PartyASigner = contract.PartyASigner
|
|
|
+ contractsVM.PartyB = contract.PartyB
|
|
|
+ contractsVM.PartyBSigner = contract.PartyBSigner
|
|
|
+ contractsVM.Remarks = contract.Remarks
|
|
|
+ contractsVM.Price = contract.Price
|
|
|
+ contractsVM.Returned = contract.Returned
|
|
|
+ contractsVM.Paid = contract.Paid
|
|
|
+ contractsVM.Status = contract.Status
|
|
|
+ contractsVM.Locking = contract.Locking
|
|
|
+
|
|
|
+ contractsVM.CreateTime = contract.CreateTime.Format(conf.SysTimeform)
|
|
|
+ contractsVM.UpdateTime = contract.UpdateTime.Format(conf.SysTimeform)
|
|
|
+ // nilTime := time.Time{}
|
|
|
+ // contract.SignerTime != nilTime
|
|
|
+
|
|
|
+ if !contract.SignerTime.IsZero() {
|
|
|
+ contractsVM.SignerTime = contract.SignerTime.Format(conf.SysTimeform)
|
|
|
+ }
|
|
|
+
|
|
|
+ return contractsVM
|
|
|
+}
|