caipin 4 éve
szülő
commit
cb357212b2
2 módosított fájl, 7 hozzáadás és 2 törlés
  1. 2 2
      dao/contract_return_dao.go
  2. 5 0
      services/contract_return_service.go

+ 2 - 2
dao/contract_return_dao.go

@@ -141,13 +141,13 @@ func (d *ContractReturnDao) UpdateTotalPrice(projectId int, bidsectionId int, co
 	}
 
 	// 2.更新合同表 合同下回款总金额
-	_, err = session.Exec("UPDATE  cm_contracts SET `returned` = ? and status = ? where id = ? ", contractsPrice, contractStatus, contractsId)
+	_, err = session.Exec("UPDATE  cm_contracts SET `returned` = ? , status = ? where id = ? ", contractsPrice, contractStatus, contractsId)
 	if err != nil {
 		session.Rollback()
 		return errors.New("金额更新失败")
 	}
 	// 3.更新项目节 合同下回款总金额
-	_, err = session.Exec("UPDATE  cm_tree_contracts SET `contract_returned` = ? and contract_status = ? where project_id = ? and bidsection_id=? and contract_id=? ",
+	_, err = session.Exec("UPDATE  cm_tree_contracts SET `contract_returned` = ? , contract_status = ? where project_id = ? and bidsection_id=? and contract_id=? ",
 		contractsPrice, contractStatus, projectId, bidsectionId, contractsId)
 	if err != nil {
 		session.Rollback()

+ 5 - 0
services/contract_return_service.go

@@ -225,6 +225,11 @@ func (s *contractService) ReturnDelete(projectId int, bidsectionId int, contract
 		return errors.New("未找到回款")
 	}
 
+	// 3.合同锁定 不能删除
+	if contract.Locking == 1 {
+		return errors.New("该合同已锁定")
+	}
+
 	// 1-2. 删除回款
 	err := s.contractReturnDao.Delete(id, contractsId, bidsectionId, projectId)
 	if err != nil {