Bladeren bron

工作流端分页查询的实现

yuedefeng 6 jaren geleden
bovenliggende
commit
50d07c19ef

+ 1 - 1
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -203,7 +203,7 @@ func (s *OilSupplierService) GetProOrTreeList(ids string, entitiesPtr interface{
 func (s *OilSupplierService) GetMyTodoEntitie(supplierTableName, supplierCertTableName string, entitiesPtr interface{}, where string) bool {
 
 	var sql string
-	sql = `select a.Id, a.SupplierName, b.Id as CertId, b.SupplierTypeCode, '1' Type, b.Status `
+	sql = `select a.Id, a.SupplierName, b.Id as CertId, b.SupplierTypeCode, '1' as Type, b.Status `
 	sql += ` from ` + supplierTableName + ` a `
 	sql += ` left join ` + supplierCertTableName + " b on b.SupplierId = a.Id"
 	sql += ` where ` + where

+ 1 - 0
src/dashoo.cn/backend/api/business/todolist/todolist.go

@@ -10,6 +10,7 @@ type TodoList struct {
 	Type             string `xorm:"VARCHAR(10)"` // 1 准入 2 增项 3 年审 4 信息变更 5 资质变更
 	SupplierName     string `xorm:"VARCHAR(50)"`
 	UserName         string `xorm:"VARCHAR(50)"`
+	TaskName         string `xorm:"VARCHAR(50)"`
 	Status           string `xorm:"VARCHAR(50)"`
 	WorkflowId       string `xorm:"VARCHAR(50)"`
 	AnnualId         string `xorm:"VARCHAR(50)"`

+ 51 - 2
src/dashoo.cn/backend/api/business/workflow/ActivitiService.go

@@ -117,7 +117,7 @@ func (this *ActivitiService) StartProcess(processKey string, formEntityId string
 	return string(p)
 }
 
-func (this *ActivitiService) StartProcess2(processKey string, formEntityId string, userNames string, result string) string {
+func (this *ActivitiService) StartProcess2(processKey, formEntityId, userNames, result, supplierType, supplierName string) string {
 	/*vars := make(map[string]string)
 	vars["processDefinitionKey"] = processKey
 	vars["formEntityId"] = formEntityId*/
@@ -127,6 +127,9 @@ func (this *ActivitiService) StartProcess2(processKey string, formEntityId strin
 	ActiProcess.BusinessKey = formEntityId
 	ActiProcess.UserNames = userNames
 	ActiProcess.Result = result
+	ActiProcess.WfType = supplierType
+	ActiProcess.SupplierName = supplierName
+
 	json, err := json.Marshal(ActiProcess)
 	if err != nil {
 		fmt.Println(err, "生成json字符串错误")
@@ -134,7 +137,7 @@ func (this *ActivitiService) StartProcess2(processKey string, formEntityId strin
 	params := string(json)
 	fmt.Println(params)
 	//token = Authorization(this.Username, this.Password)
-	retVal := this.Post("/start-process", params, "")
+	retVal := this.Post("/start-process-bytype", params, "")
 	p, _ := ioutil.ReadAll(retVal.Body)
 	return string(p)
 }
@@ -244,6 +247,52 @@ func (this *ActivitiService) GetMyFinishedTasksWithTime(processKey string, userI
 	return myTasksRetWithTimes
 }
 
+func (this *ActivitiService) GetMyAllTypePagingTasksWithTime(userId string, PageIndex, PageSize int64, wfName, wfType, supplierName string) ActiMyPagingResultVM {
+	var myPagingTasks ActiMyPagingTasksVM
+	myPagingTasks.UserId = userId
+	myPagingTasks.PageIndex = PageIndex
+	myPagingTasks.PageSize = PageSize
+	myPagingTasks.WfName = wfName
+	myPagingTasks.WfType = wfType
+	myPagingTasks.SupplierName = supplierName
+	jsonParam, err := json.Marshal(myPagingTasks)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/my-all-type-paging-tasks-with-time", params, "")
+
+	p, _ := ioutil.ReadAll(retVal.Body)
+	var myTasksRetWithTimes ActiMyPagingResultVM
+	json.Unmarshal(p, &myTasksRetWithTimes)
+	return myTasksRetWithTimes
+}
+
+func (this *ActivitiService) GetMyAllTypePagingFinishedTasksWithTime(userId string, PageIndex, PageSize int64, wfName, wfType, supplierName string) ActiMyPagingResultVM {
+	var myPagingTasks ActiMyPagingTasksVM
+	myPagingTasks.UserId = userId
+	myPagingTasks.PageIndex = PageIndex
+	myPagingTasks.PageSize = PageSize
+	myPagingTasks.WfName = wfName
+	myPagingTasks.WfType = wfType
+	myPagingTasks.SupplierName = supplierName
+	jsonParam, err := json.Marshal(myPagingTasks)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/my-all-type-paging-finished-tasks-with-time", params, "")
+
+	p, _ := ioutil.ReadAll(retVal.Body)
+	var myTasksRetWithTimes ActiMyPagingResultVM
+	json.Unmarshal(p, &myTasksRetWithTimes)
+	return myTasksRetWithTimes
+}
+
 func (this *ActivitiService) GetHistoricTasks(processKey string, businessKey string, processInstanceId string) []ActiHistoricTask {
 	var ActiProcess ActiProcessVM
 	ActiProcess.ProcessKey = processKey

+ 21 - 3
src/dashoo.cn/backend/api/business/workflow/workflow.go

@@ -8,6 +8,8 @@ type ActiProcessVM struct {
 	ProcessInstanceId string `json:"processInstanceId"`
 	UserNames         string `json:"userNames"`
 	Result         	  string `json:"result"`
+	WfType     		  string `json:"type"`
+	SupplierName      string `json:"supplierName"`
 }
 
 type ActiCompleteVM struct {
@@ -26,9 +28,25 @@ type ActiMyTasksVM struct {
 }
 
 type ActiMyTasksRetWithTimeVM struct {
-	BusinessKey string `json:"businessKey"`
-	WorkflowId  string `json:"workflowId"`
-	CreateTime  int64  `json:"createTime"`
+	ProcessDefinitionId string `json:"processDefinitionId"`
+	TaskName 			string `json:"taskName"`
+	BusinessKey 		string `json:"businessKey"`
+	WorkflowId  		string `json:"workflowId"`
+	CreateTime  		int64  `json:"createTime"`
+}
+
+type ActiMyPagingTasksVM struct {
+	UserId     		string `json:"userId"`
+	PageIndex  		int64  `json:"pageIndex"`
+	PageSize   		int64  `json:"pageSize"`
+	WfName     		string `json:"wfName"`
+	WfType     		string `json:"type"`
+	SupplierName    string `json:"supplierName"`
+}
+
+type ActiMyPagingResultVM struct {
+	Total   int64  `json:"total"`
+	TaskList []ActiMyTasksRetWithTimeVM  `json:"taskDTOList"`
 }
 
 type ActiHistoricTask struct {

+ 3 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -363,7 +363,7 @@ func (this *AnnualAuditController) AddEntityDirect() {
 	//启动工作流
 	businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(model.AuditIndex)
 	result := strconv.Itoa(this.User.IsCompanyUser)
-	processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result)
+	processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result, model.SupplierTypeName, model.SupplierName)
 	var auditmodel annualaudit.OilAnnualAudit
 	auditmodel.WorkflowId = processInstanceId
 	auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
@@ -608,7 +608,7 @@ func (this *AnnualAuditController) AddEntity() {
 	//启动工作流
 	businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(model.AuditIndex)
 	result := strconv.Itoa(this.User.IsCompanyUser)
-	processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result)
+	processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result, model.SupplierTypeName, model.SupplierName)
 	//var ActiComplete workflow.ActiCompleteVM
 	//ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
 	//ActiComplete.BusinessKey = businessKey
@@ -716,7 +716,7 @@ func (this *AnnualAuditController) AddAuditEntity() {
 	//重新工作流
 	if statusint < 0 {
 		businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(auditentity.AuditIndex)
-		processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result)
+		processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result, auditentity.SupplierTypeName, auditentity.SupplierName)
 		ActiComplete.BusinessKey = businessKey
 		auditmodel.WorkflowId = processInstanceId
 		auditmodel.BusinessKey = businessKey

+ 1 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -942,7 +942,7 @@ func (this *InfoChangeController) CommitAuditEntity() {
 	businessKey := ""
 	businessKey = InfoId + "-" + strconv.Itoa(infochangeentity.AuditIndex)
 	result := strconv.Itoa(this.User.IsCompanyUser)
-	processInstanceId = svcActiviti.StartProcess2(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id, result)
+	processInstanceId = svcActiviti.StartProcess2(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id, result, infochangeentity.SupplierTypeCode, infochangeentity.SupplierName)
 
 	var ActiComplete workflow.ActiCompleteVM
 	ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE

+ 7 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -611,6 +611,10 @@ func (this *OilSupplierCertController) AuditEntity() {
 	certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
 	var supplierCertEntity suppliercert.OilSupplierCert
 	certSrv.GetEntityById(certId, &supplierCertEntity)
+	//取出企业主表
+	supplierSvc := supplier.GetOilSupplierService(utils.DBE)
+	var supplierEntity supplier.OilSupplier
+	supplierSvc.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
 
 	svc := organize.GetOrganizeService(utils.DBE)
 	unitId := svc.GetMyUnitDepartmentId(this.User.DepartmentId)
@@ -654,11 +658,11 @@ func (this *OilSupplierCertController) AuditEntity() {
 		businessKey = certId + "-" +  strconv.Itoa(supplierCertEntity.AuditIndex)
 		// 1 评审准入  2 一级物资备案准入  3  二级物资备案准入  4 战略合作准入  5 内部多元准入  6 外部市场准入
 		if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
-			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result)
+			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
 		} else if supplierCertEntity.InStyle == "3" {
-			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result)
+			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
 		} else if supplierCertEntity.InStyle == "1" || supplierCertEntity.InStyle == "5" {
-			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result)
+			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
 		}
 		//if this.User.IsCompanyUser == 1 { // 企业用户
 		//	// 1 评审准入  2 一级物资备案准入  3  二级物资备案准入  4 战略合作准入  5 内部多元准入  6 外部市场准入

+ 3 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -565,11 +565,11 @@ func (this *OilSupplierCertAppendController) AuditEntity() {
 		//启动工作流
 		businessKey = certappendId + "-" +  strconv.Itoa(supplierCertAppendEntity.AuditIndex)
 		if supplierCertAppendEntity.InStyle == "2" || supplierCertAppendEntity.InStyle == "4" || supplierCertAppendEntity.InStyle == "6" {
-			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_FIRST_ENUSER_APPEND_APPLY, businessKey, this.User.Id, result)
+			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_FIRST_ENUSER_APPEND_APPLY, businessKey, this.User.Id, result, supplierCertAppendEntity.AppendType, supplierCertAppendEntity.SupplierName)
 		} else if supplierCertAppendEntity.InStyle == "3" {
-			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_SECOND_ENUSER_APPEND_APPLY, businessKey, this.User.Id, result)
+			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_SECOND_ENUSER_APPEND_APPLY, businessKey, this.User.Id, result, supplierCertAppendEntity.AppendType, supplierCertAppendEntity.SupplierName)
 		} else if supplierCertAppendEntity.InStyle == "1" || supplierCertAppendEntity.InStyle == "5" {
-			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_APPEND_APPLY, businessKey, this.User.Id, result)
+			processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_APPEND_APPLY, businessKey, this.User.Id, result, supplierCertAppendEntity.AppendType, supplierCertAppendEntity.SupplierName)
 		}
 
 	}

+ 197 - 729
src/dashoo.cn/backend/api/controllers/oilsupplier/todolist.go

@@ -5,12 +5,10 @@ import (
 	"dashoo.cn/backend/api/business/oilsupplier/infochange"
 	"dashoo.cn/backend/api/business/oilsupplier/supplier"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
-	"dashoo.cn/backend/api/business/register"
 	"dashoo.cn/backend/api/business/todolist"
 	"dashoo.cn/backend/api/business/workflow"
 	. "dashoo.cn/backend/api/controllers"
 	"dashoo.cn/utils"
-	"fmt"
 	"sort"
 	"strconv"
 	"strings"
@@ -25,375 +23,122 @@ type TodoListController struct {
 // @Success 200 {object} []supplier.OilSupplierView
 // @router /gettodolist [get]
 func (this *TodoListController) GetMyTaskEntityList() {
-	var todolists []todolist.TodoList
-
 
 	page := this.GetPageInfoForm()
 
 	stype := this.GetString("Type")
 	supplierTypeCode := this.GetString("SupplierTypeCode")
 	supplierName := this.GetString("SupplierName")
+	wfNames := ""
+	if stype == "1" {
+		wfNames = workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY  + "," + workflow.OIL_ENUSER_SUPPLIER_APPLY + "," + workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY
+	} else if stype == "2" {
+		wfNames = workflow.OIL_ENUSER_APPEND_APPLY + "," + workflow.OIL_FIRST_ENUSER_APPEND_APPLY + "," + workflow.OIL_SECOND_ENUSER_APPEND_APPLY
+	} else if stype == "3" {
+		wfNames = workflow.OIL_AUDIT_APPLY
+	} else if stype == "4" {
+		wfNames = workflow.OIL_INFO_CHANGE
+	}
 
-	actisvc := workflow.GetActivitiService(utils.DBE)
+	var todolists []todolist.TodoList
 
-	svc := supplier.GetOilSupplierService(utils.DBE)
+	var pagingResult workflow.ActiMyPagingResultVM
 	var myTasksRetWithTimes []workflow.ActiMyTasksRetWithTimeVM
-	if stype == "1" || stype == "" {
-		where := " 1=1 "
-		if supplierTypeCode != "" {
-			where = where + " and b.SupplierTypeCode = '" + supplierTypeCode + "'"
-		}
-
-		if supplierName != "" {
-			where = where + " and a.SupplierName like '%" + supplierName + "%'"
-		}
-
-		where = where + " and b.Id = "
-
-		//myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereadd := where + id
-		//		has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-		//		if has {
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//		fmt.Println("1")
-		//	}
-		//}
-		//
-		////一级物资供方准入流程图
-		//myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereadd := where + id
-		//		has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-		//		if has {
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-		//
-		////二级物资供方准入流程图
-		//myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereadd := where + id
-		//		has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-		//		fmt.Println("2")
-		//		if has {
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//
-		//	}
-		//}
-
-		//企业用户准入流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereadd := where + id
-				has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-				fmt.Println("3")
-				if has {
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
-
-		// 企业用户一级物资准入流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereadd := where + id
-				has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-				fmt.Println("4")
-				if has {
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
+	actisvc := workflow.GetActivitiService(utils.DBE)
 
-		//企业用户二级物资准入流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereadd := where + id
-				has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-				fmt.Println("5")
-				if has {
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+	pagingResult = actisvc.GetMyAllTypePagingTasksWithTime(this.User.Id, page.CurrentPage, page.Size, wfNames, supplierTypeCode, supplierName)
+	myTasksRetWithTimes = pagingResult.TaskList
+
+	var todo todolist.TodoList
+	//取出各种类型的ID
+	for _,item := range myTasksRetWithTimes {
+		idx := strings.Index(item.BusinessKey, "-")
+		id := item.BusinessKey
+		if idx >= 0 {
+			id = strings.Split(item.BusinessKey, "-")[0]
+		}
+		//工作流名称
+		has := false
+		wfName := strings.Split(item.ProcessDefinitionId, ":")[0] //如:oil_enuser_supplier_apply:2:2543
+		if wfName == workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY || wfName == workflow.OIL_ENUSER_SUPPLIER_APPLY || wfName == workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY {
+			//准入
+			where := " 1=1 "
+			where = where + " and b.Id = '" + id + "'"
+			svc := supplier.GetOilSupplierService(utils.DBE)
+			has = svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, where)
+			if has {
+				todo.Type  = todolist.SUPPLIER
+				todo.UserName = this.User.Realname
+				todo.CreateTime = item.CreateTime
+				todo.TaskName = item.TaskName
+				todolists = append(todolists, todo)
 			}
-		}
 
-	}
-	if stype == "2" || stype == "" {
-		//待办任务 -- 增项
-		where := "1=1"
-		if supplierTypeCode != "" {
-			where = where + " and b.AppendType = '" + supplierTypeCode + "'"
-		}
-
-		if supplierName != "" {
-			where = where + " and a.SupplierName like '%" + supplierName + "%'"
-		}
-		where += " and b.Id ="
-		svcapp := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
-		//供方增项流程图
-		//myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_APPEND_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereapp := where + id
-		//		has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-		//		if has {
-		//			todo.Type = todolist.CERTAPPEND
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-
-		//一级物资供方增项流程图
-		//myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_FIRST_APPEND_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereapp := where + id
-		//		has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-		//		if has {
-		//			todo.Type = todolist.CERTAPPEND
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-
-		//二级物资供方准入流程图
-		//myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_SECOND_APPEND_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereapp := where + id
-		//		has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-		//		if has {
-		//			todo.Type = todolist.CERTAPPEND
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-
-		//企业用户增项流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_ENUSER_APPEND_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereapp := where + id
-				has :=svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-				if has {
-					todo.Type = todolist.CERTAPPEND
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+		} else if wfName == workflow.OIL_ENUSER_APPEND_APPLY || wfName == workflow.OIL_FIRST_ENUSER_APPEND_APPLY || wfName == workflow.OIL_SECOND_ENUSER_APPEND_APPLY {
+			//增项
+			where := " 1=1 "
+			where = where + " and b.Id = '" + id + "'"
+			svcapp := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
+			has :=svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, where)
+			if has {
+				todo.Type = todolist.CERTAPPEND
+				todo.UserName = this.User.Realname
+				todo.CreateTime = item.CreateTime
+				todolists = append(todolists, todo)
 			}
-		}
 
-		//企业用户一级物资增项流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_FIRST_ENUSER_APPEND_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereapp := where + id
-				has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-				if has {
-					todo.Type = todolist.CERTAPPEND
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+		} else if wfName == workflow.OIL_AUDIT_APPLY {
+			//年审
+			var listannu annualaudit.OilAnnualAudit
+			svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
+			has = svc.GetEntityById(id, &listannu)
+			if has {
+				todo.Id = listannu.Id
+				todo.SupplierId = strconv.Itoa(listannu.SupplierId)
+				todo.Type = todolist.ANNUALAUDIT
+				todo.SupplierName = listannu.SupplierName
+				todo.UserName = this.User.Realname
+				todo.TaskName = item.TaskName
+				todo.SupplierTypeCode = listannu.SupplierTypeName
+				todo.Step = strconv.Itoa(listannu.Step)
+				todo.Status = listannu.Status
+				todo.CertId = strconv.Itoa(listannu.CerId)
+				todo.CreateTime = item.CreateTime
+				todolists = append(todolists, todo)
 			}
-		}
 
-		//企业用户二级物资增项流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_SECOND_ENUSER_APPEND_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereapp := where + id
-				has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-				if has {
-					todo.Type = todolist.CERTAPPEND
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+		} else if wfName == workflow.OIL_INFO_CHANGE {
+			//资质变更
+			var listInfo infochange.OilInfoChange
+			svc := infochange.GetInfoChangeService(utils.DBE)
+			has = svc.GetEntityById(id, &listInfo)
+			if has {
+				todo.Id = listInfo.Id
+				todo.Type = todolist.INFOCHANGE
+				todo.SupplierName = listInfo.SupplierName
+				todo.UserName = this.User.Realname
+				todo.TaskName = item.TaskName
+				todo.SupplierTypeCode = listInfo.SupplierTypeName
+				todo.Status = listInfo.Status
+				todo.CreateTime = item.CreateTime
+				todolists = append(todolists, todo)
 			}
 		}
-
 	}
-	if stype == "3" || stype == "" {
-		//  待办--年审
-		where := "1=1"
-		if supplierTypeCode != "" {
-			where = where + " and SupplierTypeName = '" + supplierTypeCode + "'"
-		}
 
-		if supplierName != "" {
-			where = where + " and SupplierName like '%" + supplierName + "%'"
-		}
-		where += " and Id ="
+	sort.Slice(todolists, func(i, j int) bool {
+		return todolists[i].CreateTime > todolists[j].CreateTime
+	})
+	var datainfo DataInfo
+	datainfo.Items = todolists
+	datainfo.CurrentItemCount = pagingResult.Total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
 
-		//年审流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_AUDIT_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			var todo todolist.TodoList
-			var listannu annualaudit.OilAnnualAudit
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereannu := where + id
-				has := svc.GetEntity(&listannu, whereannu)
-				if has {
-					todo.Id = listannu.Id
-					todo.SupplierId = strconv.Itoa(listannu.SupplierId)
-					todo.Type = todolist.ANNUALAUDIT
-					todo.SupplierName = listannu.SupplierName
-					todo.UserName = this.User.Realname
-					todo.SupplierTypeCode = listannu.SupplierTypeName
-					todo.Step = strconv.Itoa(listannu.Step)
-					todo.Status = listannu.Status
-					todo.CertId = strconv.Itoa(listannu.CerId)
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
-	}
-	if stype == "4" || stype == "" {
-		// 待办 ----- 信息变更
-		where := "1=1"
-		if supplierName != "" {
-			where = where + " and SupplierName like '%" + supplierName + "%'"
-		}
-		where += " and Id ="
-		//信息变更流程图
-		myTasksRetWithTimes = actisvc.GetMyTasksWithTime(workflow.OIL_INFO_CHANGE, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			var todo todolist.TodoList
-			var listInfo infochange.OilInfoChange
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereinfo := where + id
-				has := svc.GetEntity(&listInfo, whereinfo)
-				if has {
-					todo.Id = listInfo.Id
-					todo.SupplierId = strconv.Itoa(listInfo.SupplierId)
-					todo.Type = todolist.INFOCHANGE
-					todo.SupplierName = listInfo.SupplierName
-					todo.UserName = this.User.Realname
-					todo.SupplierTypeCode = listInfo.SupplierTypeName
-					todo.Status = listInfo.Status
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
-	}
-	//if stype == "5" || stype == "" {
-	//	// 资质变更
-	//	arr := actisvc.GetMyTasksWithTime(workflow.OIL_QUAL_CHANGE, this.User.Id)
-	//	for _,s := range arr {
-	//		myTasksRetWithTimes = append(myTasksRetWithTimes, s)
-	//	}
-	//	var listqual []qualchange.OilQualChangeMain
-	//	qualList := actisvc.GetMyTasks(workflow.OIL_QUAL_CHANGE, this.User.Id)
-	//	qualIdarr := strings.Split(qualList, ",")
-	//	for i, item := range qualIdarr {
-	//		idx := strings.Index(item, "-")
-	//		if idx >= 0 {
-	//			qualIdarr[i] = strings.Split(item, "-")[0]
-	//		}
-	//	}
-	//	qualList = strings.Join(qualIdarr, ",")
-	//	wherequal := "1=1 "
-	//
-	//	if supplierName != "" {
-	//		wherequal = wherequal + " and SupplierName like '%" + supplierName + "%'"
-	//	}
-	//	if qualList != "" {
-	//		wherequal += " and Id in (" + qualList + ")"
-	//		wherequal += " and Status > 0 "
-	//		svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &listqual, wherequal)
-	//		var todo todolist.TodoList
-	//		for _, item := range listqual {
-	//			todo.Id = item.Id
-	//			todo.CertId = strconv.Itoa(item.SupplierCertId)
-	//			todo.SupplierId = strconv.Itoa(item.SupplierId)
-	//			todo.Type = todolist.QUALCHANGE
-	//			todo.SupplierName = item.SupplierName
-	//			todo.UserName = this.User.Realname
-	//			todo.SupplierTypeCode = "0"
-	//			todo.Status = item.Status
-	//			todo.BusinessKey = strconv.Itoa(item.Id) + "-"+ strconv.Itoa(item.AuditIndex)
-	//			todolists = append(todolists, todo)
-	//		}
-	//	}
-	//}
-	if stype == "6" || stype == "" {
+
+	/*if stype == "6" || stype == "" {
 		where := " CheckStatus=0 "
 		if supplierName != "" {
 			where = where + " and SupplierName like '%" + supplierName + "%' "
@@ -414,24 +159,8 @@ func (this *TodoListController) GetMyTaskEntityList() {
 			todo.CreateTime = item.CreateOn.Unix() * 1000
 			todolists = append(todolists, todo)
 		}
-	}
-	//for i,todo := range todolists {
-	//	for _,myTasksRetWithTime := range myTasksRetWithTimes {
-	//		if todo.BusinessKey == myTasksRetWithTime.BusinessKey && todo.WorkflowId == myTasksRetWithTime.WorkflowId {
-	//			todolists[i].CreateTime = myTasksRetWithTime.CreateTime
-	//		}
-	//	}
-	//}
+	}*/
 
-	sort.Slice(todolists, func(i, j int) bool {
-		return todolists[i].CreateTime > todolists[j].CreateTime
-	})
-
-	var datainfo DataInfo
-	datainfo.Items = todolists
-	this.Data["json"] = &datainfo
-	this.ServeJSON()
-	//this.SetUserDeptId()
 }
 
 // @Title 获取已办列表
@@ -439,381 +168,128 @@ func (this *TodoListController) GetMyTaskEntityList() {
 // @Success 200 {object} []supplier.OilSupplierView
 // @router /getmytaskfinishedlist [get]
 func (this *TodoListController) GetMyTaskFinishedList() {
-	var todolists []todolist.TodoList
 
 	page := this.GetPageInfoForm()
 
 	stype := this.GetString("Type")
 	supplierTypeCode := this.GetString("SupplierTypeCode")
 	supplierName := this.GetString("SupplierName")
+	wfNames := ""
+	if stype == "1" {
+		wfNames = workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY  + "," + workflow.OIL_ENUSER_SUPPLIER_APPLY + "," + workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY
+	} else if stype == "2" {
+		wfNames = workflow.OIL_ENUSER_APPEND_APPLY + "," + workflow.OIL_FIRST_ENUSER_APPEND_APPLY + "," + workflow.OIL_SECOND_ENUSER_APPEND_APPLY
+	} else if stype == "3" {
+		wfNames = workflow.OIL_AUDIT_APPLY
+	} else if stype == "4" {
+		wfNames = workflow.OIL_INFO_CHANGE
+	}
 
+	var todolists []todolist.TodoList
 
-	actisvc := workflow.GetActivitiService(utils.DBE)
-	svc := supplier.GetOilSupplierService(utils.DBE)
+	var pagingResult workflow.ActiMyPagingResultVM
 	var myTasksRetWithTimes []workflow.ActiMyTasksRetWithTimeVM
-	if stype == "1" || stype == "" {
-		where := " 1=1 "
-		if supplierTypeCode != "" {
-			where = where + " and b.SupplierTypeCode = '" + supplierTypeCode + "'"
-		}
-
-		if supplierName != "" {
-			where = where + " and a.SupplierName like '%" + supplierName + "%'"
-		}
-
-		where = where + " and b.Id = "
-		//已办任务===准入
-		//供方准入流程图
-		//myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereadd := where + id
-		//		has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-		//		if has {
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//		fmt.Println("1")
-		//	}
-		//}
-
-		//一级物资供方准入流程图
-		//myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereadd := where + id
-		//		has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-		//		if has {
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-		//
-		////二级物资供方准入流程图
-		//myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereadd := where + id
-		//		has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-		//		fmt.Println("2")
-		//		if has {
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//
-		//	}
-		//}
-
-		//企业用户准入流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereadd := where + id
-				has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-				fmt.Println("3")
-				if has {
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
+	actisvc := workflow.GetActivitiService(utils.DBE)
 
-		// 企业用户一级物资准入流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereadd := where + id
-				has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-				fmt.Println("4")
-				if has {
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+	pagingResult = actisvc.GetMyAllTypePagingFinishedTasksWithTime(this.User.Id, page.CurrentPage, page.Size, wfNames, supplierTypeCode, supplierName)
+	myTasksRetWithTimes = pagingResult.TaskList
+
+	var todo todolist.TodoList
+	//取出各种类型的ID
+	for _,item := range myTasksRetWithTimes {
+		idx := strings.Index(item.BusinessKey, "-")
+		id := item.BusinessKey
+		if idx >= 0 {
+			id = strings.Split(item.BusinessKey, "-")[0]
+		}
+		//工作流名称
+		has := false
+		wfName := strings.Split(item.ProcessDefinitionId, ":")[0] //如:oil_enuser_supplier_apply:2:2543
+		if wfName == workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY || wfName == workflow.OIL_ENUSER_SUPPLIER_APPLY || wfName == workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY {
+			//准入
+			where := " 1=1 "
+			where = where + " and b.Id = '" + id + "'"
+			svc := supplier.GetOilSupplierService(utils.DBE)
+			has = svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, where)
+			if has {
+				todo.Type  = todolist.SUPPLIER
+				todo.UserName = this.User.Realname
+				todo.CreateTime = item.CreateTime
+				todo.TaskName = item.TaskName
+				todolists = append(todolists, todo)
 			}
-		}
 
-		//企业用户二级物资准入流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereadd := where + id
-				has := svc.GetMyTodoEntitie(OilSupplierName, OilSupplierCertName,  &todo, whereadd)
-				fmt.Println("5")
-				if has {
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+		} else if wfName == workflow.OIL_ENUSER_APPEND_APPLY || wfName == workflow.OIL_FIRST_ENUSER_APPEND_APPLY || wfName == workflow.OIL_SECOND_ENUSER_APPEND_APPLY {
+			//增项
+			where := " 1=1 "
+			where = where + " and b.Id = '" + id + "'"
+			svcapp := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
+			has :=svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, where)
+			if has {
+				todo.Type = todolist.CERTAPPEND
+				todo.UserName = this.User.Realname
+				todo.CreateTime = item.CreateTime
+				todolists = append(todolists, todo)
 			}
-		}
 
-	}
-	if stype == "2" || stype == "" {
-		//已办任务 -- 增项
-		where := "1=1"
-		if supplierTypeCode != "" {
-			where = where + " and b.AppendType = '" + supplierTypeCode + "'"
-		}
-
-		if supplierName != "" {
-			where = where + " and a.SupplierName like '%" + supplierName + "%'"
-		}
-		where += " and b.Id ="
-		svcapp := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
-		//供方增项流程图
-		//myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_APPEND_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereapp := where + id
-		//		has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-		//		if has {
-		//			todo.Type = todolist.CERTAPPEND
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-		//
-		////一级物资供方增项流程图
-		//myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_FIRST_APPEND_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereapp := where + id
-		//		has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-		//		if has {
-		//			todo.Type = todolist.CERTAPPEND
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-		//
-		////二级物资供方准入流程图
-		//myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_SECOND_APPEND_APPLY, this.User.Id)
-		//for _,item := range myTasksRetWithTimes {
-		//	//var entity []supplier.OilSupplierView
-		//	var todo todolist.TodoList
-		//	idx := strings.Index(item.BusinessKey, "-")
-		//	if idx >= 0 {
-		//		id := strings.Split(item.BusinessKey, "-")[0]
-		//		whereapp := where + id
-		//		has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-		//		if has {
-		//			todo.Type = todolist.CERTAPPEND
-		//			todo.UserName = this.User.Realname
-		//			todo.CreateTime = item.CreateTime
-		//			todolists = append(todolists, todo)
-		//		}
-		//	}
-		//}
-
-		//企业用户增项流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_ENUSER_APPEND_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereapp := where + id
-				has :=svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-				if has {
-					todo.Type = todolist.CERTAPPEND
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+		} else if wfName == workflow.OIL_AUDIT_APPLY {
+			//年审
+			where := " 1=1 "
+			where = where + " and b.Id = '" + id + "'"
+			var listannu annualaudit.OilAnnualAudit
+			svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
+			has = svc.GetEntity(&listannu, where)
+			if has {
+				todo.Id = listannu.Id
+				todo.SupplierId = strconv.Itoa(listannu.SupplierId)
+				todo.Type = todolist.ANNUALAUDIT
+				todo.SupplierName = listannu.SupplierName
+				todo.UserName = this.User.Realname
+				todo.TaskName = item.TaskName
+				todo.SupplierTypeCode = listannu.SupplierTypeName
+				todo.Step = strconv.Itoa(listannu.Step)
+				todo.Status = listannu.Status
+				todo.CertId = strconv.Itoa(listannu.CerId)
+				todo.CreateTime = item.CreateTime
+				todolists = append(todolists, todo)
 			}
-		}
 
-		//企业用户一级物资增项流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_FIRST_ENUSER_APPEND_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereapp := where + id
-				has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-				if has {
-					todo.Type = todolist.CERTAPPEND
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
+		} else if wfName == workflow.OIL_INFO_CHANGE {
+			//资质变更
+			where := " 1=1 "
+			where = where + " and b.Id = '" + id + "'"
+			var listInfo infochange.OilInfoChange
+			svc := infochange.GetInfoChangeService(utils.DBE)
+			has = svc.GetEntity(&listInfo, where)
+			if has {
+				todo.Id = listInfo.Id
+				todo.Type = todolist.INFOCHANGE
+				todo.SupplierName = listInfo.SupplierName
+				todo.UserName = this.User.Realname
+				todo.TaskName = item.TaskName
+				todo.SupplierTypeCode = listInfo.SupplierTypeName
+				todo.Status = listInfo.Status
+				todo.CreateTime = item.CreateTime
+				todolists = append(todolists, todo)
 			}
 		}
 
-		//企业用户二级物资增项流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_SECOND_ENUSER_APPEND_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereapp := where + id
-				has := svcapp.GetTodoEntitie(OilSupplierName, OilSupplierCertAppendName,  &todo, whereapp)
-				if has {
-					todo.Type = todolist.CERTAPPEND
-					todo.UserName = this.User.Realname
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
 	}
-	if stype == "3" || stype == "" {
-		//  已办--年审
-		where := "1=1"
-		if supplierTypeCode != "" {
-			where = where + " and SupplierTypeName = '" + supplierTypeCode + "'"
-		}
 
-		if supplierName != "" {
-			where = where + " and SupplierName like '%" + supplierName + "%'"
-		}
-		where += " and Id ="
+	sort.Slice(todolists, func(i, j int) bool {
+		return todolists[i].CreateTime > todolists[j].CreateTime
+	})
+	var datainfo DataInfo
+	datainfo.Items = todolists
+	datainfo.CurrentItemCount = pagingResult.Total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
 
-		//年审流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_AUDIT_APPLY, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			var listannu annualaudit.OilAnnualAudit
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereannu := where + id
-				has := svc.GetEntity(&listannu, whereannu)
-				if has {
-					todo.Id = listannu.Id
-					todo.SupplierId = strconv.Itoa(listannu.SupplierId)
-					todo.Type = todolist.ANNUALAUDIT
-					todo.SupplierName = listannu.SupplierName
-					todo.UserName = this.User.Realname
-					todo.SupplierTypeCode = listannu.SupplierTypeName
-					todo.Step = strconv.Itoa(listannu.Step)
-					todo.Status = listannu.Status
-					todo.CertId = strconv.Itoa(listannu.CerId)
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
-	}
-	if stype == "4" || stype == "" {
-		// 已办 ----- 信息变更
-		where := "1=1"
-		if supplierName != "" {
-			where = where + " and SupplierName like '%" + supplierName + "%'"
-		}
-		where += " and Id ="
-		//信息变更流程图
-		myTasksRetWithTimes = actisvc.GetMyFinishedTasksWithTime(workflow.OIL_INFO_CHANGE, this.User.Id)
-		for _,item := range myTasksRetWithTimes {
-			//var entity []supplier.OilSupplierView
-			var todo todolist.TodoList
-			var listInfo infochange.OilInfoChange
-			idx := strings.Index(item.BusinessKey, "-")
-			if idx >= 0 {
-				id := strings.Split(item.BusinessKey, "-")[0]
-				whereinfo := where + id
-				has := svc.GetEntity(&listInfo, whereinfo)
-				if has {
-					todo.Id = listInfo.Id
-					todo.Type = todolist.INFOCHANGE
-					todo.SupplierName = listInfo.SupplierName
-					todo.UserName = this.User.Realname
-					todo.SupplierTypeCode = listInfo.SupplierTypeName
-					todo.Status = listInfo.Status
-					todo.CreateTime = item.CreateTime
-					todolists = append(todolists, todo)
-				}
-			}
-		}
-	}
-	////if stype == "5" || stype == "" {
-	////	// 资质变更
-	////	var listqual []qualchange.OilQualChangeMain
-	////	arr := actisvc.GetMyFinishedTasksWithTime(workflow.OIL_QUAL_CHANGE, this.User.Id)
-	////	for _,s := range arr {
-	////		myTasksRetWithTimes = append(myTasksRetWithTimes, s)
-	////	}
-	////	qualList := actisvc.GetHistoryMyTasks(workflow.OIL_QUAL_CHANGE, this.User.Id)
-	////	qualIdarr := strings.Split(qualList, ",")
-	////	for i, item := range qualIdarr {
-	////		idx := strings.Index(item, "-")
-	////		if idx >= 0 {
-	////			qualIdarr[i] = strings.Split(item, "-")[0]
-	////		}
-	////	}
-	////	qualList = strings.Join(qualIdarr, ",")
-	////	wherequal := "1=1 "
-	////
-	////	if supplierName != "" {
-	////		wherequal = wherequal + " and SupplierName like '%" + supplierName + "%'"
-	////	}
-	////	if qualList != "" {
-	////		wherequal += " and Id in (" + qualList + ")"
-	////		wherequal += " and Status != -2 "
-	////		svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &listqual, wherequal)
-	////		for _, item := range listqual {
-	////			todo.Id = item.Id
-	////			todo.CertId = strconv.Itoa(item.SupplierCertId)
-	////			todo.SupplierId = strconv.Itoa(item.SupplierId)
-	////			todo.Type = todolist.QUALCHANGE
-	////			todo.SupplierName = item.SupplierName
-	////			todo.UserName = this.User.Realname
-	////			todo.SupplierTypeCode = "0"
-	////			todo.Status = item.Status
-	////			todo.BusinessKey = strconv.Itoa(item.Id) + "-"+ strconv.Itoa(item.AuditIndex)
-	////			todolists = append(todolists, todo)
-	////		}
-	////	}
-	////}
-	if stype == "6" || stype == "" {
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+	/*if stype == "6" || stype == "" {
 		where := " CheckStatus in (1,2) "
 		if supplierName != "" {
 			where = where + " and SupplierName like '%" + supplierName + "%' "
@@ -834,13 +310,5 @@ func (this *TodoListController) GetMyTaskFinishedList() {
 			todo.CreateTime = item.CreateOn.Unix() * 1000
 			todolists = append(todolists, todo)
 		}
-	}
-	
-	sort.Slice(todolists, func(i, j int) bool {
-		return todolists[i].CreateTime > todolists[j].CreateTime
-	})
-	var datainfo DataInfo
-	datainfo.Items = todolists
-	this.Data["json"] = &datainfo
-	this.ServeJSON()
+	}*/
 }

+ 80 - 28
src/dashoo.cn/frontend_web/src/pages/index.vue

@@ -45,14 +45,15 @@
 
           <el-table-column label="待办类型" prop="Type" align="center">
             <template slot-scope="scope">
-              <span v-if="scope.row.Type=='1'" style="color:#E6A23C">准入-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-              <span v-if="scope.row.Type=='2'" style="color:#E6A23C">增项-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-              <span v-if="scope.row.Type=='3'" style="color:#E6A23C">年审-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-              <span v-if="scope.row.Type=='4'" style="color:#E6A23C">信息变更-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-              <!--<span v-if="scope.row.Type=='5'" style="color:#E6A23C">资质变更-{{statusStr(scope.row.Status, scope.row.Type)}}</span>-->
+              <span v-if="scope.row.Type=='1'" style="color:#E6A23C">准入-{{scope.row.TaskName}}</span>
+              <span v-if="scope.row.Type=='2'" style="color:#E6A23C">增项-{{scope.row.TaskName}}</span>
+              <span v-if="scope.row.Type=='3'" style="color:#E6A23C">年审-{{scope.row.TaskName}}</span>
+              <span v-if="scope.row.Type=='4'" style="color:#E6A23C">信息变更-{{scope.row.TaskName}}</span>
+              <!--<span v-if="scope.row.Type=='5'" style="color:#E6A23C">资质变更-{{scope.row.TaskName}}</span>-->
               <span v-if="scope.row.Type=='6'" style="color:#E6A23C">企业注册-待审批</span>
             </template>
           </el-table-column>
+
           <!--<el-table-column label="当前状态" prop="Status" align="center">-->
             <!--&lt;!&ndash;<template slot-scope="scope">&ndash;&gt;-->
               <!--&lt;!&ndash;{{statusStr(scope.row.Status, scope.row.Type)}}&ndash;&gt;-->
@@ -70,13 +71,20 @@
 
           <el-table-column label="执行人" prop="UserName" align="center"></el-table-column>
 
-            <el-table-column label="提交时间" prop="CreateTime">
-              <template slot-scope="scope">
-                {{ jstimehandle(timestampToTime(scope.row.CreateTime)) }}
-              </template>
-            </el-table-column>
+          <el-table-column label="提交时间" prop="CreateTime">
+            <template slot-scope="scope">
+              {{ jstimehandle(timestampToTime(scope.row.CreateTime)) }}
+            </template>
+          </el-table-column>
 
-          <el-table-column label="操作" width="130" align="center" fixed="right">
+          <el-table-column label="当前状态" prop="Status" align="center">
+            <template slot-scope="scope">
+              <span>{{statusStr(scope.row.Status, scope.row.Type)}}</span>
+            </template>
+          </el-table-column>
+
+
+            <el-table-column label="操作" width="130" align="center" fixed="right">
             <template slot-scope="scope">
               <el-button type="text" title="办理"  icon="el-icon-edit" size="mini" @click="rowClick(scope.row)">办理</el-button>
               <!--<el-button type="text" title="编辑"  icon="el-icon-s-promotion" size="mini">跟踪</el-button>-->
@@ -84,7 +92,16 @@
           </el-table-column>
 
         </el-table>
+        <el-pagination @size-change="handleSizeChange"
+                       @current-change="handleCurrentChange"
+                       :current-page="currentPage"
+                       :page-sizes="[10, 15, 20, 25]"
+                       :page-size="size"
+                       layout="total, sizes, prev, pager, next, jumper"
+                       :total="currentItemCount">
+        </el-pagination>
         </el-tab-pane>
+
         <el-tab-pane label="已办任务" name="second">
           <el-table
             :data="entityListdone"
@@ -95,12 +112,12 @@
 
             <el-table-column label="已办类型" prop="Type">
               <template slot-scope="scope">
-                <span v-if="scope.row.Type=='1'" style="color:#E6A23C">准入-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-                <span v-if="scope.row.Type=='2'" style="color:#E6A23C">增项-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-                <span v-if="scope.row.Type=='3'" style="color:#E6A23C">年审-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-                <span v-if="scope.row.Type=='4'" style="color:#E6A23C">信息变更-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
-                <!--<span v-if="scope.row.Type=='5'" style="color:#E6A23C">资质变更-{{statusStr(scope.row.Status, scope.row.Type)}}</span>-->
-                <span v-if="scope.row.Type=='6'" style="color:#E6A23C">企业注册-{{statusStr(scope.row.Status, scope.row.Type)}}</span>
+                <span v-if="scope.row.Type=='1'" style="color:#E6A23C">准入-{{scope.row.TaskName}}</span>
+                <span v-if="scope.row.Type=='2'" style="color:#E6A23C">增项-{{scope.row.TaskName}}</span>
+                <span v-if="scope.row.Type=='3'" style="color:#E6A23C">年审-{{scope.row.TaskName}}</span>
+                <span v-if="scope.row.Type=='4'" style="color:#E6A23C">信息变更-{{scope.row.TaskName}}</span>
+                <!--<span v-if="scope.row.Type=='5'" style="color:#E6A23C">资质变更-{{scope.row.TaskName}}</span>-->
+                <span v-if="scope.row.Type=='6'" style="color:#E6A23C">企业注册-{{scope.row.TaskName}}</span>
               </template>
             </el-table-column>
             <el-table-column label="类别" prop="SupplierTypeCode">
@@ -120,6 +137,11 @@
                 {{ jstimehandle(timestampToTime(scope.row.CreateTime)) }}
               </template>
             </el-table-column>
+            <el-table-column label="当前状态" prop="Status" align="center">
+              <template slot-scope="scope">
+                <span>{{statusStr(scope.row.Status, scope.row.Type)}}</span>
+              </template>
+            </el-table-column>
 
             <el-table-column label="操作" width="130" align="center" fixed="right">
               <template slot-scope="scope">
@@ -127,8 +149,15 @@
                 <!--<el-button type="text" title="编辑"  icon="el-icon-s-promotion" size="mini">跟踪</el-button>-->
               </template>
             </el-table-column>
-
           </el-table>
+          <el-pagination @size-change="handleSizeChangeFinished"
+                         @current-change="handleCurrentChangeFinished"
+                         :current-page="currentPageFinished"
+                         :page-sizes="[10, 15, 20, 25]"
+                         :page-size="sizeFinished"
+                         layout="total, sizes, prev, pager, next, jumper"
+                         :total="currentItemCountFinished">
+          </el-pagination>
         </el-tab-pane>
       </el-tabs>
 
@@ -282,6 +311,11 @@
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
+        // finished
+        // 分页参数
+        sizeFinished: 10,
+        currentPageFinished: 1,
+        currentItemCountFinished: 0,
         shenheForm: {
           SuccessStatus: 1,
           AuditorRemark: ''
@@ -291,6 +325,10 @@
           Order: '',
           Prop: ''
         },
+        ColumnFinished: {
+          Order: '',
+          Prop: ''
+        },
         // 查询项
         searchForm: {
           Id: '',
@@ -382,8 +420,7 @@
           _currentPage: this.currentPage,
           _size: this.size,
           Order: this.Column.Order,
-          Prop: this.Column.Prop,
-          Statustype: 2
+          Prop: this.Column.Prop
         }
         let myCreateOn = []
         // 解析时间
@@ -569,11 +606,10 @@
       finishedData () {
         // 分页及列表条件
         let params = {
-          _currentPage: this.currentPage,
-          _size: this.size,
-          Order: this.Column.Order,
-          Prop: this.Column.Prop,
-          Statustype: 2
+          _currentPage: this.currentPageFinished,
+          _size: this.sizeFinished,
+          Order: this.ColumnFinished.Order,
+          Prop: this.ColumnFinished.Prop
         }
         let myCreateOn = []
         // 解析时间
@@ -588,7 +624,7 @@
         Object.assign(params, this.searchForm)
         api.getMyTaskFinished(params, this.$axios).then(res => {
           this.entityListdone = res.data.items
-          this.currentItemCount = res.data.currentItemCount
+          this.currentItemCountFinished = res.data.currentItemCount
         }).catch(err => {
           console.error(err)
         })
@@ -677,15 +713,31 @@
           return val.substring(0, 19)
         }
       },
+      handleCurrentChangeFinished (value) {
+        this.currentPageFinished = value
+        this.finishedData()
+      },
+      handleSizeChangeFinished (value) {
+        this.sizeFinished = value
+        this.currentPageFinished = 1
+        this.finishedData()
+      },
       handleCurrentChange (value) {
         this.currentPage = value
-        this.initData()
+        this.initDatas()
       },
       handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
-        this.initData()
+        this.initDatas()
       }
     }
   }
 </script>
+
+<style lang="scss">
+  .el-pagination {
+    margin: 1rem 0 2rem;
+    text-align: right;
+  }
+</style>