Explorar el Código

后端: 日常评价列表 可按公司名称 评价状态查询

baichengfei hace 4 años
padre
commit
b06eb85e2a
Se han modificado 1 ficheros con 72 adiciones y 71 borrados
  1. 72 71
      src/dashoo.cn/backend/api/controllers/oilcontract/contractReview.go

+ 72 - 71
src/dashoo.cn/backend/api/controllers/oilcontract/contractReview.go

@@ -46,12 +46,14 @@ func (this *OilContractReviewController) GetEntityList() {
 	}
 	Id := this.GetString("Id")
 	ContractClass := this.GetString("ContractClass")
-	ContractId    := this.GetString("ContractId")
-	WorkflowId    := this.GetString("WorkflowId")
-	BusinessKey   := this.GetString("BusinessKey")
-	ProcessKey    := this.GetString("ProcessKey")
-	BackRemark    := this.GetString("BackRemark")
-	CreateOn      := this.GetString("CreateOn")
+	ContractId := this.GetString("ContractId")
+	WorkflowId := this.GetString("WorkflowId")
+	BusinessKey := this.GetString("BusinessKey")
+	ProcessKey := this.GetString("ProcessKey")
+	BackRemark := this.GetString("BackRemark")
+	CreateOn := this.GetString("CreateOn")
+	SupplierName := this.GetString("SupplierName")
+	Status := this.GetString("Status")
 
 	if Id != "" {
 		where = where + " and r.Id like '%" + Id + "%'"
@@ -69,21 +71,29 @@ func (this *OilContractReviewController) GetEntityList() {
 		where = where + " and r.WorkflowId like '%" + WorkflowId + "%'"
 	}
 
-
 	if BusinessKey != "" {
 		where = where + " and r.BusinessKey like '%" + BusinessKey + "%'"
 	}
 
-
 	if ProcessKey != "" {
 		where = where + " and r.ProcessKey like '%" + ProcessKey + "%'"
 	}
 
-
 	if BackRemark != "" {
 		where = where + " and r.BackRemark like '%" + BackRemark + "%'"
 	}
 
+	if SupplierName != "" {
+		where = where + " and c.SupplierName like '%" + SupplierName + "%'"
+	}
+
+	if Status != "" {
+		if Status == "8" || Status == "0" {
+			where = where + " and r.Status=" + Status
+		} else {
+			where = where + " and r.Status > 0 and r.Status !=8"
+		}
+	}
 
 	if CreateOn != "" {
 		dates := strings.Split(CreateOn, ",")
@@ -94,14 +104,13 @@ func (this *OilContractReviewController) GetEntityList() {
 		}
 	}
 
-
 	//超级管理员和有查看所有数据权限的用户不加条件
 	svcPerm := permission.GetPermissionService(utils.DBE)
-	isauth  := svcPerm.IsAuthorized(this.User.Id, "oil_contract.Review.AllRecord")
-	if(!isauth){
+	isauth := svcPerm.IsAuthorized(this.User.Id, "oil_contract.Review.AllRecord")
+	if !isauth {
 		// 权限过滤  自己创建的评价 ,同二级部门创建的评价 ,企管法规处能看
 		where = where + " and ( r.CreateUserId =  '" + this.User.Id + "' "
-		where = where + " or r.UnitId = '" +  strconv.Itoa(this.User.UnitId) + "' "
+		where = where + " or r.UnitId = '" + strconv.Itoa(this.User.UnitId) + "' "
 		where = where + " )"
 	}
 
@@ -183,11 +192,11 @@ func (this *OilContractReviewController) AddEntity() {
 	var items3 []contractEvaluationItems.OilContractEvaluationItems
 
 	// 新增配置项
-	for i,v := range modeVO.Items{
+	for i, v := range modeVO.Items {
 		fmt.Print(i)
 		var temp2 contractEvaluationItems.OilContractEvaluationItems
 		temp2.ContentReviewId = reviewMode.Id
-		temp2.Type     = v.Category
+		temp2.Type = v.Category
 		temp2.Category = 0
 		temp2.ItemId = v.Id
 		temp2.ParentId = v.ParentId
@@ -203,7 +212,7 @@ func (this *OilContractReviewController) AddEntity() {
 
 		var temp3 contractEvaluationItems.OilContractEvaluationItems
 		temp3.ContentReviewId = reviewMode.Id
-		temp3.Type     = v.Category
+		temp3.Type = v.Category
 		temp3.Category = 1
 		temp3.ItemId = v.Id
 		temp3.ParentId = v.ParentId
@@ -224,7 +233,7 @@ func (this *OilContractReviewController) AddEntity() {
 	_, err3 := itemSvc.DBE.Insert(items3)
 
 	var errinfo ErrorDataInfo
-	if err == nil && err2 == nil && err3 == nil{
+	if err == nil && err2 == nil && err3 == nil {
 		//新增
 		errinfo.Message = "添加成功!"
 		errinfo.Code = 0
@@ -263,10 +272,10 @@ func (this *OilContractReviewController) DocExport() {
 	svc.GetEntityByWhere(OilContractReviewName, where, &model)
 
 	where2 := " ContentReviewId=" + Id + " AND Category = 0 "
-	itemSvc.GetEntitysByWhere(OilContractEvaluationItemsName,where2,&items)
+	itemSvc.GetEntitysByWhere(OilContractEvaluationItemsName, where2, &items)
 
 	where3 := " Id= '" + utils.ToStr(model.ContractId) + "' "
-	contractSvc.GetEntityByWhere(OilContractName,where3,&contractModel)
+	contractSvc.GetEntityByWhere(OilContractName, where3, &contractModel)
 
 	var supplierEntity supplier.OilSupplier
 	supplierSvc := supplier.GetOilSupplierService(utils.DBE)
@@ -274,61 +283,61 @@ func (this *OilContractReviewController) DocExport() {
 
 	datamap := structToMapDemo(model)
 
-	var score       = 0.00
+	var score = 0.00
 	var normalScore = 0.00
 	// 新增配置项
-	for i,v := range items {
+	for i, v := range items {
 		fmt.Print(i)
 		fmt.Print(utils.ToStr(v.ItemId))
 
 		if v.Type == 1 {
 			datamap["score_"+utils.ToStr(v.ItemId)] = v.Score
 			datamap["content_"+utils.ToStr(v.ItemId)] = v.Remark
-			if v.ParentId == 0{
-				tmp ,_ := strconv.ParseFloat(v.Score,64)
+			if v.ParentId == 0 {
+				tmp, _ := strconv.ParseFloat(v.Score, 64)
 				score = score + tmp
-				normal,_ := strconv.ParseFloat(v.NormalScore,64)
+				normal, _ := strconv.ParseFloat(v.NormalScore, 64)
 				normalScore = normalScore + normal
 			}
-		}else{
-			datamap["bool_"+ utils.ToStr(v.ItemId)] = If(v.Value == 1,"是","否")
+		} else {
+			datamap["bool_"+utils.ToStr(v.ItemId)] = If(v.Value == 1, "是", "否")
 		}
 	}
-	datamap["Score"]    = utils.ToStr(score)
+	datamap["Score"] = utils.ToStr(score)
 	datamap["Standard"] = utils.ToStr(normalScore)
 	datamap["Discount"] = score
 
 	if contractModel.Id != 0 {
-		datamap["Amount"]       = contractModel.Amount
+		datamap["Amount"] = contractModel.Amount
 		datamap["SupplierName"] = contractModel.SupplierName
 		datamap["ProjectName"] = contractModel.ProjectName
 		datamap["ContractNo"] = contractModel.ContractNo
-		datamap["SubPackage"] = If(contractModel.SubPackage == 1 , "是" , "否")
+		datamap["SubPackage"] = If(contractModel.SubPackage == 1, "是", "否")
 		if contractModel.ProjectType == "咨询" {
 			datamap["ProjectType"] = "☑咨询 □勘察 □设计 □施工\n□监理 □检测 □工程总承包"
-		}else if contractModel.ContractClass == "勘探" {
+		} else if contractModel.ContractClass == "勘探" {
 			datamap["ProjectType"] = "□咨询 ☑勘察 □设计 □施工\n□监理 □检测 □工程总承包"
-		}else if contractModel.ContractClass == "设计"{
+		} else if contractModel.ContractClass == "设计" {
 			datamap["ProjectType"] = "□咨询 □勘察 ☑设计 □施工\n□监理 □检测 □工程总承包"
-		}else if contractModel.ContractClass == "施工"{
+		} else if contractModel.ContractClass == "施工" {
 			datamap["ProjectType"] = "□咨询 □勘察 □设计 ☑施工\n□监理 □检测 □工程总承包"
 		}
 
-		datamap["ContractPeriod"]    = contractModel.ContractPeriod
-		datamap["OpenDate"]          = contractModel.OpenDate.Format("2006年01月02日")
-		datamap["PlanFinishDate"]    = contractModel.PlanFinishDate.Format("2006年01月02日")
-		datamap["ConstructionUnit"]  = contractModel.ConstructionUnit
-		datamap["ConstructionOwner"]    = contractModel.ConstructionOwner
+		datamap["ContractPeriod"] = contractModel.ContractPeriod
+		datamap["OpenDate"] = contractModel.OpenDate.Format("2006年01月02日")
+		datamap["PlanFinishDate"] = contractModel.PlanFinishDate.Format("2006年01月02日")
+		datamap["ConstructionUnit"] = contractModel.ConstructionUnit
+		datamap["ConstructionOwner"] = contractModel.ConstructionOwner
 		datamap["ConstructionTelphone"] = contractModel.ConstructionTelphone
 	}
 	if supplierEntity.Id != 0 {
 		if supplierEntity.Grade == "一级" {
 			datamap["OperType"] = "☑一级供应商 □二级制造商 □二级贸易商 □代理商"
-		}else if supplierEntity.OperType == "制造商" {
+		} else if supplierEntity.OperType == "制造商" {
 			datamap["OperType"] = "□一级供应商 ☑二级制造商 □二级贸易商 □代理商"
-		}else if supplierEntity.OperType == "代理商"{
+		} else if supplierEntity.OperType == "代理商" {
 			datamap["OperType"] = "□一级供应商 □二级制造商 □二级贸易商 ☑代理商"
-		}else if supplierEntity.OperType == "贸易商"{
+		} else if supplierEntity.OperType == "贸易商" {
 			datamap["OperType"] = "□一级供应商 □二级制造商 ☑二级贸易商 □代理商"
 		}
 	}
@@ -339,22 +348,21 @@ func (this *OilContractReviewController) DocExport() {
 
 	fileName = ""
 	Url = ""
-	if contractModel.ContractClass == "01"{
+	if contractModel.ContractClass == "01" {
 		fileName = "供应商日常业绩评价表模板.docx"
 		Url = utils.Cfg.MustValue("workflow", "reviewGoodsUrl")
-	}else if contractModel.ContractClass == "02"{
+	} else if contractModel.ContractClass == "02" {
 		fileName = "承包商日常业绩评价表模板.docx"
 		Url = utils.Cfg.MustValue("workflow", "reviewBasisUrl")
-	}else{
+	} else {
 		fileName = "服务商日常业绩评价表模板.docx"
 		Url = utils.Cfg.MustValue("workflow", "reviewServiceUrl")
 	}
 
 	t := time.Now()
 	datamap["CreateDate"] = t.Format("2006年01月02日")
-	datamap["Year"]       = t.Format("2006")
-	datamap["Creater"]    = this.User.Realname
-
+	datamap["Year"] = t.Format("2006")
+	datamap["Creater"] = this.User.Realname
 
 	//datamap["TableComment"] = []string{"MajorEquipments", "ThreeYears", "Patent", "Winning"}
 	retDocUrl := svcActiviti.FillWordTemplate(datamap, Url, fileName)
@@ -378,7 +386,7 @@ func If(condition bool, trueVal, falseVal interface{}) interface{} {
 // @Param 	body body contractReview.OilContractReviewWorkFlow
 // @Success	200	{object} controllers.Request
 // @router /save-sec-evaluation/:id [post]
-func (this *OilContractReviewController) SaveEvaluationItemsBySec(){
+func (this *OilContractReviewController) SaveEvaluationItemsBySec() {
 	id := this.Ctx.Input.Param(":id")
 	var errinfo ErrorInfo
 	if id == "" {
@@ -394,14 +402,14 @@ func (this *OilContractReviewController) SaveEvaluationItemsBySec(){
 	json.Unmarshal(jsonBlob, &modeVO)
 	where := "ContentReviewId=" + id + " AND Category = 1 "
 	// 清除掉之前的
-	itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName,where)
+	itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where)
 	var items []contractEvaluationItems.OilContractEvaluationItems
 	// 新增配置项
-	for i,v := range modeVO.Items{
+	for i, v := range modeVO.Items {
 		fmt.Print(i)
 		var temp contractEvaluationItems.OilContractEvaluationItems
-		temp.ContentReviewId,_ = strconv.Atoi(id)
-		temp.Type     = v.Type
+		temp.ContentReviewId, _ = strconv.Atoi(id)
+		temp.Type = v.Type
 		temp.Category = 1
 		temp.ItemId = v.ItemId
 		temp.ParentId = v.ParentId
@@ -415,7 +423,7 @@ func (this *OilContractReviewController) SaveEvaluationItemsBySec(){
 		temp.Content = v.Content
 		items = append(items, temp)
 	}
-	_ , err := itemSvc.DBE.Insert(items)
+	_, err := itemSvc.DBE.Insert(items)
 	if err == nil {
 		errinfo.Message = "修改成功!"
 		errinfo.Code = 0
@@ -495,19 +503,18 @@ func (this *OilContractReviewController) UpdateEntity() {
 	}
 	err := svc.UpdateEntityBytbl(OilContractReviewName, id, &reviewMode, cols)
 
-
 	where := "ContentReviewId=" + id + " AND Category = 0 "
 	// 清除掉之前的
-	itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName,where)
+	itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where)
 
 	var items []contractEvaluationItems.OilContractEvaluationItems
 	// 新增配置项
-	for i,v := range modeVO.Items{
+	for i, v := range modeVO.Items {
 		fmt.Print(i)
 		var temp contractEvaluationItems.OilContractEvaluationItems
-		temp.ContentReviewId ,_ = strconv.Atoi(id)
-		temp.Type     = v.Category   //v.Type
-		temp.ItemId   = v.Id
+		temp.ContentReviewId, _ = strconv.Atoi(id)
+		temp.Type = v.Category //v.Type
+		temp.ItemId = v.Id
 		temp.Category = 0
 		temp.ParentId = v.ParentId
 		temp.SequenceNo = v.SequenceNo
@@ -525,16 +532,16 @@ func (this *OilContractReviewController) UpdateEntity() {
 
 	where2 := "ContentReviewId=" + id + " AND Category = 1 "
 	// 清除掉之前的
-	itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName,where2)
+	itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where2)
 
 	var items2 []contractEvaluationItems.OilContractEvaluationItems
 	// 新增配置项
-	for i,v := range modeVO.Items{
+	for i, v := range modeVO.Items {
 		fmt.Print(i)
 		var temp2 contractEvaluationItems.OilContractEvaluationItems
-		temp2.ContentReviewId ,_ = strconv.Atoi(id)
-		temp2.Type     = v.Category //v.Type
-		temp2.ItemId   = v.Id
+		temp2.ContentReviewId, _ = strconv.Atoi(id)
+		temp2.Type = v.Category //v.Type
+		temp2.ItemId = v.Id
 		temp2.Category = 1
 		temp2.ParentId = v.ParentId
 		temp2.SequenceNo = v.SequenceNo
@@ -550,8 +557,7 @@ func (this *OilContractReviewController) UpdateEntity() {
 
 	_, err3 := itemSvc.DBE.Insert(items2)
 
-
-	if err == nil && err2 == nil && err3 == nil{
+	if err == nil && err2 == nil && err3 == nil {
 		errinfo.Message = "修改成功!"
 		errinfo.Code = 0
 		this.Data["json"] = &errinfo
@@ -585,7 +591,7 @@ func (this *OilContractReviewController) DeleteEntity() {
 
 	// 评分审核是否结束校验
 	svc.GetEntityByIdBytbl(OilContractReviewName, Id, &model)
-	if model.Status > "0" && model.Status < "8"  {
+	if model.Status > "0" && model.Status < "8" {
 		errinfo.Message = "该合同评价正在审核,不允许删除!"
 		errinfo.Code = -1
 		this.Data["json"] = &errinfo
@@ -608,8 +614,6 @@ func (this *OilContractReviewController) DeleteEntity() {
 	}
 }
 
-
-
 // @Title 二级单位提交审批 --启动工作流
 // @Description 二级单位提交审批
 // @Success	200	{object} controllers.Request
@@ -808,6 +812,3 @@ func (this *OilContractReviewController) BusinessOfficeSeparateAuditEntity() {
 	contractReviewEntity.ProfessionalAudit, _ = strconv.Atoi(ProfessionalAudit)
 	conRev.UpdateEntityByIdCols(supplierCertId, contractReviewEntity, cols)
 }
-
-
-