Browse Source

后端: 合同评价 按年度查询、计算

baichengfei 4 years ago
parent
commit
4e4e770dad

+ 5 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contractReview.go

@@ -55,6 +55,7 @@ func (this *OilContractReviewController) GetEntityList() {
 	CreateOn := this.GetString("CreateOn")
 	SupplierName := this.GetString("SupplierName")
 	Status := this.GetString("Status")
+	Year := this.GetString("Year")
 
 	if Id != "" {
 		where = where + " and r.Id like '%" + Id + "%'"
@@ -105,6 +106,10 @@ func (this *OilContractReviewController) GetEntityList() {
 		}
 	}
 
+	if Year != "" {
+		where = where + " and r.CreateOn>='" + Year + "-01-01 00:00:00' and r.CreateOn<='" + Year + "-12-31 23:59:59' "
+	}
+
 	//超级管理员和有查看所有数据权限的用户不加条件
 	svcPerm := permission.GetPermissionService(utils.DBE)
 	isauth := svcPerm.IsAuthorized(this.User.Id, "oil_contract.Review.AllRecord")

+ 16 - 4
src/dashoo.cn/backend/api/controllers/oilcontract/contractSumScore.go

@@ -148,6 +148,7 @@ func (this *OilContractSumScoreController) GetComputeEntityList() {
 	asc := false
 	Order := this.GetString("Order")
 	Prop := this.GetString("Prop")
+	Year := this.GetString("Year", "")
 	if Order != "" && Prop != "" {
 		orderby = Prop
 		if Order == "asc" {
@@ -189,10 +190,15 @@ func (this *OilContractSumScoreController) GetComputeEntityList() {
 		having = "ROUND(sum(case when items.ParentId = 0 AND items.Type = 1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type = 1 then 1 else 0 end),2) < " + pass + " "
 	}
 	// 今年的汇总
-	year := strconv.Itoa(time.Now().Year())
+	year := ""
+	if Year != "" {
+		year = Year
+	} else {
+		year = strconv.Itoa(time.Now().Year())
+	}
 	month := "01"
 	day := "01"
-	where = where + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' "
+	where = where + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' and review.CreateOn <= '" + year + "-12-31 23:59:59' "
 
 	//if CreateOn != "" {
 	//	dates := strings.Split(CreateOn, ",")
@@ -225,16 +231,22 @@ func (this *OilContractSumScoreController) GetComputeEntityList() {
 func (this *OilContractSumScoreController) GetComputeEntity() {
 	Id := this.Ctx.Input.Param(":id")
 	ContractClass := this.GetString("ContractClass", "01")
+	Year := this.GetString("Year", "")
 	where := " contract.SupplierId = " + Id
 	where = where + " and review.Status='8' "
 	if ContractClass != "" {
 		where = where + " and contract.ContractClass = '" + ContractClass + "'"
 	}
 	// 今年的汇总
-	year := strconv.Itoa(time.Now().Year())
+	year := ""
+	if Year != "" {
+		year = Year
+	} else {
+		year = strconv.Itoa(time.Now().Year())
+	}
 	month := "01"
 	day := "01"
-	where = where + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' "
+	where = where + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' and review.CreateOn <= '" + year + "-12-31 23:59:59' "
 	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
 	var entity contractSumScore.OilContractComputeSumScoreVo
 	entity = svc.GetComputeEntityBytbl(where)