caipin il y a 4 ans
Parent
commit
9b8794304f
2 fichiers modifiés avec 15 ajouts et 9 suppressions
  1. 12 6
      dao/contract_dao.go
  2. 3 3
      web/api/contract_api.go

+ 12 - 6
dao/contract_dao.go

@@ -205,21 +205,27 @@ func (d *ContractDao) Delete(projectId int, bidsectionId int, treeId int, id int
 		return errors.New("合同数据异常,删除失败")
 	}
 
-	// 2.删除项目节上合同信息
-	_, err = session.Exec("UPDATE  cm_tree_contracts SET `contract_name` = '',`contract_code` = '',`contract_price` = 0,`contract_id` = 0,`contract_returned` = 0,`contracts_paid` = 0,`contract_status` = 0 "+
-		",contract_locking=0 where tree_id = ? and project_id = ? and bidsection_id = ? ",
-		treeId, projectId, bidsectionId)
+	// 2.删除项目节上合同信息-需求变更-删除项目节
+	_, err = session.Exec("DELETE FROM `cm_tree_contracts` WHERE tree_id=?  ",
+		treeId)
 	if err != nil {
 		session.Rollback()
-		return errors.New("编辑合同出错-项目节更新失败")
+		return errors.New("编辑合同出错-项目节删除失败")
 	}
+	// _, err = session.Exec("UPDATE  cm_tree_contracts SET `contract_name` = '',`contract_code` = '',`contract_price` = 0,`contract_id` = 0,`contract_returned` = 0,`contracts_paid` = 0,`contract_status` = 0 "+
+	// 	",contract_locking=0 where tree_id = ? and project_id = ? and bidsection_id = ? ",
+	// 	treeId, projectId, bidsectionId)
+	// if err != nil {
+	// 	session.Rollback()
+	// 	return errors.New("编辑合同出错-项目节更新失败")
+	// }
 
 	// 3.删除回款信息
 	_, err = session.Exec("DELETE FROM `cm_contracts_return` WHERE contracts_id=? and project_id=? and bidsection_id=? ",
 		id, projectId, bidsectionId)
 	if err != nil {
 		session.Rollback()
-		return errors.New("编辑合同出错-项目节更新失败")
+		return errors.New("编辑合同出错-删除回款信息失败")
 	}
 
 	// 4.删除附件-TODO

+ 3 - 3
web/api/contract_api.go

@@ -385,11 +385,11 @@ func (c *ContractApi) Delete() {
 		return
 	}
 
-	//2.请求当前项目信息
+	//2.请求当前项目信息--需求变更 删除合同要删除项目节,不需要返回项目节信息
 	// 1.验证项目节ID
-	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt, 0)
+	// sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt, 0)
 
-	c.Ctx.JSON(iris.Map{"code": 0, "msg": "删除成功", "section": sectionDetail})
+	c.Ctx.JSON(iris.Map{"code": 0, "msg": "删除成功", "section": ""})
 }
 
 // @Summary 关闭合同