|
|
@@ -0,0 +1,113 @@
|
|
|
+package oilsupplier
|
|
|
+
|
|
|
+import (
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
|
|
|
+ "dashoo.cn/backend/api/business/todolist"
|
|
|
+ "dashoo.cn/backend/api/business/workflow"
|
|
|
+ . "dashoo.cn/backend/api/controllers"
|
|
|
+ "dashoo.cn/utils"
|
|
|
+ "fmt"
|
|
|
+ "strings"
|
|
|
+)
|
|
|
+
|
|
|
+type TodoListController struct {
|
|
|
+ BaseController
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// @Title 获取列表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} []supplier.OilSupplierView
|
|
|
+// @router /gettodolist [get]
|
|
|
+func (this *TodoListController) GetMyTaskEntityList() {
|
|
|
+ var todolists []todolist.TodoList
|
|
|
+ var todo todolist.TodoList
|
|
|
+
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ where := " 1=1 "
|
|
|
+ orderby := "Id"
|
|
|
+ asc := false
|
|
|
+ Order := this.GetString("Order")
|
|
|
+ where = where + " and b.Status>0"
|
|
|
+ Prop := this.GetString("Prop")
|
|
|
+ if Order != "" && Prop != "" {
|
|
|
+ orderby = Prop
|
|
|
+ if Order == "asc" {
|
|
|
+ asc = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //找出待办任务
|
|
|
+ actisvc := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var certIdList string
|
|
|
+ if actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id) != ""{
|
|
|
+ certIdList = actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
|
|
|
+ certIdList = certIdList + ","
|
|
|
+ }
|
|
|
+ if actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id) != ""{
|
|
|
+ certIdList = fmt.Sprintf("%s %s",certIdList,actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id))
|
|
|
+ certIdList = certIdList + ","
|
|
|
+ }
|
|
|
+ if actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id) != ""{
|
|
|
+ certIdList = fmt.Sprintf("%s %s",certIdList,actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id))
|
|
|
+ }
|
|
|
+ certIdList = strings.Trim(certIdList, ",")
|
|
|
+ certIdarr := strings.Split(certIdList, ",")
|
|
|
+ for i, item := range certIdarr {
|
|
|
+ idx := strings.Index(item, "-")
|
|
|
+ if idx >= 0 {
|
|
|
+ certIdarr[i] = strings.Split(item, "-")[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ certIdList = strings.Join(certIdarr, ",")
|
|
|
+ where += " and b.Id in (" + certIdList + ")"
|
|
|
+ //根据部门查询待办任务
|
|
|
+
|
|
|
+ svc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var list []supplier.OilSupplierView
|
|
|
+ //svc.GetEntities(&list, where)
|
|
|
+ svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
+
|
|
|
+ for _, item :=range list {
|
|
|
+ todo.Id = item.Id
|
|
|
+ todo.CertId = item.CertId
|
|
|
+ todo.SupplierTypeCode = item.SupplierTypeCode
|
|
|
+ todo.Type = "1"
|
|
|
+ todo.SupplierName = item.SupplierName
|
|
|
+ todo.UserName = this.User.Realname
|
|
|
+ todolists = append(todolists, todo)
|
|
|
+ }
|
|
|
+
|
|
|
+ //找出待办任务 -- 增项
|
|
|
+ whereapp := "1=1"
|
|
|
+ whereapp = whereapp + " and Status>0"
|
|
|
+ appendIdList := actisvc.GetMyTasks(workflow.OIL_APPEND_APPLY, this.User.Id)
|
|
|
+ appendIdarr := strings.Split(appendIdList, ",")
|
|
|
+ for i, item := range appendIdarr {
|
|
|
+ idx := strings.Index(item,"-")
|
|
|
+ if (idx >= 0 ) {
|
|
|
+ appendIdarr[i] = strings.Split(item, "-")[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ appendIdList = strings.Join(appendIdarr, ",")
|
|
|
+ whereapp += " and b.Id in (" + appendIdList + ")"
|
|
|
+
|
|
|
+ var listapp []suppliercertappend.OilSupplierCertAppendTodo
|
|
|
+ svcapp := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
|
|
|
+ svcapp.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertAppendName, page.CurrentPage, page.Size, orderby, asc, &listapp, whereapp)
|
|
|
+
|
|
|
+ for _, item :=range listapp {
|
|
|
+ todo.Id = item.Id
|
|
|
+ todo.Type = "2"
|
|
|
+ todo.SupplierName = item.SupplierName
|
|
|
+ todo.UserName = this.User.Realname
|
|
|
+ todo.SupplierTypeCode = item.AppendType
|
|
|
+ todolists = append(todolists, todo)
|
|
|
+ }
|
|
|
+
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = todolists
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|