|
@@ -2,7 +2,7 @@
|
|
|
* @description: 合同管理 -项目节相关API
|
|
|
* @Author: CP
|
|
|
* @Date: 2020-10-26 15:27:04
|
|
|
- * @FilePath: \construction_management\web\api\contract_section_tree_api.go
|
|
|
+ * @FilePath: \design_quantity\web\api\contract_section_tree_api.go
|
|
|
*/
|
|
|
package api
|
|
|
|
|
@@ -331,6 +331,58 @@ func (c *ContractApi) PostSectionSave() {
|
|
|
c.Ctx.JSON(iris.Map{"code": 0, "msg": "修改成功", "section": sectionDetail})
|
|
|
}
|
|
|
|
|
|
+// @Summary 修改合同项目节 编号
|
|
|
+// @Tags 合同管理-项目节
|
|
|
+// @Description 修改合同项目节 编号
|
|
|
+// @Accept json
|
|
|
+// @Produce json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param id body string true "项目节ID"
|
|
|
+// @Param bidsectionId body string true "标段ID"
|
|
|
+// @Param treeType body string true "项目节类型(0收入1支出) 不传为0" default(0)
|
|
|
+// @Param code body string true "项目节名称"
|
|
|
+// @Success 200 {string} string "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
|
|
|
+// @Router /api/contract/section/code [post]
|
|
|
+func (c *ContractApi) PostSectionCode() {
|
|
|
+ // 获得模板号
|
|
|
+ sectionData, err := c.ServiceContract.ValidRuleSectionAdd(c.Ctx)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": "解析参数出错"})
|
|
|
+ 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(sectionData.BidsectionId)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if !(sectionData.TreeType == 0 || sectionData.TreeType == 1) {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": "合同项目节类型只能是0或者1"})
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err = c.ServiceContract.SectionSave(sectionData, bidsectionId, projectIdInt, sectionData.TreeType)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //2.请求当前项目信息
|
|
|
+ // 1.验证项目节ID
|
|
|
+ treeId, _ := utils.GetDecryptId(sectionData.Id)
|
|
|
+ sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt, sectionData.TreeType)
|
|
|
+
|
|
|
+ c.Ctx.JSON(iris.Map{"code": 0, "msg": "修改成功", "section": sectionDetail})
|
|
|
+}
|
|
|
+
|
|
|
// @Summary 删除 合同项目节
|
|
|
// @Tags 合同管理-项目节
|
|
|
// @Description 删除 合同项目节
|