|
@@ -179,8 +179,57 @@ func (c *ContractApi) GetIncome() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// 新增合同
|
|
|
+// @Summary 新增合同
|
|
|
+// @Tags 合同管理
|
|
|
+// @Description 新增合同
|
|
|
+// @Accept json
|
|
|
+// @Produce json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param treeId path string true "项目节ID"
|
|
|
+// @Param bidsectionId path string true "标段ID"
|
|
|
+// @Param code path string true "合同编号"
|
|
|
+// @Param name path string true "合同名称"
|
|
|
+// @Param contractsType path int true "合同类型(1)"
|
|
|
+// @Param price path string true "合同金额"
|
|
|
+// @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,msg:错误信息}"
|
|
|
+// @Router /api/contract/income/create [post]
|
|
|
func (c *ContractApi) PostIncomeCreate() {
|
|
|
+ // 获得模板号
|
|
|
+ contractData, err := c.ServiceContract.ValidRuleContractAdd(c.Ctx)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 项目ID
|
|
|
+ projectIdInt, err := utils.GetProjectId(c.Ctx)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 标段ID
|
|
|
+ bidsectionId, err := utils.GetDecryptId(contractData.BidsectionId)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 项目节ID
|
|
|
+ treeId, err := utils.GetDecryptId(contractData.TreeId)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err = c.ServiceContract.Add(contractData, projectIdInt, bidsectionId, treeId)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.Ctx.JSON(iris.Map{"code": 0, "msg": "新增成功"})
|
|
|
+}
|
|
|
+
|
|
|
+// 编辑合同
|
|
|
+func (c *ContractApi) PostIncomeUpdate() {
|
|
|
|
|
|
// 获得模板号
|
|
|
contractData, err := c.ServiceContract.ValidRuleContractAdd(c.Ctx)
|