caipin 4 years ago
parent
commit
e35935a219

+ 11 - 0
dao/contract_dao.go

@@ -41,6 +41,17 @@ func (d *ContractDao) Get(id int) *models.CmContracts {
 	return data
 	return data
 }
 }
 
 
+// 获得本项目的合同项目节
+func (d *ContractDao) GetType(bidsectionId int, projectId int, contractsType int) []models.CmContracts {
+
+	datalist := make([]models.CmContracts, 0)
+	_ = d.engine.
+		Where("project_id=? and bidsection_id=? and contracts_type=? ", projectId, bidsectionId, contractsType).
+		Find(&datalist)
+
+	return datalist
+}
+
 // 合同
 // 合同
 func (d *ContractDao) GetInProjectAndBidsection(id int, projectId int, bidsectionId int) *models.CmContracts {
 func (d *ContractDao) GetInProjectAndBidsection(id int, projectId int, bidsectionId int) *models.CmContracts {
 	data := &models.CmContracts{}
 	data := &models.CmContracts{}

+ 1 - 0
go.mod

@@ -25,6 +25,7 @@ require (
 	github.com/kataras/iris/v12 v12.2.0-alpha
 	github.com/kataras/iris/v12 v12.2.0-alpha
 	github.com/kataras/tunnel v0.0.2 // indirect
 	github.com/kataras/tunnel v0.0.2 // indirect
 	github.com/kirinlabs/HttpRequest v1.0.5
 	github.com/kirinlabs/HttpRequest v1.0.5
+	github.com/leekchan/accounting v1.0.0
 	github.com/mattn/go-colorable v0.1.7 // indirect
 	github.com/mattn/go-colorable v0.1.7 // indirect
 	github.com/nats-io/nats-server/v2 v2.1.8 // indirect
 	github.com/nats-io/nats-server/v2 v2.1.8 // indirect
 	github.com/smartystreets/goconvey v1.6.4 // indirect
 	github.com/smartystreets/goconvey v1.6.4 // indirect

+ 5 - 0
go.sum

@@ -51,6 +51,7 @@ github.com/chris-ramon/douceur v0.2.0 h1:IDMEdxlEUUBYBKE4z/mJnFyVXox+MjuEVDJNN27
 github.com/chris-ramon/douceur v0.2.0/go.mod h1:wDW5xjJdeoMm1mRt4sD4c/LbF/mWdEpRXQKjTR8nIBE=
 github.com/chris-ramon/douceur v0.2.0/go.mod h1:wDW5xjJdeoMm1mRt4sD4c/LbF/mWdEpRXQKjTR8nIBE=
 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
 github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
+github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
 github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
 github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
 github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
 github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
 github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
 github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
@@ -271,6 +272,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
 github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
 github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/leekchan/accounting v1.0.0 h1:+Wd7dJ//dFPa28rc1hjyy+qzCbXPMR91Fb6F1VGTQHg=
+github.com/leekchan/accounting v1.0.0/go.mod h1:3timm6YPhY3YDaGxl0q3eaflX0eoSx3FXn7ckHe4tO0=
 github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
 github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
 github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
 github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
@@ -330,6 +333,7 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
 github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
 github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -355,6 +359,7 @@ github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiy
 github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g=
 github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g=
 github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
 github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
 github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
 github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
+github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE=
 github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
 github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
 github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
 github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
 github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
 github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=

+ 36 - 0
services/contract_service.go

@@ -15,6 +15,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/kataras/iris/v12"
 	"github.com/kataras/iris/v12"
+	"github.com/leekchan/accounting"
 	"go.mod/comm"
 	"go.mod/comm"
 	"go.mod/conf"
 	"go.mod/conf"
 	"go.mod/dao"
 	"go.mod/dao"
@@ -59,6 +60,7 @@ type ContractService interface {
 	Delete(projectId int, bidsectionId int, treeId int, id int) error
 	Delete(projectId int, bidsectionId int, treeId int, id int) error
 	Close(projectId int, bidsectionId int, treeId int, id int) error
 	Close(projectId int, bidsectionId int, treeId int, id int) error
 	Unlock(projectId int, bidsectionId int, treeId int, id int) error
 	Unlock(projectId int, bidsectionId int, treeId int, id int) error
+	GetIncomeSurvey(bidsectionId int, projectId int) map[string]interface{}
 
 
 	ReturnCreate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, projectAccountId int) error
 	ReturnCreate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, projectAccountId int) error
 	ReturnUpdate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, id int) error
 	ReturnUpdate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, id int) error
