2
3
Quellcode durchsuchen

'评论明细接口修改'

Yikoo vor 5 Jahren
Ursprung
Commit
beb5051849

+ 1 - 1
src/dashoo.cn/backend/api/business/oilcontract/contractEvaluationItems/contractEvaluationItems.go

@@ -23,7 +23,7 @@ type EvaluationItems struct {
 	Id             int       `json:"Id"`
 	ParentId       int       `json:"ParentId"`
 	SequenceNo     string    `json:"SequenceNo"`
-	Content        string    `json:"content"`
+	Content        string    `json:"Content"`
 	NormalScore    string    `json:"NormalScore"`
 	LevelCode      int       `json:"LevelCode"`
 	Remark         string    `json:"Remark"`

+ 2 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractReview/contractReview.go

@@ -24,6 +24,8 @@ type OilContractReview struct {
 	ModifiedOn        time.Time `json:"ModifiedOn" xorm:"DATETIME 'ModifiedOn'"`
 	ModifiedUserId    int       `json:"ModifiedUserId" xorm:"INT(11) 'ModifiedUserId'"`
 	ModifiedBy        string    `json:"ModifiedBy" xorm:"VARCHAR(50) 'ModifiedBy'"`
+	UnitId            int       `json:"UnitId" xorm:"INT(11) 'UnitId'"`
+	Unit              string    `json:"Unit" xorm:"VARCHAR(50) 'Unit'"`
 }
 type OilContractReviewListVo struct {
 	Id                int       `json:"Id"`

+ 11 - 11
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScoreService.go

@@ -30,17 +30,17 @@ func (s *OilContractSumScoreService) GetPagingComputeEntitiesWithOrderBytbl(page
 	sqlCount += ` ) t `
 
 	var sql string
-	sql =  `select contract.SupplierId,contract.SupplierName,sum(items.Score) as Score, `
-	sql += ` sum(case when items.SequenceNo in  ('1') then items.Score else 0 end) Score1,  `
-	sql += ` sum(case when items.SequenceNo in  ('2') then items.Score else 0 end) Score2,  `
-	sql += ` sum(case when items.SequenceNo in  ('3') then items.Score else 0 end) Score3,  `
-	sql += ` sum(case when items.SequenceNo in  ('4') then items.Score else 0 end) Score4,  `
-	sql += ` sum(case when items.SequenceNo in  ('5') then items.Score else 0 end) Score5,  `
-	sql += ` sum(case when items.SequenceNo in  ('6') then items.Score else 0 end) Score6,  `
-	sql += ` sum(case when items.SequenceNo in  ('7') then items.Score else 0 end) Score7,  `
-	sql += ` sum(case when items.SequenceNo in  ('8') then items.Score else 0 end) Score8,  `
-	sql += ` sum(case when items.SequenceNo in  ('9') then items.Score else 0 end) Score9,  `
-	sql += ` case when sum(items.Score) <60 then '不合格' when sum(items.Score) <80 then '合格' else '优秀' end as Evaluate `
+	sql =  `select contract.SupplierId,contract.SupplierName,count(review.id) as count,sum(items.Score)/count(review.id) as Score, `
+	sql += ` sum(case when items.SequenceNo in  ('1') then items.Score else 0 end)/count(review.id) Score1,  `
+	sql += ` sum(case when items.SequenceNo in  ('2') then items.Score else 0 end)/count(review.id) Score2,  `
+	sql += ` sum(case when items.SequenceNo in  ('3') then items.Score else 0 end)/count(review.id) Score3,  `
+	sql += ` sum(case when items.SequenceNo in  ('4') then items.Score else 0 end)/count(review.id) Score4,  `
+	sql += ` sum(case when items.SequenceNo in  ('5') then items.Score else 0 end)/count(review.id) Score5,  `
+	sql += ` sum(case when items.SequenceNo in  ('6') then items.Score else 0 end)/count(review.id) Score6,  `
+	sql += ` sum(case when items.SequenceNo in  ('7') then items.Score else 0 end)/count(review.id) Score7,  `
+	sql += ` sum(case when items.SequenceNo in  ('8') then items.Score else 0 end)/count(review.id) Score8,  `
+	sql += ` sum(case when items.SequenceNo in  ('9') then items.Score else 0 end)/count(review.id) Score9,  `
+	sql += ` case when sum(items.Score)/count(review.id) <60 then '不合格' when sum(items.Score)/count(review.id) <80 then '合格' else '优秀' end as Evaluate `
 	sql += ` from ` + controllers.OilContractReviewName + ` review `
 	sql += ` left join ` + controllers.OilContractName + ` contract on review.ContractId=contract.id `
 	sql += ` left join ` + controllers.OilContractEvaluationItemsName + ` items on items.ContentReviewId=review.id and items.LevelCode=1 `

+ 2 - 2
src/dashoo.cn/backend/api/business/oilcontract/evaluationItems/evaluationItems.go

@@ -9,7 +9,7 @@ type OilEvaluationItems struct {
 	ParentId       int       `json:"ParentId" xorm:"not null default 0 comment('上级节点ID') INT(11) 'ParentId'"`
 	Type           string    `json:"Type" xorm:"default '1' comment('分类:1服务商、2供应商、3承包商') VARCHAR(5) 'Type'"`
 	SequenceNo     string    `json:"SequenceNo" xorm:"default '0' comment('序号') VARCHAR(50) 'SequenceNo'"`
-	Content        string    `json:"content" xorm:"comment('评价内容') VARCHAR(1000) 'content'"`
+	Content        string    `json:"Content" xorm:"comment('评价内容') VARCHAR(1000) 'Content'"`
 	NormalScore    string    `json:"NormalScore" xorm:"comment('标准分值') DECIMAL(11,2) 'NormalScore'"`
 	LevelCode      int       `json:"LevelCode" xorm:"not null default 0 comment('级别') INT(11) 'LevelCode'"`
 	Remark         string    `json:"Remark" xorm:"comment('备注') VARCHAR(500) 'Remark'"`
@@ -27,7 +27,7 @@ type DailyItems struct {
 	ParentId       int       `json:"ParentId"`
 	Type           string    `json:"Type"`
 	SequenceNo     string    `json:"SequenceNo"`
-	Content        string    `json:"content"`
+	Content        string    `json:"Content"`
 	NormalScore    string    `json:"NormalScore"`
 	LevelCode      int       `json:"LevelCode"`
 	Remark         string    `json:"Remark"`

+ 4 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contractEvaluationItems.go

@@ -109,6 +109,10 @@ func (this *OilContractEvaluationItemsController) GetEntityList() {
 	this.ServeJSON()
 }
 
+// @Title 获取列表树
+// @Description get user by token
+// @Success 200 {object} []contractEvaluationItems.OilContractEvaluationItems
+// @router /tree [get]
 func (this *OilContractEvaluationItemsController) GetTreeList() {
 	//获取分页信息
 	page := this.GetPageInfoForm()

+ 11 - 13
src/dashoo.cn/backend/api/controllers/oilcontract/contractReview.go

@@ -29,7 +29,6 @@ type OilContractReviewController struct {
 // @Success 200 {object} []contractReview.OilContractReviewWorkFlow
 // @router /list [get]
 func (this *OilContractReviewController) GetEntityList() {
-
 	//获取分页信息
 	page := this.GetPageInfoForm()
 	where := " 1=1 "
@@ -50,14 +49,11 @@ func (this *OilContractReviewController) GetEntityList() {
 	ProcessKey := this.GetString("ProcessKey")
 	BackRemark := this.GetString("BackRemark")
 	CreateOn := this.GetString("CreateOn")
-	CreateUserId := this.GetString("CreateUserId")
-	CreateBy := this.GetString("CreateBy")
 
 	if Id != "" {
 		where = where + " and r.Id like '%" + Id + "%'"
 	}
 
-
 	if ContractClass != "" {
 		where = where + " and c.ContractClass = '" + ContractClass + "'"
 	}
@@ -83,15 +79,6 @@ func (this *OilContractReviewController) GetEntityList() {
 	}
 
 
-	if CreateUserId != "" {
-		where = where + " and r.CreateUserId like '%" + CreateUserId + "%'"
-	}
-
-
-	if CreateBy != "" {
-		where = where + " and r.CreateBy like '%" + CreateBy + "%'"
-	}
-
 	if CreateOn != "" {
 		dates := strings.Split(CreateOn, ",")
 		if len(dates) == 2 {
@@ -100,6 +87,15 @@ func (this *OilContractReviewController) GetEntityList() {
 			where = where + " and r.CreateOn>='" + minDate + "' and r.CreateOn<='" + maxDate + "'"
 		}
 	}
+
+	// 权限过滤  自己创建的评价 ,同二级部门创建的评价 ,企管法规处能看
+	where = where + " ( r.CreateUserId =  '" + this.User.Id + "' "
+	where = where + " or r.UnitId = '" +  strconv.Itoa(this.User.UnitId) + "' "
+
+	// 还少个企管法规处
+
+	where = where + " )"
+
 	svc := contractReview.GetOilContractReviewService(utils.DBE)
 	var list []contractReview.OilContractReviewListVo
 	total := svc.GetContractReviewList(page.CurrentPage, page.Size, orderby, asc, &list, where)
@@ -166,6 +162,8 @@ func (this *OilContractReviewController) AddEntity() {
 	var reviewMode contractReview.OilContractReview
 	reviewMode.ContractId = modeVO.ContractId
 	reviewMode.Status = "0"
+	reviewMode.Unit = this.User.Unit
+	reviewMode.UnitId = this.User.UnitId
 	reviewMode.CreateOn = time.Now()
 	reviewMode.CreateBy = this.User.Realname
 	reviewMode.CreateUserId, _ = utils.StrTo(this.User.Id).Int()