|
@@ -5,6 +5,7 @@ import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
"strconv"
|
|
"strconv"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
+ "time"
|
|
|
|
|
|
|
|
"dashoo.cn/backend/api/business/accountinfo"
|
|
"dashoo.cn/backend/api/business/accountinfo"
|
|
|
"dashoo.cn/backend/api/business/company"
|
|
"dashoo.cn/backend/api/business/company"
|
|
@@ -141,6 +142,7 @@ func (this *UserController) List() {
|
|
|
keyword := this.GetString("keyword")
|
|
keyword := this.GetString("keyword")
|
|
|
username := this.GetString("username")
|
|
username := this.GetString("username")
|
|
|
departmentname := this.GetString("departmentname")
|
|
departmentname := this.GetString("departmentname")
|
|
|
|
|
+ unit := this.GetString("Unit")
|
|
|
IsCompanyUser := this.GetString("IsCompanyUser")
|
|
IsCompanyUser := this.GetString("IsCompanyUser")
|
|
|
svc := permission.GetPermissionService(utils.DBE)
|
|
svc := permission.GetPermissionService(utils.DBE)
|
|
|
organsvc := organize.GetOrganizeService(utils.DBE)
|
|
organsvc := organize.GetOrganizeService(utils.DBE)
|
|
@@ -170,6 +172,9 @@ func (this *UserController) List() {
|
|
|
if departmentname != "" {
|
|
if departmentname != "" {
|
|
|
where = where + " and DepartmentName like '%" + departmentname + "%'"
|
|
where = where + " and DepartmentName like '%" + departmentname + "%'"
|
|
|
}
|
|
}
|
|
|
|
|
+ if unit != "" {
|
|
|
|
|
+ where = where + " and Unit like '%" + unit + "%'"
|
|
|
|
|
+ }
|
|
|
total := svc.GetPagingEntitiesWithOrder(page.CurrentPage, page.Size, "Id", false, &users, where)
|
|
total := svc.GetPagingEntitiesWithOrder(page.CurrentPage, page.Size, "Id", false, &users, where)
|
|
|
|
|
|
|
|
var datainfo DataInfo
|
|
var datainfo DataInfo
|
|
@@ -242,10 +247,17 @@ func (this *UserController) AddUser() {
|
|
|
//获取组织上级组织
|
|
//获取组织上级组织
|
|
|
//var orginizeentity organize.Base_Organize
|
|
//var orginizeentity organize.Base_Organize
|
|
|
//svcorg.GetEntityById(model.DepartmentId, &orginizeentity)
|
|
//svcorg.GetEntityById(model.DepartmentId, &orginizeentity)
|
|
|
|
|
+ unitId := svcorg.GetMyUnitDepartmentId(model.DepartmentId)
|
|
|
|
|
+ var org organize.Base_Organize
|
|
|
|
|
+ svcorg.GetEntityById(unitId, &org)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
var userentity userRole.Base_User
|
|
var userentity userRole.Base_User
|
|
|
userentity.Companyid = "0"
|
|
userentity.Companyid = "0"
|
|
|
userentity.Superior = model.Superior
|
|
userentity.Superior = model.Superior
|
|
|
userentity.Roleid, _ = utils.StrTo(model.Role).Int()
|
|
userentity.Roleid, _ = utils.StrTo(model.Role).Int()
|
|
|
|
|
+ userentity.UnitId = org.Id
|
|
|
|
|
+ userentity.Unit = org.Fullname
|
|
|
if userentity.Roleid == 0 {
|
|
if userentity.Roleid == 0 {
|
|
|
//userentity.Roleid = 10000123 //普通用户
|
|
//userentity.Roleid = 10000123 //普通用户
|
|
|
}
|
|
}
|
|
@@ -571,3 +583,35 @@ func (this *UserController) Registerput() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// @Title 跟新用户二级单位
|
|
|
|
|
+// @Description 跟新用户二级单位
|
|
|
|
|
+// @Success 200 {object} organize.Base_Organize
|
|
|
|
|
+// @router /updatauser2Org [get]
|
|
|
|
|
+func (this *UserController) UpdataUser2Org() {
|
|
|
|
|
+ t := time.Now()
|
|
|
|
|
+ var userlist []userRole.Base_User
|
|
|
|
|
+ var user1 userRole.Base_User
|
|
|
|
|
+ svc := userRole.GetUserService(utils.DBE)
|
|
|
|
|
+ svc.GetEntities(&userlist, "DepartmentId != ''")
|
|
|
|
|
+ unitIdcopy := ""
|
|
|
|
|
+ fullname := ""
|
|
|
|
|
+ unitsvc := organize.GetOrganizeService(utils.DBE)
|
|
|
|
|
+ for i,user := range userlist {
|
|
|
|
|
+ unitId := unitsvc.GetMyUnitDepartmentId(user.Departmentid)
|
|
|
|
|
+ var org organize.Base_Organize
|
|
|
|
|
+ if unitIdcopy != unitId {
|
|
|
|
|
+ unitsvc.GetEntityById(unitId, &org)
|
|
|
|
|
+ fullname = org.Fullname
|
|
|
|
|
+ }
|
|
|
|
|
+ user1.UnitId,_ = strconv.Atoi(unitId)
|
|
|
|
|
+ user1.Unit = fullname
|
|
|
|
|
+ cols := []string{"UnitId", "Unit"}
|
|
|
|
|
+ unitsvc.UpdateEntityByIdCols(user.Id, &user1, cols)
|
|
|
|
|
+ unitIdcopy = unitId
|
|
|
|
|
+ fmt.Println(i)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ elapsed := time.Since(t)
|
|
|
|
|
+ fmt.Println(elapsed)
|
|
|
|
|
+}
|