@@ -513,6 +515,40 @@ func (s *contractService) Unlock(projectId int, bidsectionId int, treeId int, id
 	return nil
 	return nil
 }
 }
 
 
+//获得合同收入概况
+func (s *contractService) GetIncomeSurvey(bidsectionId int, projectId int) map[string]interface{} {
+	// 1.获得收入合同
+	incomeList := s.contractDao.GetType(bidsectionId, projectId, 1)
+	totalContractPrice := 0.00
+	totalReturnPrice := 0.00
+	performNumber := 0
+	closeNumber := 0
+	uncloseNumber := 0
+
+	for _, item := range incomeList {
+		contractPrice, _ := strconv.ParseFloat(item.Price, 64)
+		totalContractPrice = totalContractPrice + contractPrice
+		returnPrice, _ := strconv.ParseFloat(item.Returned, 64)
+		totalReturnPrice = totalReturnPrice + returnPrice
+		if item.Status == 0 {
+			performNumber = performNumber + 1
+		} else if item.Status == 1 {
+			uncloseNumber = uncloseNumber + 1
+		} else if item.Status == 2 {
+			closeNumber = closeNumber + 1
+		}
+	}
+	totalContractPrice, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", totalContractPrice), 64)
+	fmt.Println(totalContractPrice)
+	// surveryData := make(map[string]interface{},0)
+	ac := accounting.Accounting{Symbol: "", Precision: 2}
+	surveryData := map[string]interface{}{
+		"totalContractPrice": ac.FormatMoney(totalContractPrice),
+	}
+
+	return surveryData
+}
+
 // 获得合同总数量和总金额
 // 获得合同总数量和总金额
 func (s *contractService) getContractTotalAndPrice(bidsectionId int, projectId int, treeType int) (contractTotal int, priceTotal float64) {
 func (s *contractService) getContractTotalAndPrice(bidsectionId int, projectId int, treeType int) (contractTotal int, priceTotal float64) {
 
 

+ 47 - 0
web/api/contract_api.go

@@ -470,3 +470,50 @@ func (c *ContractApi) PostUnlock() {
 	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
 	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
 	c.Ctx.JSON(iris.Map{"code": 0, "msg": "解锁成功", "section": sectionDetail})
 	c.Ctx.JSON(iris.Map{"code": 0, "msg": "解锁成功", "section": sectionDetail})
 }
 }
+
+// @Summary 合同概述
+// @Tags 合同管理
+// @Description 合同概述
+// @Accept  json
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param   bidsectionId     path    string     true        "标段ID"
+// @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,msg:错误信息}"
+// @Router /api/contract/survey [get]
+func (c *ContractApi) GetSurvey() {
+	sectionData := viewmodels.Contracts{}
+	err := c.Ctx.ReadForm(&sectionData)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
+		return
+	}
+	err = sectionData.ValidateBidsectionId()
+	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": "ReadJSON转换异常,请检查参数"})
+		return
+	}
+
+	// 项目ID
+	projectId, err := utils.GetProjectId(c.Ctx)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
+		return
+	}
+
+	incomeData := c.ServiceContract.GetIncomeSurvey(bidsectionId, projectId)
+
+	c.Ctx.JSON(iris.Map{
+		"code":       0,
+		"msg":        "",
+		"incomeData": incomeData,
+		// "contract":   contractDetail,
+	})
+
+}

+ 7 - 6
web/api/contract_section_tree_api.go

