|  | @@ -9,6 +9,7 @@ package api
 | 
												
													
														
															|  |  import (
 |  |  import (
 | 
												
													
														
															|  |  	"github.com/kataras/iris/v12"
 |  |  	"github.com/kataras/iris/v12"
 | 
												
													
														
															|  |  	"go.mod/lib"
 |  |  	"go.mod/lib"
 | 
												
													
														
															|  | 
 |  | +	"go.mod/models"
 | 
												
													
														
															|  |  	"go.mod/services"
 |  |  	"go.mod/services"
 | 
												
													
														
															|  |  	"go.mod/web/utils"
 |  |  	"go.mod/web/utils"
 | 
												
													
														
															|  |  	"go.mod/web/viewmodels"
 |  |  	"go.mod/web/viewmodels"
 | 
												
											
												
													
														
															|  | @@ -50,7 +51,7 @@ func (c *ContractApi) GetFolder() {
 | 
												
													
														
															|  |  	})
 |  |  	})
 | 
												
													
														
															|  |  }
 |  |  }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -// @Summary 获得合同信息
 |  | 
 | 
												
													
														
															|  | 
 |  | +// @Summary 获得标段收入-项目节信息
 | 
												
													
														
															|  |  // @Tags 合同管理
 |  |  // @Tags 合同管理
 | 
												
													
														
															|  |  // @Description 未设置合同项目节 返回项目节模板信息
 |  |  // @Description 未设置合同项目节 返回项目节模板信息
 | 
												
													
														
															|  |  // @Accept  json
 |  |  // @Accept  json
 | 
												
											
												
													
														
															|  | @@ -58,8 +59,8 @@ func (c *ContractApi) GetFolder() {
 | 
												
													
														
															|  |  // @Security ApiKeyAuth
 |  |  // @Security ApiKeyAuth
 | 
												
													
														
															|  |  // @Param   bidsectionId     path    string     true        "标段ID"
 |  |  // @Param   bidsectionId     path    string     true        "标段ID"
 | 
												
													
														
															|  |  // @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,data:viewmodels.TreeSectionContract,msg:错误信息}"
 |  |  // @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,data:viewmodels.TreeSectionContract,msg:错误信息}"
 | 
												
													
														
															|  | -// @Router /api/contract/income [get]
 |  | 
 | 
												
													
														
															|  | -func (c *ContractApi) GetIncome() {
 |  | 
 | 
												
													
														
															|  | 
 |  | +// @Router /api/contract/income/section/all [get]
 | 
												
													
														
															|  | 
 |  | +func (c *ContractApi) GetIncomeSectionAll() {
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  	sectionData := viewmodels.TreeSectionContract{}
 |  |  	sectionData := viewmodels.TreeSectionContract{}
 | 
												
													
														
															|  |  	err := c.Ctx.ReadForm(§ionData)
 |  |  	err := c.Ctx.ReadForm(§ionData)
 | 
												
											
												
													
														
															|  | @@ -115,7 +116,7 @@ func (c *ContractApi) GetIncome() {
 | 
												
													
														
															|  |  	}
 |  |  	}
 | 
												
													
														
															|  |  }
 |  |  }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -// @Summary 获得合同详情和项目节详情
 |  | 
 | 
												
													
														
															|  | 
 |  | +// @Summary 单个合同详情和项目节详情
 | 
												
													
														
															|  |  // @Tags 合同管理
 |  |  // @Tags 合同管理
 | 
												
													
														
															|  |  // @Description 获得合同详情和项目节详情
 |  |  // @Description 获得合同详情和项目节详情
 | 
												
													
														
															|  |  // @Accept  json
 |  |  // @Accept  json
 | 
												
											
												
													
														
															|  | @@ -124,12 +125,12 @@ func (c *ContractApi) GetIncome() {
 | 
												
													
														
															|  |  // @Param   id     path    string     true        "项目节ID"
 |  |  // @Param   id     path    string     true        "项目节ID"
 | 
												
													
														
															|  |  // @Param   bidsectionId     path    string     true        "标段ID"
 |  |  // @Param   bidsectionId     path    string     true        "标段ID"
 | 
												
													
														
															|  |  // @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,isContract:是否有合同(包含孩子们),section:viewmodels.TreeSectionContract,msg:错误信息}"
 |  |  // @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,isContract:是否有合同(包含孩子们),section:viewmodels.TreeSectionContract,msg:错误信息}"
 | 
												
													
														
															|  | -// @Router /api/contract [get]
 |  | 
 | 
												
													
														
															|  | -func (c *ContractApi) Get() {
 |  | 
 | 
												
													
														
															|  | 
 |  | +// @Router /api/contract/income [get]
 | 
												
													
														
															|  | 
 |  | +func (c *ContractApi) GetIncome() {
 | 
												
													
														
															|  |  	// 1.规则验证
 |  |  	// 1.规则验证
 | 
												
													
														
															|  |  	sectionData, err := c.ServiceContract.ValidRuleGet(c.Ctx)
 |  |  	sectionData, err := c.ServiceContract.ValidRuleGet(c.Ctx)
 | 
												
													
														
															|  |  	if err != nil {
 |  |  	if err != nil {
 | 
												
													
														
															|  | -		c.Ctx.JSON(iris.Map{"code": -1, "msg": "解析参数出错"})
 |  | 
 | 
												
													
														
															|  | 
 |  | +		c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
 | 
												
													
														
															|  |  		return
 |  |  		return
 | 
												
													
														
															|  |  	}
 |  |  	}
 | 
												
													
														
															|  |  
 |  |  
 | 
												
											
												
													
														
															|  | @@ -142,13 +143,13 @@ func (c *ContractApi) Get() {
 | 
												
													
														
															|  |  	// 3.标段ID
 |  |  	// 3.标段ID
 | 
												
													
														
															|  |  	bidsectionId, err := utils.GetDecryptId(sectionData.BidsectionId)
 |  |  	bidsectionId, err := utils.GetDecryptId(sectionData.BidsectionId)
 | 
												
													
														
															|  |  	if err != nil {
 |  |  	if err != nil {
 | 
												
													
														
															|  | -		c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
 |  | 
 | 
												
													
														
															|  | 
 |  | +		c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
 | 
												
													
														
															|  |  		return
 |  |  		return
 | 
												
													
														
															|  |  	}
 |  |  	}
 | 
												
													
														
															|  |  	// 4.树ID
 |  |  	// 4.树ID
 | 
												
													
														
															|  |  	treeId, err := utils.GetDecryptId(sectionData.Id)
 |  |  	treeId, err := utils.GetDecryptId(sectionData.Id)
 | 
												
													
														
															|  |  	if err != nil {
 |  |  	if err != nil {
 | 
												
													
														
															|  | -		c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
 |  | 
 | 
												
													
														
															|  | 
 |  | +		c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
 | 
												
													
														
															|  |  		return
 |  |  		return
 | 
												
													
														
															|  |  	}
 |  |  	}
 | 
												
													
														
															|  |  
 |  |  
 | 
												
											
												
													
														
															|  | @@ -161,24 +162,23 @@ func (c *ContractApi) Get() {
 | 
												
													
														
															|  |  	if len(contractList) == 0 {
 |  |  	if len(contractList) == 0 {
 | 
												
													
														
															|  |  		isContract = false
 |  |  		isContract = false
 | 
												
													
														
															|  |  	}
 |  |  	}
 | 
												
													
														
															|  | -	// // 获得合同详情
 |  | 
 | 
												
													
														
															|  | -	// contractId, err := utils.GetDecryptId(section.ContractId)
 |  | 
 | 
												
													
														
															|  | -	// if err != nil {
 |  | 
 | 
												
													
														
															|  | -	// 	c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
 |  | 
 | 
												
													
														
															|  | -	// 	return
 |  | 
 | 
												
													
														
															|  | -	// }
 |  | 
 | 
												
													
														
															|  | -	// contract := c.ServiceContract.GetContract(contractId)
 |  | 
 | 
												
													
														
															|  | 
 |  | +	// 获得合同详情
 | 
												
													
														
															|  | 
 |  | +	contractId, _ := utils.GetDecryptId(section.ContractId)
 | 
												
													
														
															|  | 
 |  | +	contract := &models.CmContracts{}
 | 
												
													
														
															|  | 
 |  | +	if contractId != 0 {
 | 
												
													
														
															|  | 
 |  | +		contract = c.ServiceContract.GetContract(contractId)
 | 
												
													
														
															|  | 
 |  | +	}
 | 
												
													
														
															|  |  	c.Ctx.JSON(iris.Map{
 |  |  	c.Ctx.JSON(iris.Map{
 | 
												
													
														
															|  |  		"code":       0,
 |  |  		"code":       0,
 | 
												
													
														
															|  |  		"msg":        "",
 |  |  		"msg":        "",
 | 
												
													
														
															|  |  		"section":    section,
 |  |  		"section":    section,
 | 
												
													
														
															|  | -		"isContract": isContract,
 |  | 
 | 
												
													
														
															|  | -		// "contract":   contract,
 |  | 
 | 
												
													
														
															|  | 
 |  | +		"isContract": isContract, //该项目节(包含子孙)下是否有合同
 | 
												
													
														
															|  | 
 |  | +		"contract":   contract,
 | 
												
													
														
															|  |  	})
 |  |  	})
 | 
												
													
														
															|  |  }
 |  |  }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  // 新增合同
 |  |  // 新增合同
 | 
												
													
														
															|  | -func (c *ContractApi) PostCreate() {
 |  | 
 | 
												
													
														
															|  | 
 |  | +func (c *ContractApi) PostIncomeCreate() {
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  	// // 获得模板号
 |  |  	// // 获得模板号
 | 
												
													
														
															|  |  	// sectionData, err := c.ServiceContract.ValidRuleAdd(c.Ctx)
 |  |  	// sectionData, err := c.ServiceContract.ValidRuleAdd(c.Ctx)
 |