@@ -21,7 +21,7 @@ import (
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
 // @Param   id     body    string     true        "项目节ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
-// @Param   treeType     body    string     true        "项目节类型(0合同1支出) 不传为0" default(0)
+// @Param   treeType     body    string     true        "项目节类型(0收入1支出) 不传为0" default(0)
 // @Param   operation     body    string     true        "操作名称"  default(upDepth)
 // @Param   operation     body    string     true        "操作名称"  default(upDepth)
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/depth [post]
 // @Router /api/contract/section/depth [post]
@@ -76,7 +76,7 @@ func (c *ContractApi) PostSectionDepth() {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
 // @Param   id     body    string     true        "项目节ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
-// @Param   treeType     body    string     true        "项目节类型(0合同1支出) 不传为0" default(0)
+// @Param   treeType     body    string     true        "项目节类型(0收入1支出) 不传为0" default(0)
 // @Param   operation     body    string     true        "操作名称"  default(upSerial)
 // @Param   operation     body    string     true        "操作名称"  default(upSerial)
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/serial [post]
 // @Router /api/contract/section/serial [post]
@@ -131,7 +131,7 @@ func (c *ContractApi) PostSectionSerial() {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
 // @Param   id     body    string     true        "项目节ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
-// @Param   treeType     body    string     true        "项目节类型(0合同1支出) 不传为0" default(0)
+// @Param   treeType     body    string     true        "项目节类型(0收入1支出) 不传为0" default(0)
 // @Param   serial     body    int     true        "操作名称"
 // @Param   serial     body    int     true        "操作名称"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/serial/update [post]
 // @Router /api/contract/section/serial/update [post]
@@ -186,7 +186,7 @@ func (c *ContractApi) PostSectionSerialUpdate() {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Param   templateNumber     body    int     true        "模板号" default(1)
 // @Param   templateNumber     body    int     true        "模板号" default(1)
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
-// @Param   treeType     body    string     true        "项目节类型(0合同1支出) 不传为0" default(0)
+// @Param   treeType     body    string     true        "项目节类型(0收入1支出) 不传为0" default(0)
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/template [post]
 // @Router /api/contract/section/template [post]
 func (c *ContractApi) PostSectionTemplate() {
 func (c *ContractApi) PostSectionTemplate() {
@@ -242,7 +242,7 @@ func (c *ContractApi) PostSectionTemplate() {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
 // @Param   id     body    string     true        "项目节ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
-// @Param   treeType     body    string     true        "项目节类型(0合同1支出) 不传为0" default(0)
+// @Param   treeType     body    string     true        "项目节类型(0收入1支出) 不传为0" default(0)
 // @Param   name     body    string     true        "项目节名称"
 // @Param   name     body    string     true        "项目节名称"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/add [post]
 // @Router /api/contract/section/add [post]
@@ -288,7 +288,7 @@ func (c *ContractApi) PostSectionAdd() {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
 // @Param   id     body    string     true        "项目节ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
-// @Param   treeType     body    string     true        "项目节类型(0合同1支出) 不传为0" default(0)
+// @Param   treeType     body    string     true        "项目节类型(0收入1支出) 不传为0" default(0)
 // @Param   name     body    string     true        "项目节名称"
 // @Param   name     body    string     true        "项目节名称"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/save [post]
 // @Router /api/contract/section/save [post]
@@ -340,6 +340,7 @@ func (c *ContractApi) PostSectionSave() {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
 // @Param   id     body    string     true        "项目节ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   bidsectionId     body    string     true        "标段ID"
+// @Param   treeType     body    string     true        "项目节类型(0收入1支出) 不传为0" default(0)
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section [delete]
 // @Router /api/contract/section [delete]
 func (c *ContractApi) DeleteSection() {
 func (c *ContractApi) DeleteSection() {

+ 6 - 0
web/viewmodels/contract.go

@@ -70,3 +70,9 @@ func (l Contracts) ValidateDel() error {
 		validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
 		validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
 	)
 	)
 }
 }
+
+func (l Contracts) ValidateBidsectionId() error {
+	return validation.ValidateStruct(&l,
+		validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
+	)
+}