dcs 1 year ago
parent
commit
e6f4e3b0ee
38 changed files with 465 additions and 1853 deletions
  1. 10 5
      virgo.core/src/main/java/com/bosshand/virgo/core/controller/UserContextController.java
  2. 0 25
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrDepartmentDao.java
  3. 0 2
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationDao.java
  4. 0 26
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationTypeDao.java
  5. 0 26
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationTypeRoleDao.java
  6. 0 28
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrRoleCodeDao.java
  7. 2 4
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrUserRoleDao.java
  8. 0 94
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrDepartment.java
  9. 135 149
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganization.java
  10. 0 89
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganizationType.java
  11. 0 47
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganizationTypeRole.java
  12. 0 51
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrRoleCode.java
  13. 32 34
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrUserRole.java
  14. 3 28
      virgo.core/src/main/java/com/bosshand/virgo/core/model/UserContext.java
  15. 56 58
      virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java
  16. 38 29
      virgo.core/src/main/java/com/bosshand/virgo/core/shiro/LoginUserDto.java
  17. 41 6
      virgo.core/src/main/java/com/bosshand/virgo/core/shiro/VirgoAuthenticationFilter.java
  18. 103 0
      virgo.core/src/main/java/com/bosshand/virgo/core/utils/WeChatUtil.java
  19. 3 0
      virgo.core/src/main/resources/application.properties
  20. 0 52
      virgo.core/src/main/resources/mapper/MgrDepartmentMapper.xml
  21. 5 13
      virgo.core/src/main/resources/mapper/MgrOrganizationMapper.xml
  22. 0 67
      virgo.core/src/main/resources/mapper/MgrOrganizationTypeMapper.xml
  23. 0 59
      virgo.core/src/main/resources/mapper/MgrOrganizationTypeRoleMapper.xml
  24. 0 78
      virgo.core/src/main/resources/mapper/MgrRoleCodeMapper.xml
  25. 2 5
      virgo.core/src/main/resources/mapper/MgrUserRoleMapper.xml
  26. 10 29
      virgo.manager/src/main/java/com/bosshand/virgo/controller/AdminController.java
  27. 0 82
      virgo.manager/src/main/java/com/bosshand/virgo/controller/DepartmentController.java
  28. 0 67
      virgo.manager/src/main/java/com/bosshand/virgo/controller/OrganizationTypeController.java
  29. 0 61
      virgo.manager/src/main/java/com/bosshand/virgo/controller/OrganizationTypeRoleController.java
  30. 0 71
      virgo.manager/src/main/java/com/bosshand/virgo/controller/RoleCodeController.java
  31. 1 1
      virgo.manager/src/main/java/com/bosshand/virgo/controller/UserInfoController.java
  32. 0 254
      virgo.manager/src/main/java/com/bosshand/virgo/service/DepartmentService.java
  33. 12 37
      virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationService.java
  34. 0 83
      virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationTypeRoleService.java
  35. 0 46
      virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationTypeService.java
  36. 0 87
      virgo.manager/src/main/java/com/bosshand/virgo/service/RoleCodeService.java
  37. 9 57
      virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java
  38. 3 3
      virgo.wzfrontend/target/classes/static/js/index.min.js

+ 10 - 5
virgo.core/src/main/java/com/bosshand/virgo/core/controller/UserContextController.java

@@ -1,5 +1,6 @@
 package com.bosshand.virgo.core.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.bosshand.virgo.core.model.MgrOrganization;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.model.UserContext;
@@ -61,9 +62,15 @@ public class UserContextController {
 	@RequestMapping(value = "/verify/{phone}/{vCode}", method = RequestMethod.GET)
 	public Response verificationCode(@PathVariable String phone, @PathVariable String vCode) {
 		if (CodeCache.getKey(phone).equals(vCode)) {
-			return Response.fail(405, "手机验证码有误");
+			return Response.ok("验证通过!");
 		}
-		return Response.ok();
+		return Response.fail(405, "手机验证码有误");
+	}
+
+	@ApiOperation(value="获取微信手机号", notes="getPhoneNumber 返回的 code 与 wx.login 返回的 code 作用是不一样的,不能混用")
+	@RequestMapping(value = "/verify/getCode", method = RequestMethod.POST)
+	public Response getWxPhone(@RequestBody JSONObject json) {
+		return Response.ok(mgrUserService.phoneNumber(json.getString("code")));
 	}
 
 	@ApiOperation(value="登录注册", notes="登录注册")
@@ -74,9 +81,7 @@ public class UserContextController {
 		if(!subject.isAuthenticated()) {
 			return Response.fail(Constant.CODE_UNKNOWN, Constant.RET_UNKNOWN);
 		}
-    	Map<String,String> map = new HashMap<String,String>();
-    	map.put("token", subject.getSession().getId().toString());
-		return Response.ok(map);
+		return Response.ok();
 	}
 	
 	@ApiOperation(value="退出登录", notes="退出登录")

+ 0 - 25
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrDepartmentDao.java

@@ -1,25 +0,0 @@
-package com.bosshand.virgo.core.dao;
-
-import com.bosshand.virgo.core.model.MgrDepartment;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-@Mapper
-public interface MgrDepartmentDao {
-
-    public MgrDepartment get(int id);
-
-    public int insert(MgrDepartment department);
-
-    public int batchiInsert(List<MgrDepartment> list);
-
-    public List<MgrDepartment> getList(MgrDepartment department);
-
-    public List<MgrDepartment> getProjectId(long projectId);
-
-    public int delete(int id);
-
-    public int update(MgrDepartment department);
-
-}

+ 0 - 2
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationDao.java

@@ -22,8 +22,6 @@ public interface MgrOrganizationDao {
 
 	public List<MgrOrganization> getByOrganizationName(String name);
 
-	public List<MgrOrganization> getByOrganizationType(long OrganizationTypeId);
-
 	public List<MgrOrganization> getList(Map<String, Object> data);
 
 	public int getTotalCount(Map<String, Object> data);

+ 0 - 26
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationTypeDao.java

@@ -1,26 +0,0 @@
-package com.bosshand.virgo.core.dao;
-
-import org.apache.ibatis.annotations.Mapper;
-
-import com.bosshand.virgo.core.model.MgrOrganizationType;
-
-import java.util.List;
-
-@Mapper
-public interface MgrOrganizationTypeDao {
-
-	MgrOrganizationType getById(long id);
-
-	public MgrOrganizationType get(long id);
-
-	public List<MgrOrganizationType> getList();
-
-	public List<MgrOrganizationType> getListOnlyName();
-
-	public int insert(MgrOrganizationType mgrOrganizationType);
-
-	public int update(MgrOrganizationType mgrOrganizationType);
-
-	public int delete(long id);
-
-}

+ 0 - 26
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationTypeRoleDao.java

@@ -1,26 +0,0 @@
-package com.bosshand.virgo.core.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Mapper;
-
-import com.bosshand.virgo.core.model.MgrOrganizationTypeRole;
-
-@Mapper
-public interface MgrOrganizationTypeRoleDao {
-	
-	public List<MgrOrganizationTypeRole> organizationTypeId(long organizationTypeId);
-
-	public List<MgrOrganizationTypeRole> getByOrganizationTypeId(long organizationTypeId);
-
-	public List<MgrOrganizationTypeRole> getCodes(long organizationTypeId, String[] codes);
-
-	public MgrOrganizationTypeRole getCode(long organizationTypeId, String code);
-
-	public int insert(MgrOrganizationTypeRole mgrOrganizationTypeRole);
-
-	public int delete(long id);
-
-	public int update(MgrOrganizationTypeRole mgrOrganizationTypeRole);
-
-}

+ 0 - 28
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrRoleCodeDao.java

@@ -1,28 +0,0 @@
-package com.bosshand.virgo.core.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Mapper;
-
-import com.bosshand.virgo.core.model.MgrRoleCode;
-
-@Mapper
-public interface MgrRoleCodeDao {
-	
-	public List<MgrRoleCode> getListByIds(String[] ids);
-
-	public List<MgrRoleCode> getList();
-
-	public int insert(MgrRoleCode mgrRoleCode);
-
-	public int delete(long id);
-
-	public int update(MgrRoleCode mgrRoleCode);
-
-	public List<MgrRoleCode> getByOrganizationTypeId(long organizationTypeId);
-
-	public MgrRoleCode getCode(long organizationTypeId, String code);
-
-	public List<MgrRoleCode> getCodes(long organizationTypeId, String[] codes);
-	
-}

+ 2 - 4
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrUserRoleDao.java

@@ -1,10 +1,9 @@
 package com.bosshand.virgo.core.dao;
 
-import java.util.List;
-
+import com.bosshand.virgo.core.model.MgrUserRole;
 import org.apache.ibatis.annotations.Mapper;
 
-import com.bosshand.virgo.core.model.MgrUserRole;
+import java.util.List;
 
 @Mapper
 public interface MgrUserRoleDao {
@@ -16,7 +15,6 @@ public interface MgrUserRoleDao {
 	public List<MgrUserRole> getOrganizationId(long organizationId);
 	public void updateResources(MgrUserRole userRole);
 	public MgrUserRole getUser(long userId, long organizationId);
-
 	public List<MgrUserRole> getList();
 	public List<MgrUserRole> getListByOrganizationId(long organizationId);
 }

+ 0 - 94
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrDepartment.java

@@ -1,94 +0,0 @@
-package com.bosshand.virgo.core.model;
-
-import java.util.List;
-
-public class MgrDepartment {
-
-	private int id;
-
-	private String name;
-
-	private long projectId;
-
-	private long organizationId;
-
-	private long templateId;
-
-	private int parentId;
-	
-	private List<MgrDepartment> children;
-	
-	private List<MgrUser> users;
-	
-	public MgrDepartment() {}
-	
-	public MgrDepartment(long projectId, long organizationId) {
-		this.projectId = projectId;
-		this.organizationId = organizationId;
-	}
-
-	public int getId() {
-		return id;
-	}
-
-	public void setId(int id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public long getProjectId() {
-		return projectId;
-	}
-
-	public void setProjectId(long projectId) {
-		this.projectId = projectId;
-	}
-
-	public long getOrganizationId() {
-		return organizationId;
-	}
-
-	public void setOrganizationId(long organizationId) {
-		this.organizationId = organizationId;
-	}
-
-	public long getTemplateId() {
-		return templateId;
-	}
-
-	public void setTemplateId(long templateId) {
-		this.templateId = templateId;
-	}
-
-	public int getParentId() {
-		return parentId;
-	}
-
-	public void setParentId(int parentId) {
-		this.parentId = parentId;
-	}
-
-	public List<MgrDepartment> getChildren() {
-		return children;
-	}
-
-	public void setChildren(List<MgrDepartment> children) {
-		this.children = children;
-	}
-
-	public List<MgrUser> getUsers() {
-		return users;
-	}
-
-	public void setUsers(List<MgrUser> users) {
-		this.users = users;
-	}
-
-}

+ 135 - 149
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganization.java

@@ -1,155 +1,141 @@
 package com.bosshand.virgo.core.model;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+
 import java.util.Date;
-import java.util.List;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
+public class MgrOrganization implements BaseModel {
+
+    private static final long serialVersionUID = 1L;
+
+    private long id;
+
+    private String name;
+
+    private String contact;
+
+    private String contactTel;
+
+    private String address;
+
+    private String businessLicense;
+
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date registerDate;
+
+    private int status;
+
+    private int state;
+
+    /**
+     * 统计组织下单位工程下用户数量
+     */
+    private int projectUserCount;
+
+    public int getProjectUserCount() {
+        return projectUserCount;
+    }
+
+    public void setProjectUserCount(int projectUserCount) {
+        this.projectUserCount = projectUserCount;
+    }
+
+    private int organizedDataCenter;
+
+    private String organizationCode;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getContact() {
+        return contact;
+    }
+
+    public void setContact(String contact) {
+        this.contact = contact;
+    }
+
+    public String getContactTel() {
+        return contactTel;
+    }
+
+    public void setContactTel(String contactTel) {
+        this.contactTel = contactTel;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getBusinessLicense() {
+        return businessLicense;
+    }
+
+    public void setBusinessLicense(String businessLicense) {
+        this.businessLicense = businessLicense;
+    }
+
+    public Date getRegisterDate() {
+        return registerDate;
+    }
+
+    public void setRegisterDate(Date registerDate) {
+        this.registerDate = registerDate;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public int getState() {
+        return state;
+    }
+
+    public void setState(int state) {
+        this.state = state;
+    }
+
+    public int getOrganizedDataCenter() {
+        return organizedDataCenter;
+    }
+
+    public void setOrganizedDataCenter(int organizedDataCenter) {
+        this.organizedDataCenter = organizedDataCenter;
+    }
+
+    public String getOrganizationCode() {
+        return organizationCode;
+    }
+
+    public void setOrganizationCode(String organizationCode) {
+        this.organizationCode = organizationCode;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        MgrOrganization organization = (MgrOrganization) obj;
+        return this.id == organization.getId();
+    }
 
-public class MgrOrganization implements BaseModel  {
-
-	private static final long serialVersionUID = 1L;
-
-	private long id;
-
-	private String name;
-	
-	private String contact;
-	
-	private String contactTel;
-	
-	private String address;
-	
-	private String businessLicense;
-	
-	@JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
-	private Date registeDate;
-	
-	private int status;
-	
-	private int state;
-	
-	// dto 统计组织下单位工程下用户数量
-	private int projectUserCount;
-	
-	public int getProjectUserCount() {
-		return projectUserCount;
-	}
-	public void setProjectUserCount(int projectUserCount) {
-		this.projectUserCount = projectUserCount;
-	}
-
-	// dto 统计组织下单位工程下用户
-	List<MgrDepartment> departmentList;
-
-	public List<MgrDepartment> getDepartmentList() {
-		return departmentList;
-	}
-
-	public void setDepartmentList(List<MgrDepartment> departmentList) {
-		this.departmentList = departmentList;
-	}
-
-	private long mgrOrganizationTypeId;
-	
-	private String mgrOrganizationTypeName;
-	
-	private int organizedDataCenter;
-	
-	private String organizationCode; 
-	
-	public long getId() {
-		return id;
-	}
-	public void setId(long id) {
-		this.id = id;
-	}
-	public String getName() {
-		return name;
-	}
-	public void setName(String name) {
-		this.name = name;
-	}
-	public String getContact() {
-		return contact;
-	}
-	public void setContact(String contact) {
-		this.contact = contact;
-	}
-	public String getContactTel() {
-		return contactTel;
-	}
-	public void setContactTel(String contactTel) {
-		this.contactTel = contactTel;
-	}
-	public String getAddress() {
-		return address;
-	}
-	public void setAddress(String address) {
-		this.address = address;
-	}
-	public String getBusinessLicense() {
-		return businessLicense;
-	}
-	public void setBusinessLicense(String businessLicense) {
-		this.businessLicense = businessLicense;
-	}
-	public Date getRegisteDate() {
-		return registeDate;
-	}
-	public void setRegisteDate(Date registeDate) {
-		this.registeDate = registeDate;
-	}
-	public int getStatus() {
-		return status;
-	}
-	public void setStatus(int status) {
-		this.status = status;
-	}
-	public int getState() {
-		return state;
-	}
-	public void setState(int state) {
-		this.state = state;
-	}
-	public long getMgrOrganizationTypeId() {
-		return mgrOrganizationTypeId;
-	}
-	public void setMgrOrganizationTypeId(long mgrOrganizationTypeId) {
-		this.mgrOrganizationTypeId = mgrOrganizationTypeId;
-	}
-	public int getOrganizedDataCenter() {
-		return organizedDataCenter;
-	}
-	public void setOrganizedDataCenter(int organizedDataCenter) {
-		this.organizedDataCenter = organizedDataCenter;
-	}
-	public String getMgrOrganizationTypeName() {
-		return mgrOrganizationTypeName;
-	}
-	public void setMgrOrganizationTypeName(String mgrOrganizationTypeName) {
-		this.mgrOrganizationTypeName = mgrOrganizationTypeName;
-	}
-	
-	public String getOrganizationCode() {
-		return organizationCode;
-	}
-	public void setOrganizationCode(String organizationCode) {
-		this.organizationCode = organizationCode;
-	}
-	
-	@Override
-	public String toString() {
-		return "MgrOrganization [id=" + id + ", name=" + name + ", contact=" + contact + ", contactTel=" + contactTel
-				+ ", address=" + address + ", businessLicense=" + businessLicense + ", registeDate=" + registeDate
-				+ ", status=" + status + ", mgrOrganizationTypeId=" + mgrOrganizationTypeId
-				+ ", mgrOrganizationTypeName=" + mgrOrganizationTypeName + ", organizedDataCenter="
-				+ organizedDataCenter + ", organizationCode=" + organizationCode + "]";
-	}
-	
-	@Override
-	public boolean equals(Object obj) {
-		MgrOrganization organization = (MgrOrganization) obj;
-		return this.id == organization.getId();
-	}
-	
 }

+ 0 - 89
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganizationType.java

@@ -1,89 +0,0 @@
-package com.bosshand.virgo.core.model;
-
-import java.util.List;
-
-public class MgrOrganizationType implements BaseModel {
-
-	private static final long serialVersionUID = 1L;
-
-	private long id;
-
-	private String name;
-
-	private String resource;
-
-	private String comment;
-	
-	private String framework;
-	
-	private String hierarchy;
-	
-	private int sequence;
-	
-	private List<MgrOrganization> organizations;
-
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getResource() {
-		return resource;
-	}
-
-	public void setResource(String resource) {
-		this.resource = resource;
-	}
-
-	public String getComment() {
-		return comment;
-	}
-
-	public void setComment(String comment) {
-		this.comment = comment;
-	}
-
-	public List<MgrOrganization> getOrganizations() {
-		return organizations;
-	}
-
-	public void setOrganizations(List<MgrOrganization> organizations) {
-		this.organizations = organizations;
-	}
-
-	public String getFramework() {
-		return framework;
-	}
-
-	public void setFramework(String framework) {
-		this.framework = framework;
-	}
-
-	public String getHierarchy() {
-		return hierarchy;
-	}
-
-	public void setHierarchy(String hierarchy) {
-		this.hierarchy = hierarchy;
-	}
-
-	public int getSequence() {
-		return sequence;
-	}
-
-	public void setSequence(int sequence) {
-		this.sequence = sequence;
-	}
-	
-}

+ 0 - 47
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganizationTypeRole.java

@@ -1,47 +0,0 @@
-package com.bosshand.virgo.core.model;
-
-public class MgrOrganizationTypeRole implements BaseModel{
-	
-	private static final long serialVersionUID = 1L;
-
-	private long id;
-
-	private String code;
-
-	private String name;
-
-	private long organizationTypeId;
-
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public String getCode() {
-		return code;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public long getOrganizationTypeId() {
-		return organizationTypeId;
-	}
-
-	public void setOrganizationTypeId(long organizationTypeId) {
-		this.organizationTypeId = organizationTypeId;
-	}
-
-}

+ 0 - 51
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrRoleCode.java

@@ -1,51 +0,0 @@
-package com.bosshand.virgo.core.model;
-
-public class MgrRoleCode implements BaseModel{
-	
-	public static final String ROLE_SUPER_ADMIN = "superAdmin";
-	public static final String ROLE_ORG_ADMIN = "orgAdmin";
-	public static final String ROLE_REGULAR_USER = "regularUser";
-	
-	private static final long serialVersionUID = -6466564632386191827L;
-	
-	private long id;
-	
-	private String code;
-	
-	private String name;
-	
-	private long organizationTypeId;
-
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public String getCode() {
-		return code;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public long getOrganizationTypeId() {
-		return organizationTypeId;
-	}
-
-	public void setOrganizationTypeId(long organizationTypeId) {
-		this.organizationTypeId = organizationTypeId;
-	}
-
-}

+ 32 - 34
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrUserRole.java

@@ -3,75 +3,73 @@ package com.bosshand.virgo.core.model;
 public class MgrUserRole implements BaseModel {
 	
 	private int id;
+
 	private long userId;
+
 	private long organizationId;
+
 	private String menus;
+
 	private String resources;
+
 	private String roles;
-	private String departments;
-	private String organizationTypeRoles;
+
 	private boolean admin;
-	
+
 	public int getId() {
 		return id;
 	}
+
 	public void setId(int id) {
 		this.id = id;
 	}
+
+	public long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(long userId) {
+		this.userId = userId;
+	}
+
+	public long getOrganizationId() {
+		return organizationId;
+	}
+
+	public void setOrganizationId(long organizationId) {
+		this.organizationId = organizationId;
+	}
+
 	public String getMenus() {
 		return menus;
 	}
+
 	public void setMenus(String menus) {
 		this.menus = menus;
 	}
+
 	public String getResources() {
 		return resources;
 	}
+
 	public void setResources(String resources) {
 		this.resources = resources;
 	}
+
 	public String getRoles() {
 		return roles;
 	}
+
 	public void setRoles(String roles) {
 		this.roles = roles;
 	}
-	public long getUserId() {
-		return userId;
-	}
-	public void setUserId(long userId) {
-		this.userId = userId;
-	}
-	public String getDepartments() {
-		return departments;
-	}
-	public void setDepartments(String departments) {
-		this.departments = departments;
-	}
-	public String getOrganizationTypeRoles() {
-		return organizationTypeRoles;
-	}
-	public void setOrganizationTypeRoles(String organizationTypeRoles) {
-		this.organizationTypeRoles = organizationTypeRoles;
-	}
-	public long getOrganizationId() {
-		return organizationId;
-	}
-	public void setOrganizationId(long organizationId) {
-		this.organizationId = organizationId;
-	}
+
 	public boolean isAdmin() {
 		return admin;
 	}
+
 	public void setAdmin(boolean admin) {
 		this.admin = admin;
 	}
-	@Override
-	public String toString() {
-		return "MgrUserRole [id=" + id + ", userId=" + userId + ", organizationId=" + organizationId + ", menus="
-				+ menus + ", resources=" + resources + ", roles=" + roles + ", departments=" + departments
-				+ ", organizationTypeRoles=" + organizationTypeRoles + ", admin=" + admin + "]";
-	}
-	
 }
 

+ 3 - 28
virgo.core/src/main/java/com/bosshand/virgo/core/model/UserContext.java

@@ -2,8 +2,6 @@ package com.bosshand.virgo.core.model;
 
 import java.util.List;
 
-//This context are for user login in UI.
-@SuppressWarnings("serial")
 public class UserContext implements BaseModel{
 	
 	private long userId;
@@ -29,11 +27,7 @@ public class UserContext implements BaseModel{
 	private int status;
 
 	private List<MgrOrganization> organizationList;
-	
-	private List<MgrRoleCode> roleList;
-	
-	private List<MgrOrganizationTypeRole> organizationTypeRoles;
-	
+
 	private long organizationId;
 	
 	private long projectId;
@@ -83,22 +77,6 @@ public class UserContext implements BaseModel{
 	public void setUserName(String userName) {
 		this.userName = userName;
 	}
-	
-	public List<MgrRoleCode> getRoleList() {
-		return roleList;
-	}
-
-	public void setRoleList(List<MgrRoleCode> roleList) {
-		this.roleList = roleList;
-	}
-
-	public List<MgrOrganizationTypeRole> getOrganizationTypeRoles() {
-		return organizationTypeRoles;
-	}
-
-	public void setOrganizationTypeRoles(List<MgrOrganizationTypeRole> organizationTypeRoles) {
-		this.organizationTypeRoles = organizationTypeRoles;
-	}
 
 	public long getOrganizationId() {
 		return organizationId;
@@ -255,8 +233,7 @@ public class UserContext implements BaseModel{
 		return null;
 	}
 
-	public static UserContext getUserContext(MgrUser user, List<MgrOrganization> organizationList, MgrOrganization currentOrganization,
-											 MgrUserRole userRole, List<MgrRoleCode> roleList, List<MgrOrganizationTypeRole> organizationTypeRoles) {
+	public static UserContext getUserContext(MgrUser user, List<MgrOrganization> organizationList, MgrOrganization currentOrganization, MgrUserRole userRole) {
 		if (user != null) {
 			UserContext flowUser = new UserContext();
 			flowUser.setUserId(user.getId());
@@ -271,21 +248,19 @@ public class UserContext implements BaseModel{
 			flowUser.setPracticeCertificate(user.getPracticeCertificate());
 			flowUser.setPracticeSeal(user.getPracticeSeal());
 			flowUser.setProjectId(user.getLastProjectId());
+			flowUser.setOrganization(currentOrganization);
 			flowUser.setOrganizationList(organizationList);
 			if (currentOrganization != null) {
 				flowUser.setOrganizationId(currentOrganization.getId());
 			} else {
 				flowUser.setOrganizationId(-1);
 			}
-			flowUser.setOrganization(currentOrganization);
 			if (userRole != null) {
 				flowUser.setAdmin(userRole.isAdmin());
 				flowUser.setMenu(userRole.getMenus());
 				flowUser.setResource(userRole.getResources());
 			}
 			flowUser.setUserRole(userRole);
-			flowUser.setRoleList(roleList);
-			flowUser.setOrganizationTypeRoles(organizationTypeRoles);
 			return flowUser;
 		}
 		return null;

+ 56 - 58
virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java

@@ -1,9 +1,13 @@
 package com.bosshand.virgo.core.service;
 
-import com.alibaba.druid.util.StringUtils;
-import com.bosshand.virgo.core.dao.*;
+import com.alibaba.fastjson.JSONObject;
+import com.bosshand.virgo.core.dao.MgrOrganizationDao;
+import com.bosshand.virgo.core.dao.MgrResourceDao;
+import com.bosshand.virgo.core.dao.MgrUserDao;
+import com.bosshand.virgo.core.dao.MgrUserRoleDao;
 import com.bosshand.virgo.core.model.*;
 import com.bosshand.virgo.core.utils.Utils;
+import com.bosshand.virgo.core.utils.WeChatUtil;
 import com.bosshand.virgo.exception.Constant;
 import com.bosshand.virgo.exception.ServiceException;
 import org.apache.shiro.subject.Subject;
@@ -13,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -25,48 +28,74 @@ public class MgrUserService {
 	
 	@Autowired
 	private MgrUserRoleDao mgrUserRoleDao;
-	
-	@Autowired
-	private MgrRoleCodeDao mgrRoleCodeDao;
-	
+
 	@Autowired
 	private MgrOrganizationDao mgrOrganizationDao;
 	
 	@Autowired
 	private MgrResourceDao mgrResourceDao;
-	
-	@Autowired
-	private MgrOrganizationTypeDao mgrOrganizationTypeDao;
-	
-	@Autowired
-	private MgrOrganizationTypeRoleDao mgrOrganizationTypeRoleDao;
 
 	static Logger log = LoggerFactory.getLogger(MgrUserService.class);
 
+	/**
+	 * 获取token调用凭证
+	 */
+	public String wxToken() {
+		String access_token = null;
+		//校验缓存里面的token是否存在或者过期
+		if (false) {
+
+		} else {
+			//地址
+			String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx3c006d364161d240&secret=2b956bf512387a74eab612d99063d7c5";
+			//请求
+			String str = WeChatUtil.httpRequest(url, "GET", null);
+			log.info("wxToken=" + str);
+			JSONObject jsonObject = JSONObject.parseObject(str);
+			access_token = jsonObject.getString("access_token");
+		}
+		return access_token;
+	}
+
+	/**
+	 * 获取微信小程序手机号码
+	 */
+	public String phoneNumber(String code) {
+		String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + wxToken();
+		JSONObject json = new JSONObject();
+		json.put("code", code);
+		String str = WeChatUtil.httpPost(url, json);
+		log.info("phoneNumber=" + str);
+		JSONObject jsonObject = JSONObject.parseObject(str);
+		String phoneNumber = jsonObject.getJSONObject("phone_info").getString("phoneNumber");
+		return phoneNumber;
+	}
+
+	/**
+	 * 微信小程序登录
+	 */
+	public String wxLogin(String code) {
+		//微信接口服务,通过调用微信接口服务中jscode2session接口获取到openid和session_key
+		String url = "https://api.weixin.qq.com/sns/jscode2session?appid=wx3c006d364161d240&secret=2b956bf512387a74eab612d99063d7c5&js_code=" + code + "&grant_type=authorization_code";
+		String str = WeChatUtil.httpRequest(url, "GET", null);
+		log.info("wxLogin=" + str);
+		return str;
+	}
+
 	public void delete(int userId) {
 		mgrUserDao.delete(userId);
 	}
 
 	@Transactional
-	public void register(MgrUser user, long typeId) {
-		MgrOrganizationType type = mgrOrganizationTypeDao.get(typeId);
-		if (type == null) {
-			throw new ServiceException("Organization Type not found", Constant.RET_BAD_REQUEST);
-		}
+	public void register(MgrUser user) {
 		MgrOrganization mgrOrganization = new MgrOrganization();
-		mgrOrganization.setMgrOrganizationTypeId(typeId);
-		mgrOrganization.setMgrOrganizationTypeName(type.getName());
 		mgrOrganization.setName(null);
-		mgrOrganization.setRegisteDate(new Date());
 		mgrOrganization.setContact(user.getName());
 		mgrOrganization.setContactTel(user.getPhone());
-		mgrOrganization.setOrganizationCode(Utils.getPinYinHeadChar(type.getName() + Utils.random(8)));
+		mgrOrganization.setOrganizationCode("CZF" + Utils.random(8));
 		mgrOrganizationDao.insert(mgrOrganization);
 
-		user.setLastOrganizationId(mgrOrganization.getId());
-
 		long userId = 0;
-
 		MgrUser us = mgrUserDao.getByPhone(user.getPhone());
 		if (us != null) {
 			us.setLastOrganizationId(mgrOrganization.getId());
@@ -103,7 +132,6 @@ public class MgrUserService {
 		if(this.isSupperAdmin(user)) {
 			return mgrOrganizationDao.listAll();
 		}
-		
 		List<MgrUserRole> userRoleList = getUserRoles(user);
 		List<Long> ids = new LinkedList<Long>();
 		userRoleList.forEach(r -> ids.add(r.getOrganizationId()));
@@ -143,18 +171,6 @@ public class MgrUserService {
 		return null;
 	}
 
-	public List<MgrRoleCode> getRoleCodeList(MgrUserRole userRole) {
-		if (userRole != null && !StringUtils.isEmpty(userRole.getRoles())) {
-			String[] roleIds = userRole.getRoles().split(",");
-			return mgrRoleCodeDao.getListByIds(roleIds);
-		}
-		return null;
-	}
-	
-	public List<MgrOrganizationTypeRole> getOrganizationTypeRoleList(long organizationTypeId){
-		return mgrOrganizationTypeRoleDao.organizationTypeId(organizationTypeId);
-	}
-	
 	public void switchOrganization(MgrUser user, MgrOrganization organization) {
 		user.setLastOrganizationId(organization.getId());
 		mgrUserDao.updateLastOrganizationId(user);
@@ -168,10 +184,6 @@ public class MgrUserService {
 	public MgrResource getDefaultResource() {
 		return mgrResourceDao.defaultResource();
 	}
-	
-	public MgrOrganizationType getOrganizationType(long id) {
-		return mgrOrganizationTypeDao.getById(id);
-	}
 
 	//store user context into session. This is not good place to put those code.
 	public void loadContext(Subject subject) {
@@ -223,29 +235,15 @@ public class MgrUserService {
     				resources = resource.getData();
     				menus = resource.getComment();
     			}
-    		}else {
-    			MgrOrganizationType organizationType = getOrganizationType(currentOrganization.getMgrOrganizationTypeId());
-    			if(organizationType != null) {
-    				resources = organizationType.getResource();
-    				menus = organizationType.getComment();
-    			}
     		}
     		currentUserRole.setResources(resources);
     		currentUserRole.setMenus(menus);
     	}
-    	
-    	//load role list
-    	List<MgrRoleCode> roleCodeList = getRoleCodeList(currentUserRole);
-    	
-    	List<MgrOrganizationTypeRole> organizationTypeRoles = null;
-    	if(roleCodeList != null && roleCodeList.size() > 0) {
-    		organizationTypeRoles = getOrganizationTypeRoleList(roleCodeList.get(0).getOrganizationTypeId());
-    	}
-    	
+
     	subject.getSession().setTimeout(25920000000L);
     	subject.getSession().setAttribute("USER",user);
     	
-    	UserContext context = UserContext.getUserContext(user, organizationList, currentOrganization, currentUserRole, roleCodeList, organizationTypeRoles);
+    	UserContext context = UserContext.getUserContext(user, organizationList, currentOrganization, currentUserRole);
     	subject.getSession().setAttribute("USERCONTEXT", context);
 		
 	}

+ 38 - 29
virgo.core/src/main/java/com/bosshand/virgo/core/shiro/LoginUserDto.java

@@ -2,33 +2,42 @@ package com.bosshand.virgo.core.shiro;
 
 public class LoginUserDto {
 
-	private String phone;
-
-	private String phoneCode;
-
-	private long organizationTypeId;
-
-	public String getPhone() {
-		return phone;
-	}
-
-	public void setPhone(String phone) {
-		this.phone = phone;
-	}
-
-	public String getPhoneCode() {
-		return phoneCode;
-	}
-
-	public void setPhoneCode(String phoneCode) {
-		this.phoneCode = phoneCode;
-	}
-
-	public long getOrganizationTypeId() {
-		return organizationTypeId;
-	}
-
-	public void setOrganizationTypeId(long organizationTypeId) {
-		this.organizationTypeId = organizationTypeId;
-	}
+    /**
+     * 手机号
+     */
+    private String phone;
+
+    /**
+     * 手机号验证码
+     */
+    private String phoneCode;
+
+    /**
+     * 微信code
+     */
+    private String code;
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getPhoneCode() {
+        return phoneCode;
+    }
+
+    public void setPhoneCode(String phoneCode) {
+        this.phoneCode = phoneCode;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
 }

+ 41 - 6
virgo.core/src/main/java/com/bosshand/virgo/core/shiro/VirgoAuthenticationFilter.java

@@ -2,6 +2,7 @@ package com.bosshand.virgo.core.shiro;
 
 import com.alibaba.druid.util.StringUtils;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.response.Response;
 import com.bosshand.virgo.core.service.MgrUserService;
@@ -40,10 +41,21 @@ public class VirgoAuthenticationFilter extends AuthenticatingFilter {
 		this.mgrUserService = mgrUserService;
 	}
 
+	private String wxJson = null;
+
+	private void init(String wxJson) {
+		this.wxJson = wxJson;
+	}
+
+	private void release() {
+		this.wxJson = null;
+	}
+
 	@Override
 	protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
 		String phone = null;
 		String phoneCode = null;
+		String wxCode = null;
 		LoginUserDto dto = null;
 		try {
 			BufferedReader streamReader = new BufferedReader(new InputStreamReader(request.getInputStream(), "UTF-8"));
@@ -58,13 +70,30 @@ public class VirgoAuthenticationFilter extends AuthenticatingFilter {
 			ObjectMapper om = new ObjectMapper();
 			dto = om.readValue(responseStrBuilder.toString(), LoginUserDto.class);
 
+			// 微信注册登录
+			wxCode = dto.getCode();
+			if (wxCode != null) {
+				MgrUser user = mgrUserService.getByPhone(dto.getPhone());
+				init(mgrUserService.wxLogin(wxCode));
+				if (user != null) {
+					return createToken(dto.getPhone(), wxCode, request, response);
+				} else {
+					//注册
+					MgrUser u = new MgrUser();
+					u.setPhone(dto.getPhone());
+					mgrUserService.register(u);
+					return createToken(dto.getPhone(), wxCode, request, response);
+				}
+			}
+
+			// 超级管理员登录
 			if (CodeCache.superAdminPhone.equals(dto.getPhone())) {
 				CodeCache.setKey(dto.getPhone(), CodeCache.superAdminPhoneCode);
 				return createToken(dto.getPhone(), CodeCache.superAdminPhoneCode, request, response);
 			}
 
+			// 手机号验证码注册登录
 			String code = CodeCache.getKey(dto.getPhone());
-
 			MgrUser user = mgrUserService.getByPhone(dto.getPhone());
 			if (user != null) {
 				if (dto.getPhoneCode().equals(code)) {
@@ -75,7 +104,7 @@ public class VirgoAuthenticationFilter extends AuthenticatingFilter {
 				//注册
 				MgrUser u = new MgrUser();
 				u.setPhone(dto.getPhone());
-				mgrUserService.register(u, dto.getOrganizationTypeId());
+				mgrUserService.register(u);
 				phone = dto.getPhone();
 				phoneCode = code;
 			}
@@ -87,12 +116,18 @@ public class VirgoAuthenticationFilter extends AuthenticatingFilter {
 	}
 	
 	@Override
-    protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
+	protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
 		if (isLoginRequest(request, response)) {
 			mgrUserService.loadContext(subject);
-        	Map<String,String> map = new HashMap<String,String>();
-        	map.put("token", subject.getSession().getId().toString());
-        	response.getWriter().write(JSON.toJSONString(Response.ok(map)));
+			if (wxJson != null) {
+				JSONObject jsonObject = JSONObject.parseObject(wxJson);
+				jsonObject.put("token", subject.getSession().getId().toString());
+				response.getWriter().write(JSON.toJSONString(Response.ok(jsonObject)));
+			} else {
+				Map<String, String> map = new HashMap<String, String>();
+				map.put("token", subject.getSession().getId().toString());
+				response.getWriter().write(JSON.toJSONString(Response.ok(map)));
+			}
 		}
 		return false;
 	}

+ 103 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/utils/WeChatUtil.java

@@ -0,0 +1,103 @@
+package com.bosshand.virgo.core.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import javax.net.ssl.HttpsURLConnection;
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
+
+public class WeChatUtil {
+
+    public static String httpRequest(String requestUrl, String requestMethod, String output) {
+        try {
+            URL url = new URL(requestUrl);
+            HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setRequestMethod(requestMethod);
+            if (null != output) {
+                OutputStream outputStream = connection.getOutputStream();
+                outputStream.write(output.getBytes(StandardCharsets.UTF_8));
+                outputStream.close();
+            }
+            // 从输入流读取返回内容
+            InputStream inputStream = connection.getInputStream();
+            InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
+            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
+            String str;
+            StringBuilder buffer = new StringBuilder();
+            while ((str = bufferedReader.readLine()) != null) {
+                buffer.append(str);
+            }
+            bufferedReader.close();
+            inputStreamReader.close();
+            inputStream.close();
+            connection.disconnect();
+            return buffer.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+
+    /**
+     * 向指定 URL 发送POST方法的请求
+     *
+     * @param url  发送请求的 URL
+     * @param json 请求参数,请求参数应该是 json 的形式。
+     * @return 所代表远程资源的响应结果
+     */
+    public static String httpPost(String url, JSONObject json) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent",
+                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            // 发送请求参数
+
+            out.print(json);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result = result.concat(line);
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        //使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+}

+ 3 - 0
virgo.core/src/main/resources/application.properties

@@ -44,3 +44,6 @@ spring.redis.jedis.pool.max-idle=8
 spring.redis.jedis.pool.min-idle=0
 spring.redis.timeout=3000
 spring.redis.expire=3600
+
+wxMini.appId=wx3c006d364161d240
+wxMini.secret=2b956bf512387a74eab612d99063d7c5

+ 0 - 52
virgo.core/src/main/resources/mapper/MgrDepartmentMapper.xml

@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.bosshand.virgo.core.dao.MgrDepartmentDao">
-
-    <resultMap type="com.bosshand.virgo.core.model.MgrDepartment" id="mgrDepartmentResult">
-        <id column="id" property="id"/>
-        <result column="name" property="name"/>
-        <result column="projectId" property="projectId"/>
-        <result column="organizationId" property="organizationId"/>
-        <result column="templateId" property="templateId"/>
-        <result column="parentId" property="parentId"/>
-    </resultMap>
-
-    <select id="getList" resultMap="mgrDepartmentResult">
-        select * from mgr_department where projectId = #{projectId} and organizationId = #{organizationId}
-    </select>
-
-    <select id="getProjectId" resultMap="mgrDepartmentResult">
-        select * from mgr_department where projectId = #{projectId}
-    </select>
-
-    <select id="get" resultMap="mgrDepartmentResult">
-        select * from mgr_department where id = #{id}
-    </select>
-
-    <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrDepartment" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO mgr_department(name, projectId, organizationId, templateId, parentId) VALUES (#{name}, #{projectId}, #{organizationId}, #{templateId}, #{parentId})
-    </insert>
-
-    <insert id="batchiInsert" parameterType="com.bosshand.virgo.core.model.MgrDepartment">
-        INSERT INTO mgr_department(name, projectId, organizationId,
-        templateId, parentId) VALUES
-        <foreach collection="list" item="item" index="index" separator=",">
-            (
-            #{item.name},
-            #{item.projectId},
-            #{item.organizationId},
-            #{item.templateId},
-            #{item.parentId},
-            )
-        </foreach>
-    </insert>
-
-    <delete id="delete">
-        DELETE FROM mgr_department WHERE id = #{id}
-    </delete>
-
-    <update id="update" parameterType="com.bosshand.virgo.core.model.MgrDepartment">
-        UPDATE mgr_department SET name = #{name} WHERE id = #{id}
-    </update>
-
-</mapper>

+ 5 - 13
virgo.core/src/main/resources/mapper/MgrOrganizationMapper.xml

@@ -11,10 +11,8 @@
 	<result column="contactTel" property="contactTel"/>
 	<result column="address" property="address"/>
 	<result column="businessLicense" property="businessLicense"/>
-	<result column="registeDate" property="registeDate"/>
+	<result column="registerDate" property="registerDate"/>
 	<result column="status" property="status"/>
-	<result column="mgr_organization_type_id" property="mgrOrganizationTypeId"/>
-	<result column="mgr_organization_type_name" property="mgrOrganizationTypeName"/>
 	<result column="organizedDataCenter" property="organizedDataCenter"/>
 	<result column="organizationCode" property="organizationCode"/>
 </resultMap>
@@ -56,10 +54,6 @@
 	select * from mgr_organization where name like '%${name}%'
 </select>
 
-<select id="getByOrganizationType" resultMap="MgrOrganizationResult">
-	select * from mgr_organization where mgr_organization_type_id = #{mgrOrganizationTypeId}
-</select>
-
 <select id="organizationByIds" parameterType="list" resultMap="MgrOrganizationResult">
 	select * from mgr_organization where id in (
 	<trim>
@@ -77,7 +71,7 @@
 	<where>
 		<trim>
 			<if test="name != null and name !=''">name = #{name}</if>
-			<if test="registeDate != null and registeDate !=''">registeDate = #{registeDate}</if>
+			<if test="registerDate != null and registerDate !=''">registerDate = #{registerDate}</if>
 			<if test="status == 0 or status == 1">status = #{status}</if>
 		</trim>
 	</where>
@@ -89,14 +83,14 @@
 	<where>
 		<trim>
 			<if test="name != null and name !=''">name = #{name}</if>
-			<if test="registeDate != null and registeDate !=''">registeDate = #{registeDate}</if>
+			<if test="registerDate != null and registerDate !=''">registerDate = #{registerDate}</if>
 			<if test="status == 0 or status == 1">status = #{status}</if>
 		</trim>
 	</where>
 </select>
 
 <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrOrganization" useGeneratedKeys="true" keyProperty="id">
-	INSERT into mgr_organization(name, contact, contactTel, address, businessLicense, registeDate, status, mgr_organization_type_id, mgr_organization_type_name, organizationCode) values(#{name}, #{contact}, #{contactTel}, #{address}, #{businessLicense}, #{registeDate}, #{status}, #{mgrOrganizationTypeId}, #{mgrOrganizationTypeName}, #{organizationCode})
+	INSERT into mgr_organization(name, contact, contactTel, address, businessLicense, registerDate, status, organizationCode) values(#{name}, #{contact}, #{contactTel}, #{address}, #{businessLicense}, now(), #{status}, #{organizationCode})
 </insert>
 
 <update id="update" parameterType="com.bosshand.virgo.core.model.MgrOrganization">
@@ -108,9 +102,7 @@
 		<if test="contactTel!=null">contactTel=#{contactTel},</if>
 		<if test="address!=null">address=#{address},</if>
 		<if test="businessLicense!=null">businessLicense=#{businessLicense},</if>
-		<if test="registeDate!=null">registeDate=#{registeDate},</if>
-		<if test="mgrOrganizationTypeId!=0">mgr_organization_type_id=#{mgrOrganizationTypeId},</if>
-		<if test="mgrOrganizationTypeName!=null">mgr_organization_type_name=#{mgrOrganizationTypeName},</if>
+		<if test="registerDate!=null">registerDate=#{registerDate},</if>
 		<if test="organizedDataCenter!=0">organizedDataCenter=#{organizedDataCenter},</if>
 	</trim>
 	WHERE id=#{id}

+ 0 - 67
virgo.core/src/main/resources/mapper/MgrOrganizationTypeMapper.xml

@@ -1,67 +0,0 @@
-<!DOCTYPE mapper
-    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- 
-<mapper namespace="com.bosshand.virgo.core.dao.MgrOrganizationTypeDao">
-
-	<resultMap type="com.bosshand.virgo.core.model.MgrOrganizationType" id="MgrOrganizationTypeResult" >
-		<id column="id" property="id"/>
-		<result column="name" property="name"/>
-		<result column="resource" property="resource"/>
-		<result column="comment" property="comment"/>
-		<result column="framework" property="framework"/>
-		<result column="hierarchy" property="hierarchy"/>
-		<result column="sequence" property="sequence"/>
-		<collection property="organizations" ofType="com.bosshand.virgo.core.model.MgrOrganization" resultMap="com.bosshand.virgo.core.dao.MgrOrganizationDao.MgrOrganizationResult" columnPrefix="mgrOrganization_"/>
-	</resultMap>
-	
-	<select id="getById" resultMap="MgrOrganizationTypeResult">
-		 select * from mgr_organization_type where id = #{id}
-	</select>
-
-	<select id="get" resultMap="MgrOrganizationTypeResult">
-		select * from mgr_organization_type where id = #{id}
-	</select>
-
-	<select id="getListOnlyName" resultMap="MgrOrganizationTypeResult">
-		select id, name from mgr_organization_type order by sequence desc
-	</select>
-
-	<select id="getList" resultMap="MgrOrganizationTypeResult">
-		select mop.*,
-		mo.id as mgrOrganization_id,
-		mo.name as mgrOrganization_name,
-		mo.contact as mgrOrganization_contact,
-		mo.contactTel as mgrOrganization_contactTel,
-		mo.address as mgrOrganization_address,
-		mo.businessLicense as mgrOrganization_businessLicense,
-		mo.registeDate as mgrOrganization_registeDate,
-		mo.status as mgrOrganization_status,
-		mo.mgr_organization_type_id as mgrOrganization_mgr_organization_type_id
-		from mgr_organization_type mop
-		left join mgr_organization mo on mo.mgr_organization_type_id = mop.id order by mop.sequence desc
-	</select>
-
-	<insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrOrganizationType" useGeneratedKeys="true" keyProperty="id">
-		INSERT into mgr_organization_type (name, resource, comment, framework, hierarchy) values(#{name}, #{resource}, #{comment}, #{framework}, #{hierarchy})
-	</insert>
-
-	<delete id="delete">
-		DELETE from mgr_organization_type where id = #{id}
-	</delete>
-
-	<update id="update" parameterType="com.bosshand.virgo.core.model.MgrOrganizationType">
-		UPDATE mgr_organization_type
-		<trim prefix="set" suffixOverrides=",">
-			<if test="id!=null">id=#{id},</if>
-			<if test="name!=null">name=#{name},</if>
-			<if test="resource!=null">resource=#{resource},</if>
-			<if test="comment!=null">comment=#{comment},</if>
-			<if test="framework!=null">framework=#{framework},</if>
-			<if test="hierarchy!=null">hierarchy=#{hierarchy},</if>
-			<if test="sequence!=null">sequence=#{sequence},</if>
-		</trim>
-		WHERE id=#{id}
-	</update>
-	
-</mapper>

+ 0 - 59
virgo.core/src/main/resources/mapper/MgrOrganizationTypeRoleMapper.xml

@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.bosshand.virgo.core.dao.MgrOrganizationTypeRoleDao">
-
-	<resultMap type="com.bosshand.virgo.core.model.MgrOrganizationTypeRole" id="MgrOrganizationTypeRoleResult">
-		<id column="id" property="id"/>
-		<result column="code" property="code"/>
-		<result column="name" property="name"/>
-		<result column="organizationTypeId" property="organizationTypeId"/>
-	</resultMap>
-	
-	<select id="organizationTypeId" resultMap="MgrOrganizationTypeRoleResult">
-        select * from mgr_organization_type_role where organizationTypeId = #{organizationTypeId}
-    </select>
-
-	<select id="getByOrganizationTypeId" resultMap="MgrOrganizationTypeRoleResult">
-		select * from mgr_organization_type_role where organizationTypeId = #{organizationTypeId}
-	</select>
-
-	<select id="getCodes" resultMap="MgrOrganizationTypeRoleResult">
-		select * from mgr_organization_type_role where organizationTypeId = #{organizationTypeId}
-		<choose>
-			<when test="codes != null and codes.length>0">
-				and code in (
-				<foreach collection="codes" item="item" index="index"
-						 separator=",">
-					#{item}
-				</foreach>
-				)
-			</when>
-			<otherwise>
-				and code in (-1)
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="getCode" resultMap="MgrOrganizationTypeRoleResult">
-		select * from mgr_organization_type_role where organizationTypeId = #{organizationTypeId} and code = #{code}
-	</select>
-
-	<insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrOrganizationTypeRole" useGeneratedKeys="true" keyProperty="id">
-		INSERT into mgr_organization_type_role(code, name, organizationTypeId) values(#{code}, #{name}, #{organizationTypeId})
-	</insert>
-
-	<update id="update" parameterType="com.bosshand.virgo.core.model.MgrOrganizationTypeRole">
-		UPDATE mgr_organization_type_role
-		<trim prefix="set" suffixOverrides=",">
-			<if test="code!=null">code=#{code},</if>
-			<if test="name!=null">name=#{name},</if>
-			<if test="organizationTypeId!=0">organizationTypeId=#{organizationTypeId},</if>
-		</trim>
-		WHERE id=#{id}
-	</update>
-
-	<delete id="delete">
-		DELETE from mgr_organization_type_role where id = #{id}
-	</delete>
-	
-</mapper>

+ 0 - 78
virgo.core/src/main/resources/mapper/MgrRoleCodeMapper.xml

@@ -1,78 +0,0 @@
-<!DOCTYPE mapper
-    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.bosshand.virgo.core.dao.MgrRoleCodeDao">
-
-	<resultMap type="com.bosshand.virgo.core.model.MgrRoleCode" id="MgrRoleCodeResult">
-		<id column="id" property="id" />
-		<result column="code" property="code" />
-		<result column="name" property="name" />
-		<result column="organizationTypeId" property="organizationTypeId" />
-	</resultMap>
-
-	<select id="getListByIds" resultMap="MgrRoleCodeResult">
-		SELECT * FROM mgr_role_code
-		<choose>
-			<when test="array != null and array.length>0">
-				where id in (
-				<foreach collection="array" item="item" index="index"
-					separator=",">
-					#{item}
-				</foreach>
-				)
-			</when>
-			<otherwise>
-				where 1=0
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="getList" resultMap="MgrRoleCodeResult">
-		SELECT * from mgr_role_code
-	</select>
-
-	<select id="getByOrganizationTypeId" resultMap="MgrRoleCodeResult">
-		select * from mgr_role_code where organizationTypeId = #{organizationTypeId}
-	</select>
-
-	<select id="getCode" resultMap="MgrRoleCodeResult">
-		select * from mgr_role_code where organizationTypeId = #{organizationTypeId} and code = #{code}
-	</select>
-
-	<select id="getCodes" resultMap="MgrRoleCodeResult">
-		select * from mgr_role_code where organizationTypeId = #{organizationTypeId}
-		<choose>
-			<when test="codes != null and codes.length>0">
-				and code in (
-				<foreach collection="codes" item="item" index="index"
-						 separator=",">
-					#{item}
-				</foreach>
-				)
-			</when>
-			<otherwise>
-				and code in (-1)
-			</otherwise>
-		</choose>
-	</select>
-
-	<insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrRoleCode" useGeneratedKeys="true" keyProperty="id">
-		INSERT into mgr_role_code(code, name, organizationTypeId) values(#{code}, #{name}, #{organizationTypeId})
-	</insert>
-
-	<update id="update" parameterType="com.bosshand.virgo.core.model.MgrRoleCode">
-		UPDATE mgr_role_code
-		<trim prefix="set" suffixOverrides=",">
-			<if test="code!=null">code=#{code},</if>
-			<if test="name!=null">name=#{name},</if>
-			<if test="organizationTypeId!=0">organizationTypeId=#{organizationTypeId},</if>
-		</trim>
-		WHERE id=#{id}
-	</update>
-
-	<delete id="delete">
-		DELETE from mgr_role_code where id = #{id}
-	</delete>
-
-</mapper>

+ 2 - 5
virgo.core/src/main/resources/mapper/MgrUserRoleMapper.xml

@@ -11,8 +11,6 @@
 	<result column="menus" property="menus"/>	
 	<result column="resources" property="resources"/>	
 	<result column="roles" property="roles"/>
-	<result column="departments" property="departments"/>
-	<result column="organizationTypeRoles" property="organizationTypeRoles"/>
 	<result column="admin" property="admin"/>			
 </resultMap>
 
@@ -33,7 +31,8 @@
 </select>
 		
 <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrUserRole" useGeneratedKeys="true" keyProperty="id">
-	INSERT into mgr_user_role(userId, organizationId, menus, resources, roles, departments, organizationTypeRoles, admin) values(#{userId}, #{organizationId}, #{menus}, #{resources}, #{roles}, #{departments}, #{organizationTypeRoles}, #{admin})
+	INSERT into mgr_user_role(userId, organizationId, menus, resources, roles, admin)
+	values(#{userId}, #{organizationId}, #{menus}, #{resources}, #{roles},#{admin})
 </insert>	
 
 <update id="update" parameterType="com.bosshand.virgo.core.model.MgrUserRole">
@@ -44,8 +43,6 @@
 			<if test="menus!=null">menus=#{menus},</if>
 			<if test="resources!=null">resources=#{resources},</if>
 			<if test="roles!=null">roles=#{roles},</if>
-			<if test="departments!=null">departments=#{departments},</if>
-			<if test="organizationTypeRoles!=null">organizationTypeRoles=#{organizationTypeRoles},</if>
 			<if test="admin!=null">admin=#{admin},</if>
 		</trim>		
 	WHERE id=#{id}

+ 10 - 29
virgo.manager/src/main/java/com/bosshand/virgo/controller/AdminController.java

@@ -1,23 +1,17 @@
 package com.bosshand.virgo.controller;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.alibaba.fastjson.JSONObject;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.model.MgrUserRole;
 import com.bosshand.virgo.core.response.Response;
 import com.bosshand.virgo.service.UserService;
-
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("admin")
@@ -39,18 +33,12 @@ public class AdminController {
 	
 	@ApiOperation(value="用户新增", notes="用户新增")
 	@RequestMapping(value = "/insertUser/{organizationId}/{roles}/{departments}", method = RequestMethod.POST)
-	public Response insertUser(@RequestBody MgrUser user, @PathVariable long organizationId, @PathVariable String roles, @PathVariable String departments) {
+	public Response insertUser(@RequestBody MgrUser user, @PathVariable long organizationId, @PathVariable String roles) {
 		MgrUser mgrUser = userService.insertUser(user);
-		userService.insertUserRole(mgrUser.getId(),organizationId, roles, departments);
+		userService.insertUserRole(mgrUser.getId(),organizationId, roles);
 		return Response.ok();
 	}
-	
-	@ApiOperation(value="绑定组织模板角色", notes="绑定组织模板角色")
-	@RequestMapping(value = "/bindOrganizationTypeRole/{organizationId}/{userId}/{organizationTypeRoles}", method = RequestMethod.POST)
-	public Response bindOrganizationTypeRole(@PathVariable long organizationId, @PathVariable int userId, @PathVariable String organizationTypeRoles) {
-		return Response.ok(userService.bindOrganizationTypeRole(organizationId, userId, organizationTypeRoles));
-	}
-	
+
 	@ApiOperation(value="更新用户权限菜单", notes="更新用户权限菜单")
 	@RequestMapping(value = "/userRole", method = RequestMethod.PUT)
 	public Response updateResources(@RequestBody MgrUserRole userRole) {
@@ -71,12 +59,5 @@ public class AdminController {
 		userService.deleteUser(id);
 		return Response.ok("成功");
 	}
-	
-	@ApiOperation(value="删除用户所在组织和项目", notes="删除用户所在组织和项目")
-	@RequestMapping(value = "/deleteUser/{organizationId}/{departmentId}/{userId}", method = RequestMethod.DELETE)
-	public Response deleteUserFromUserDepartment(@PathVariable long organizationId, @PathVariable long departmentId, @PathVariable long userId) {
-		userService.deleteUserFromUserDepartment(organizationId, departmentId, userId);
-		return Response.ok("成功");
-	}
-	
+
 }

+ 0 - 82
virgo.manager/src/main/java/com/bosshand/virgo/controller/DepartmentController.java

@@ -1,82 +0,0 @@
-package com.bosshand.virgo.controller;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.bosshand.virgo.core.model.MgrDepartment;
-import com.bosshand.virgo.core.response.Response;
-import com.bosshand.virgo.service.DepartmentService;
-
-import io.swagger.annotations.ApiOperation;
-
-@RestController
-@RequestMapping("department")
-public class DepartmentController {
-	
-	@Autowired
-	DepartmentService departmentService;
-
-	@ApiOperation(value="部门管理", notes="部门管理")
-	@RequestMapping(value = "/{projectId}/{organizationId}", method = RequestMethod.GET)
-	public Response department(@PathVariable long projectId, @PathVariable long organizationId) {
-		MgrDepartment department = new MgrDepartment();
-		department.setProjectId(projectId);
-		department.setOrganizationId(organizationId);
-		return Response.ok(departmentService.getList(department));
-	}
-
-	@ApiOperation(value="根据项目获取所有组织下成员", notes="根据项目获取所有组织下成员")
-	@RequestMapping(value = "/{projectId}", method = RequestMethod.GET)
-	public Response departmentByProjectId(@PathVariable long projectId) {
-		return Response.ok(departmentService.getListByProjectId(projectId));
-	}
-
-	@ApiOperation(value="根据项目获取所有组织下成员Id", notes="根据项目获取所有组织下成员Id")
-	@RequestMapping(value = "/userId/{projectId}", method = RequestMethod.GET)
-	public String personByProjectId(@PathVariable long projectId) {
-		return departmentService.personByProjectId(projectId);
-	}
-
-	@ApiOperation(value="统计所有组织下成员", notes="统计所有组织下成员")
-	@RequestMapping(value = "/statistical/{projectId}/{startDate}/{endDate}", method = RequestMethod.GET)
-	public Response statisticalDepartmentByProjectId(@PathVariable long projectId, @PathVariable String startDate, @PathVariable String endDate) {
-		return Response.ok(departmentService.statisticalListByProjectId(projectId, startDate, endDate));
-	}
-	
-	@ApiOperation(value="生成层级部门", notes="生成层级部门")
-	@RequestMapping(value = "/", method = RequestMethod.POST)
-	public Response saveDepartmentHierarchy(
-			@RequestParam(value="projectId", required=false) long projectId, 
-			@RequestParam(value="organizationId", required=false) long organizationId,
-			@RequestParam(value="organizationTypeId", required=false) long organizationTypeId) {
-		departmentService.saveDepartmentHierarchy(organizationTypeId, organizationId, projectId);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="新增部门", notes="新增部门")
-	@RequestMapping(value = "/newInsert", method = RequestMethod.POST)
-	public Response saveDepartment(@RequestBody MgrDepartment department) {
-		departmentService.saveDepartment(department);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="删除部门", notes="删除部门")
-	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
-	public Response delDepartment(@PathVariable int id) {
-		departmentService.deleteDepartment(id);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="修改部门名称", notes="修改部门名称")
-	@RequestMapping(value = "/", method = RequestMethod.PUT)
-	public Response updateDepartment(@RequestBody MgrDepartment department) {
-		departmentService.updateDepartment(department);
-		return Response.ok();
-	}
-	
-}

+ 0 - 67
virgo.manager/src/main/java/com/bosshand/virgo/controller/OrganizationTypeController.java

@@ -1,67 +0,0 @@
-package com.bosshand.virgo.controller;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.bosshand.virgo.core.model.MgrOrganizationType;
-import com.bosshand.virgo.core.response.Response;
-import com.bosshand.virgo.service.OrganizationTypeService;
-
-import io.swagger.annotations.ApiOperation;
-
-@RestController
-
-public class OrganizationTypeController {
-
-	@Autowired
-	OrganizationTypeService organizationTypeService;
-
-	@ApiOperation(value="组织类型管理", notes="组织类型列表")
-	@RequestMapping(value = "/organization/list", method = RequestMethod.GET)
-	public Response getOrganizationTypeList() {
-		List<MgrOrganizationType> list = organizationTypeService.getList();
-		return Response.ok(list);
-	}
-	
-	@ApiOperation(value="组织类型管理", notes="组织类型列表")
-	@RequestMapping(value = "/organization/listOnlyName", method = RequestMethod.GET)
-	public Response getOrganizationTypeListOnlyName() {
-		List<MgrOrganizationType> list = organizationTypeService.getListOnlyName();
-		return Response.ok(list);
-	}
-
-	@ApiOperation(value="组织类型管理", notes="组织类型详情")
-	@RequestMapping(value = "/organization/{id}", method = RequestMethod.GET)
-	public Response getOrganizationType(@PathVariable int id) {
-		MgrOrganizationType mgrOrganizationType = organizationTypeService.get(id);
-		return Response.ok(mgrOrganizationType);
-	}
-
-	@ApiOperation(value="组织类型管理", notes="组织类型新增")
-	@RequestMapping(value = "/organization/insert", method = RequestMethod.POST)
-	public Response insertOrganizationType(@RequestBody MgrOrganizationType mgrOrganizationType) {
-		organizationTypeService.insert(mgrOrganizationType);
-		return Response.ok();
-	}
-
-	@ApiOperation(value="组织类型管理", notes="组织类型删除")
-	@RequestMapping(value = "/organization/delete/{id}", method = RequestMethod.GET)
-	public Response deleteOrganizationTypeList(@PathVariable int id) {
-		organizationTypeService.delete(id);
-		return Response.ok();
-	}
-
-	@ApiOperation(value="组织类型管理", notes="组织类型更新")
-	@RequestMapping(value = "/organization/update", method = RequestMethod.POST)
-	public Response updateOrganizationType(@RequestBody MgrOrganizationType mgrOrganizationType) {
-		organizationTypeService.update(mgrOrganizationType);
-		return Response.ok();
-	}
-
-}

+ 0 - 61
virgo.manager/src/main/java/com/bosshand/virgo/controller/OrganizationTypeRoleController.java

@@ -1,61 +0,0 @@
-package com.bosshand.virgo.controller;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.bosshand.virgo.core.model.MgrOrganizationTypeRole;
-import com.bosshand.virgo.core.response.Response;
-import com.bosshand.virgo.exception.Constant;
-import com.bosshand.virgo.service.OrganizationTypeRoleService;
-
-import io.swagger.annotations.ApiOperation;
-
-@RestController
-@RequestMapping("organizationTypeRole")
-public class OrganizationTypeRoleController {
-
-	@Autowired
-	OrganizationTypeRoleService organizationTypeRoleService;
-
-	@ApiOperation(value = "组织模板角色代码管理", notes = "根据organizationTypeId获取组织模板角色代码")
-	@RequestMapping(value = "/{organizationTypeId}", method = RequestMethod.GET)
-	public Response getRoleCodeByorganizationTypeId(@PathVariable long organizationTypeId) {
-		return Response.ok(organizationTypeRoleService.getByOrganizationTypeId(organizationTypeId));
-	}
-
-	@ApiOperation(value = "组织模板角色代码管理", notes = "组织模板角色代码删除")
-	@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
-	public Response deleteRoleCode(@PathVariable long id) {
-		organizationTypeRoleService.delete(id);
-		return Response.ok();
-	}
-
-	@ApiOperation(value = "组织模板角色代码管理", notes = "组织模板角色代码修改")
-	@RequestMapping(value = "/update", method = RequestMethod.PUT)
-	public Response updateRoleCode(@RequestBody MgrOrganizationTypeRole mgrOrganizationTypeRole) {
-		organizationTypeRoleService.update(mgrOrganizationTypeRole);
-		return Response.ok();
-	}
-
-	@ApiOperation(value = "组织模板角色代码管理", notes = "组织模板角色代码新增")
-	@RequestMapping(value = "/insert", method = RequestMethod.POST)
-	public Response insertRoleCode(@RequestBody MgrOrganizationTypeRole mgrOrganizationTypeRole) {
-		MgrOrganizationTypeRole otr = organizationTypeRoleService.getCode(mgrOrganizationTypeRole.getOrganizationTypeId(), mgrOrganizationTypeRole.getCode());
-		if (otr != null) {
-			return Response.fail(Constant.CODE_BAD_REQUEST, Constant.RET_INPUT_ERROR);
-		}
-		organizationTypeRoleService.insert(mgrOrganizationTypeRole);
-		return Response.ok();
-	}
-
-	@ApiOperation(value = "根据codes获取用户列表", notes = "获取codes用户列表")
-	@RequestMapping(value = "/user/{organizationTypeId}/{codes}", method = RequestMethod.POST)
-	public Response getUserList(@PathVariable long organizationTypeId, @PathVariable String codes) {
-		return Response.ok(organizationTypeRoleService.getUserList(organizationTypeId, codes.split(",")));
-	}
-
-}

+ 0 - 71
virgo.manager/src/main/java/com/bosshand/virgo/controller/RoleCodeController.java

@@ -1,71 +0,0 @@
-package com.bosshand.virgo.controller;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.bosshand.virgo.core.model.MgrRoleCode;
-import com.bosshand.virgo.core.response.Response;
-import com.bosshand.virgo.exception.Constant;
-import com.bosshand.virgo.service.RoleCodeService;
-
-import io.swagger.annotations.ApiOperation;
-
-@RestController
-@RequestMapping("roleCode")
-public class RoleCodeController {
-
-	@Autowired
-	RoleCodeService roleCodeService;
-
-	@ApiOperation(value="角色代码管理", notes="角色代码列表")
-	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	public Response getRoleCodeList() {
-		List<MgrRoleCode> list = roleCodeService.getList();
-		return Response.ok(list);
-	}
-	
-	@ApiOperation(value="角色代码管理", notes="根据organizationTypeId获取角色代码")
-	@RequestMapping(value = "/organizationTypeId/{organizationTypeId}", method = RequestMethod.GET)
-	public Response getRoleCodeByorganizationTypeId(@PathVariable long organizationTypeId) {
-		List<MgrRoleCode> list = roleCodeService.getByOrganizationTypeId(organizationTypeId);
-		return Response.ok(list);
-	}
-
-	@ApiOperation(value="角色代码管理", notes="角色代码删除")
-	@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
-	public Response deleteRoleCode(@PathVariable long id) {
-		roleCodeService.delete(id);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="角色代码管理", notes="角色代码修改")
-	@RequestMapping(value = "/update", method = RequestMethod.PUT)
-	public Response updateRoleCode(@RequestBody MgrRoleCode mgrRoleCode) {
-		roleCodeService.update(mgrRoleCode);
-		return Response.ok();
-	}
-
-	@ApiOperation(value="角色代码管理", notes="角色代码新增")
-	@RequestMapping(value = "/insert", method = RequestMethod.POST)
-	public Response insertRoleCode(@RequestBody MgrRoleCode mgrRoleCode) {
-		MgrRoleCode rc = roleCodeService.getCode(mgrRoleCode.getOrganizationTypeId(), mgrRoleCode.getCode());
-		if(rc != null) {
-			return Response.fail(Constant.CODE_BAD_REQUEST, Constant.RET_INPUT_ERROR);
-		}
-		roleCodeService.insert(mgrRoleCode);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value = "根据codes获取用户列表", notes = "获取codes用户列表")
-	@RequestMapping(value = "/user/{organizationTypeId}/{codes}", method = RequestMethod.POST)
-	public Response getUserList(@PathVariable long organizationTypeId, @PathVariable String codes) {
-		return Response.ok(roleCodeService.getUserList(organizationTypeId, codes.split(",")));
-	}
-	
-}

+ 1 - 1
virgo.manager/src/main/java/com/bosshand/virgo/controller/UserInfoController.java

@@ -68,7 +68,7 @@ public class UserInfoController {
 		Map<String,Object> map = new HashMap<String,Object>();
 		MgrUserRole userRole = mgrUserService.getUserRole(user, mgrUserService.isSupperAdmin(user) ? -1 : userContext.getOrganizationId());
 		map.put("user", user);
-		map.put("roleCode", userService.getListRoleCode(userRole.getRoles()));
+		map.put("userRole", userRole);
 		map.put("organization", organizationService.get(userContext.getOrganizationId()));
 		return Response.ok(map);
 	}

+ 0 - 254
virgo.manager/src/main/java/com/bosshand/virgo/service/DepartmentService.java

@@ -1,254 +0,0 @@
-package com.bosshand.virgo.service;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.core.dao.*;
-import com.bosshand.virgo.core.model.*;
-import com.bosshand.virgo.util.StringUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-
-@Service
-public class DepartmentService {
-
-	@Autowired
-	MgrDepartmentDao mgrDepartmentDao;
-
-	@Autowired
-	MgrOrganizationTypeDao mgrOrganizationTypeDao;
-
-	@Autowired
-	MgrOrganizationDao mgrOrganizationDao;
-
-	@Autowired
-	MgrUserRoleDao mgrUserRoleDao;
-
-	@Autowired
-	MgrUserDao mgrUserDao;
-
-	@Autowired
-	AttendanceDao attendanceDao;
-
-	public void saveDepartment(MgrDepartment department) {
-		mgrDepartmentDao.insert(department);
-	}
-
-	public void deleteDepartment(int id) {
-		mgrDepartmentDao.delete(id);
-	}
-
-	public void updateDepartment(MgrDepartment department) {
-		mgrDepartmentDao.update(department);
-	}
-
-	public List<MgrOrganization> getListByProjectId(long projectId) {
-		List<MgrDepartment> list = mgrDepartmentDao.getProjectId(projectId);
-		if (list.size() > 0) {
-			Set<Long> set = new HashSet<>();
-			list.forEach(ls -> set.add(ls.getOrganizationId()));
-
-			MgrDepartment department = new MgrDepartment();
-			department.setProjectId(projectId);
-
-			List<MgrOrganization> organizationList = mgrOrganizationDao.organizationByIds(new ArrayList<Long>(set));
-			for (MgrOrganization organization : organizationList) {
-				department.setOrganizationId(organization.getId());
-				organization.setDepartmentList(getList(department));
-			}
-			return organizationList;
-		}
-		return new ArrayList<MgrOrganization>();
-	}
-
-	// get hierarchy
-	public List<MgrDepartment> getList(MgrDepartment department) {
-		List<MgrUserRole> mList = mgrUserRoleDao.getOrganizationId(department.getOrganizationId());
-		List<MgrDepartment> list = mgrDepartmentDao.getList(department);
-		list.forEach(ls -> ls.setUsers(getUserListByDepartment(mList, ls.getId())));
-		List<Integer> ids = new ArrayList<>();
-		list.forEach(ls -> {
-			if (ls.getParentId() == -1) {
-				ids.add(ls.getId());
-			}
-		});
-		List<MgrDepartment> hierarchy = new ArrayList<>();
-		if (ids.size() > 0) {
-			ids.forEach(ll -> hierarchy.add(getNodeTreeById(ll, list)));
-		}
-		return hierarchy;
-	}
-
-	private MgrDepartment getNodeTreeById(int id, List<MgrDepartment> list) {
-		MgrDepartment node = null;
-		List<MgrDepartment> departmentList = list;
-		for (MgrDepartment data : departmentList) {
-			if (data.getId() == id) {
-				node = data;
-				break;
-			}
-		}
-		if (node != null) {
-			node.setChildren(getChildNode(node.getId(), departmentList));
-		}
-		return node;
-	}
-
-	private List<MgrDepartment> getChildNode(int parentId, List<MgrDepartment> list) {
-		List<MgrDepartment> nodeList = new ArrayList<MgrDepartment>();
-		nodeList.clear();
-		for (MgrDepartment data : list) {
-			if (data.getParentId() == parentId) {
-				nodeList.add(data);
-			}
-		}
-		if (nodeList.size() > 0) {
-			for (MgrDepartment data : nodeList) {
-				List<MgrDepartment> childList = getChildNode(data.getId(), list);
-				data.setChildren(childList);
-			}
-		}
-		return nodeList;
-	}
-
-	private List<MgrUser> getUserListByDepartment(List<MgrUserRole> list, int departmentId) {
-
-		List<Long> userIds = new ArrayList<>();
-
-		List<MgrUserRole> mlist = new ArrayList<>();
-
-		list.forEach(ls -> {
-			String departments = ls.getDepartments();
-			if (StringUtil.notBlank(departments)) {
-				String[] split = departments.split(",");
-				for (int i = 0; i < split.length; i++) {
-					if(StringUtil.notBlank(split[i])) {
-						if (Integer.parseInt(split[i]) == departmentId) {
-							userIds.add(ls.getUserId());
-							mlist.add(ls);
-						}
-					}
-				}
-			}
-		});
-
-		if (userIds.size() == 0) {
-			return new ArrayList<MgrUser>();
-		}
-
-		List<MgrUser> userList = mgrUserDao.getIds(userIds);
-		for (MgrUser user : userList) {
-			for (MgrUserRole ur : mlist) {
-				if (user.getId() == ur.getUserId()) {
-					user.setMenus(ur.getMenus());
-					user.setResources(ur.getResources());
-					user.setRoles(ur.getRoles());
-					user.setOrganizationTypeRoles(ur.getOrganizationTypeRoles());
-				}
-			}
-		}
-		return userList;
-	}
-
-	// generation hierarchy
-	public void saveDepartmentHierarchy(long organizationTypeId, long organizationId, long projectId) {
-		MgrOrganizationType organizationType = mgrOrganizationTypeDao.get(organizationTypeId);
-		String hierarchy = organizationType.getHierarchy();
-		recursion(organizationId, projectId, hierarchy, -1);
-	}
-
-	private void recursion(long organizationId, long projectId, String st, int parentId) {
-		JSONArray list = JSON.parseArray(st);
-		if (list.size() == 0) {
-			return;
-		}
-		for (int i = 0; i < list.size(); i++) {
-			MgrDepartment d = new MgrDepartment();
-			d.setOrganizationId(organizationId);
-			d.setProjectId(projectId);
-			d.setParentId(parentId);
-			d.setTemplateId(Long.parseLong(list.getJSONObject(i).get("id").toString()));
-			d.setName((String) list.getJSONObject(i).get("name"));
-			mgrDepartmentDao.insert(d);
-			recursion(organizationId, projectId, JSON.toJSONString(list.getJSONObject(i).get("children")), d.getId());
-		}
-	}
-
-	public Map<String, Object> statisticalListByProjectId(long projectId, String startDate, String endDate) {
-		Map<String, Object> map = new HashMap<>();
-		List<MgrDepartment> list = mgrDepartmentDao.getProjectId(projectId);
-		if (list.size() > 0) {
-			Set<Long> set = new HashSet<>();
-			list.forEach(ls -> set.add(ls.getOrganizationId()));
-			MgrDepartment department = new MgrDepartment();
-			department.setProjectId(projectId);
-			List<MgrOrganization> organizationList = mgrOrganizationDao.organizationByIds(new ArrayList<Long>(set));
-			int con = 0;
-			int si = 0;
-			Attendance attendance  = new Attendance();
-			attendance.setStartDate(startDate + " 00:00:00");
-			attendance.setEndDate(endDate + " 23:59:59");
-			for (MgrOrganization organization : organizationList) {
-				department.setOrganizationId(organization.getId());
-				List<MgrUserRole> mList = mgrUserRoleDao.getOrganizationId(department.getOrganizationId());
-				List<MgrDepartment> alist = mgrDepartmentDao.getList(department);
-				int cont = 0;
-				for (MgrDepartment mgrDepartment : alist) {
-					int size = getUserListByDepartment(mList, mgrDepartment.getId()).size();
-					cont += size;
-				}
-				JSONObject json = new JSONObject();
-				json.put("all", cont);
-				attendance.setProjectId(projectId);
-				attendance.setOrganizationId(organization.getId());
-				List<Attendance> users = attendanceDao.getByUser(attendance);
-				json.put("sign", users.size());
-				map.put(organization.getName(), json);
-				con += cont;
-				si  += users.size();
-			}
-			map.put("项目总人数", con);
-			map.put("allSign", si);
-		}
-		return map;
-	}
-
-	public String personByProjectId(long projectId) {
-		List<MgrDepartment> list = mgrDepartmentDao.getProjectId(projectId);
-		JSONArray ja = new JSONArray();
-		if (list.size() > 0) {
-			Set<Long> set = new HashSet<>();
-			list.forEach(ls -> set.add(ls.getOrganizationId()));
-			MgrDepartment department = new MgrDepartment();
-			department.setProjectId(projectId);
-			List<MgrOrganization> organizationList = mgrOrganizationDao.organizationByIds(new ArrayList<Long>(set));
-			for (MgrOrganization organization : organizationList) {
-				JSONObject js = new JSONObject();
-				department.setOrganizationId(organization.getId());
-				List<MgrUserRole> mList = mgrUserRoleDao.getOrganizationId(department.getOrganizationId());
-				List<MgrDepartment> alist = mgrDepartmentDao.getList(department);
-				Set<MgrUser> set1 = new HashSet<>();
-				for (MgrDepartment mgrDepartment : alist) {
-					List<MgrUser> userListByDepartment = getUserListByDepartment(mList, mgrDepartment.getId());
-					userListByDepartment.forEach(ls -> set1.add(ls));
-				}
-				js.put("organizationName", organization.getName());
-				js.put("organizationId", organization.getId());
-				JSONArray jaa = new JSONArray();
-				for (MgrUser u : set1) {
-					JSONObject jss = new JSONObject();
-					jss.put("userId", u.getId());
-					jss.put("userName", u.getName());
-					jaa.add(jss);
-				}
-				js.put("userIds", jaa);
-				ja.add(js);
-			}
-		}
-		return JSONObject.toJSONString(ja);
-	}
-
-
-}

+ 12 - 37
virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationService.java

@@ -1,33 +1,23 @@
 package com.bosshand.virgo.service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.bosshand.virgo.core.dao.MgrDepartmentDao;
+import com.alibaba.fastjson.JSONObject;
 import com.bosshand.virgo.core.dao.MgrOrganizationDao;
+import com.bosshand.virgo.core.dao.MgrOrganizationProjectDao;
 import com.bosshand.virgo.core.dao.MgrUserRoleDao;
+import com.bosshand.virgo.core.model.MgrOrganization;
+import com.bosshand.virgo.core.model.MgrOrganizationProject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.core.dao.MgrOrganizationProjectDao;
-import com.bosshand.virgo.core.model.MgrDepartment;
-import com.bosshand.virgo.core.model.MgrOrganization;
-import com.bosshand.virgo.core.model.MgrOrganizationProject;
-import com.bosshand.virgo.core.model.MgrUserRole;
-import com.bosshand.virgo.util.StringUtil;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service
 public class OrganizationService {
-	
-	@Autowired
-	private MgrDepartmentDao mgrDepartmentDao;
-	
+
 	@Autowired
 	private MgrUserRoleDao mgrUserRoleDao;
 
@@ -61,29 +51,14 @@ public class OrganizationService {
 		List<MgrOrganization> os = mgrOrganizationDao.organizationByIds(ids);
 		for (MgrOrganizationProject op : list) {
 			for (MgrOrganization mo : os) {
-				
 				if (op.getOrganizationId() == mo.getId()) {
 					mo.setState(op.getState());
 				}
-				
-				// 统计组织下单位工程下用户数量
-				Set<Long> us = new HashSet<>();
-				List<MgrDepartment> dt = mgrDepartmentDao.getList(new MgrDepartment(projectId, mo.getId()));
-				List<MgrUserRole> mur = mgrUserRoleDao.getListByOrganizationId(mo.getId());
-				for(MgrUserRole ur : mur) {
-					String de = ur.getDepartments();
-					if(StringUtil.notBlank(de)) {
-						dt.forEach(ls->{
-							if(de.contains(Integer.toString(ls.getId()))) {
-								us.add(ur.getUserId());
-							}
-						});
-					}
-				}
-				mo.setProjectUserCount(us.size());
+				// TODO
+				// 需要之后统计
+				mo.setProjectUserCount(0);
 			}
 		}
-		
 		return os;
 	}
 

+ 0 - 83
virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationTypeRoleService.java

@@ -1,83 +0,0 @@
-package com.bosshand.virgo.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.bosshand.virgo.core.dao.MgrOrganizationTypeRoleDao;
-import com.bosshand.virgo.core.dao.MgrUserDao;
-import com.bosshand.virgo.core.dao.MgrUserRoleDao;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.bosshand.virgo.core.model.MgrOrganizationTypeRole;
-import com.bosshand.virgo.core.model.MgrUser;
-import com.bosshand.virgo.core.model.MgrUserRole;
-import com.bosshand.virgo.util.StringUtil;
-
-@Service
-public class OrganizationTypeRoleService {
-
-	@Autowired
-	private MgrOrganizationTypeRoleDao mgrOrganizationTypeRoleDao;
-	
-	@Autowired
-	private MgrUserDao mgrUserDao;
-	
-	@Autowired
-	private MgrUserRoleDao mgrUserRoleDao;
-
-	public int insert(MgrOrganizationTypeRole mgrOrganizationTypeRole) {
-		return mgrOrganizationTypeRoleDao.insert(mgrOrganizationTypeRole);
-	}
-
-	public int delete(long id) {
-		return mgrOrganizationTypeRoleDao.delete(id);
-	}
-
-	public int update(MgrOrganizationTypeRole mgrOrganizationTypeRole) {
-		return mgrOrganizationTypeRoleDao.update(mgrOrganizationTypeRole);
-	}
-
-	public List<MgrOrganizationTypeRole> getByOrganizationTypeId(long organizationTypeId) {
-		return mgrOrganizationTypeRoleDao.getByOrganizationTypeId(organizationTypeId);
-	}
-
-	public MgrOrganizationTypeRole getCode(long organizationTypeId, String code) {
-		return mgrOrganizationTypeRoleDao.getCode(organizationTypeId, code);
-	}
-
-	public List<MgrUser> getUserList(long organizationTypeId, String[] codes) {
-		List<MgrOrganizationTypeRole> codeList = mgrOrganizationTypeRoleDao.getCodes(organizationTypeId, codes);
-		List<Long> otr = new ArrayList<>();
-		if (codeList.size() > 0) {
-			codeList.forEach(ls -> otr.add(ls.getId()));
-		}
-
-		List<Long> ids = new ArrayList<>();
-		if (otr.size() > 0) {
-			List<MgrUserRole> list = mgrUserRoleDao.getList();
-			if (list.size() > 0) {
-				for (MgrUserRole mur : list) {
-					if (StringUtil.notBlank(mur.getOrganizationTypeRoles())) {
-						String[] split = mur.getOrganizationTypeRoles().split(",");
-						for (String tr : split) {
-							if (StringUtil.notBlank(tr)) {
-								for (long ot : otr) {
-									if (Long.parseLong(tr) == ot) {
-										ids.add(mur.getUserId());
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-
-		if (ids.size() > 0) {
-			return mgrUserDao.getIds(ids);
-		}
-		return new ArrayList<MgrUser>();
-	}
-
-}

+ 0 - 46
virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationTypeService.java

@@ -1,46 +0,0 @@
-package com.bosshand.virgo.service;
-
-import java.util.List;
-
-import com.bosshand.virgo.core.dao.MgrOrganizationTypeDao;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.bosshand.virgo.core.model.MgrOrganizationType;
-
-@Service
-public class OrganizationTypeService {
-
-	@Autowired
-	private MgrOrganizationTypeDao mgrOrganizationTypeDao;
-
-	public MgrOrganizationType get(long id) {
-		return mgrOrganizationTypeDao.get(id);
-	}
-
-	public List<MgrOrganizationType> getList() {
-		return mgrOrganizationTypeDao.getList();
-	}
-
-	public List<MgrOrganizationType> getListOnlyName() {
-		return mgrOrganizationTypeDao.getListOnlyName();
-	}
-
-	public int insert(MgrOrganizationType mgrOrganizationType) {
-		return mgrOrganizationTypeDao.insert(mgrOrganizationType);
-	}
-
-	@Transactional
-	public int update(MgrOrganizationType mgrOrganizationType) {
-		if (mgrOrganizationType.getComment() != null & mgrOrganizationType.getResource() != null) {
-			mgrOrganizationTypeDao.update(mgrOrganizationType);
-		}
-		return mgrOrganizationTypeDao.update(mgrOrganizationType);
-	}
-
-	public int delete(long id) {
-		return mgrOrganizationTypeDao.delete(id);
-	}
-
-}

+ 0 - 87
virgo.manager/src/main/java/com/bosshand/virgo/service/RoleCodeService.java

@@ -1,87 +0,0 @@
-package com.bosshand.virgo.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.bosshand.virgo.core.dao.MgrRoleCodeDao;
-import com.bosshand.virgo.core.dao.MgrUserDao;
-import com.bosshand.virgo.core.dao.MgrUserRoleDao;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.bosshand.virgo.core.model.MgrRoleCode;
-import com.bosshand.virgo.core.model.MgrUser;
-import com.bosshand.virgo.core.model.MgrUserRole;
-import com.bosshand.virgo.util.StringUtil;
-
-@Service
-public class RoleCodeService {
-
-	@Autowired
-	private MgrRoleCodeDao mgrRoleCodeDao;
-	
-	@Autowired
-	private MgrUserDao mgrUserDao;
-	
-	@Autowired
-	private MgrUserRoleDao mgrUserRoleDao;
-
-	public List<MgrRoleCode> getList() {
-		return mgrRoleCodeDao.getList();
-	}
-	
-	public int insert(MgrRoleCode mgrRoleCode) {
-		return mgrRoleCodeDao.insert(mgrRoleCode);
-	}
-
-	public int delete(long id) {
-		return mgrRoleCodeDao.delete(id);
-	}
-
-	public int update(MgrRoleCode mgrRoleCode) {
-		return mgrRoleCodeDao.update(mgrRoleCode);
-	}
-
-	public List<MgrRoleCode> getByOrganizationTypeId(long organizationTypeId) {
-		return mgrRoleCodeDao.getByOrganizationTypeId(organizationTypeId);
-	}
-	
-	public MgrRoleCode getCode(long organizationTypeId, String code) {
-		return mgrRoleCodeDao.getCode(organizationTypeId, code);
-	}
-	
-	public List<MgrUser> getUserList(long organizationTypeId, String[] codes) {
-		List<MgrRoleCode> codeList = mgrRoleCodeDao.getCodes(organizationTypeId, codes);
-		List<Long> otr = new ArrayList<>();
-		if (codeList.size() > 0) {
-			codeList.forEach(ls -> otr.add(ls.getId()));
-		}
-
-		List<Long> ids = new ArrayList<>();
-		if (otr.size() > 0) {
-			List<MgrUserRole> list = mgrUserRoleDao.getList();
-			if (list.size() > 0) {
-				for (MgrUserRole mur : list) {
-					if (StringUtil.notBlank(mur.getRoles())) {
-						String[] split = mur.getRoles().split(",");
-						for (String tr : split) {
-							if (StringUtil.notBlank(tr)) {
-								for (long ot : otr) {
-									if (Long.parseLong(tr) == ot) {
-										ids.add(mur.getUserId());
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-
-		if (ids.size() > 0) {
-			return mgrUserDao.getIds(ids);
-		}
-		return new ArrayList<MgrUser>();
-	}
-
-}

+ 9 - 57
virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java

@@ -1,19 +1,20 @@
 package com.bosshand.virgo.service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.core.dao.*;
+import com.bosshand.virgo.core.dao.AttendanceDao;
+import com.bosshand.virgo.core.dao.MgrOrganizationDao;
+import com.bosshand.virgo.core.dao.MgrUserDao;
+import com.bosshand.virgo.core.dao.MgrUserRoleDao;
 import com.bosshand.virgo.core.model.Attendance;
-import com.bosshand.virgo.core.model.MgrRoleCode;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.model.MgrUserRole;
-import com.bosshand.virgo.exception.Constant;
-import com.bosshand.virgo.exception.ServiceException;
-import com.bosshand.virgo.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.PathVariable;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service
 public class UserService {
@@ -24,9 +25,6 @@ public class UserService {
 	@Autowired
 	private MgrUserRoleDao mgrUserRoleDao;
 
-	@Autowired
-	private MgrRoleCodeDao mgrRoleCodeDao;
-
 	@Autowired
 	private MgrOrganizationDao mgrOrganizationDao;
 
@@ -109,72 +107,26 @@ public class UserService {
 		return mgrUserDao.getTotalCount(data);
 	}
 
-	public void insertUserRole(long userId, long organizationId, String roles, String departments) {
+	public void insertUserRole(long userId, long organizationId, String roles) {
 		MgrUserRole mur = mgrUserRoleDao.getUser(userId, organizationId);
 		if (mur != null) {
 			StringBuffer sb = new StringBuffer(mur.getRoles() == null ? "-1" : mur.getRoles());
 			sb.append("," + roles);
 			mur.setRoles(sb.toString());
-
-			StringBuffer sb1 = new StringBuffer(mur.getDepartments() == null ? "-1" : mur.getDepartments());
-			sb1.append("," + departments);
-			mur.setDepartments(sb1.toString());
-
 			mgrUserRoleDao.update(mur);
 		} else {
 			MgrUserRole userRole = new MgrUserRole();
 			userRole.setUserId(userId);
 			userRole.setOrganizationId(organizationId);
 			userRole.setRoles(roles);
-			userRole.setDepartments(departments);
 			mgrUserRoleDao.insert(userRole);
 		}
 	}
-	
-	public MgrUserRole bindOrganizationTypeRole(long organizationId, @PathVariable int userId, @PathVariable String organizationTypeRoles) {
-		MgrUserRole mur = mgrUserRoleDao.getUser(userId, organizationId);
-		if (mur == null) {
-			throw new ServiceException("found this user", Constant.RET_BAD_REQUEST);
-		}
-		mur.setOrganizationTypeRoles(organizationTypeRoles);
-		mgrUserRoleDao.update(mur);
-		return mur;
-	}
 
 	public void updateResources(MgrUserRole userRole) {
 		mgrUserRoleDao.updateResources(userRole);
 	}
 
-	public void deleteUserFromUserDepartment(long organizationId, long departmentId, long userId) {
-		MgrUserRole mur = mgrUserRoleDao.getUser(userId, organizationId);
-		if (mur == null) {
-			throw new ServiceException("found this user", Constant.RET_BAD_REQUEST);
-		}
-		List<String> string = new ArrayList<String>(Arrays.asList(mur.getDepartments().split(",")));
-		string.remove(String.valueOf(departmentId));
-		mur.setDepartments(String.join(",", string));
-		mgrUserRoleDao.update(mur);
-	}
-
-	public List<String> getRoleCode(String roles) {
-		if(StringUtil.empty(roles)) {
-			return new ArrayList<>();
-		}
-		String[] ids = roles.split(",");
-		List<MgrRoleCode> list = mgrRoleCodeDao.getListByIds(ids);
-		List<String> codeNames = new ArrayList<>();
-		list.forEach(ls -> codeNames.add(ls.getName()));
-		return codeNames;
-	}
-
-	public List<MgrRoleCode> getListRoleCode(String roles) {
-		if(StringUtil.empty(roles)) {
-			return new ArrayList<>();
-		}
-		String[] ids = roles.split(",");
-		return mgrRoleCodeDao.getListByIds(ids);
-	}
-	
 	public int saveAttendance(Attendance attendance) {
 		return attendanceDao.insert(attendance);
 	}

+ 3 - 3
virgo.wzfrontend/target/classes/static/js/index.min.js

@@ -34,9 +34,9 @@ $(".nav-link").click(function () {
     let a = $(this).attr("to") ? $($(this).attr("to")).offset().top : 0;
     return $("html, body").animate({scrollTop: a}, {duration: 500, easing: "swing"}), !1
 }), $(".login").click(function () {
-    window.location.pathname = "https://www.workark.com/frontend/#/loginRegister/login"
+    window.location.href = "https://www.workark.com/frontend/#/loginRegister/login"
 }), $(".register").click(function () {
-    window.location.pathname = "https://www.workark.com/frontend/#/loginRegister/register"
+    window.location.href = "https://www.workark.com/frontend/#/loginRegister/register"
 }), $(".jianzao").click(function () {
-    window.location.pathname = "https://www.youjiyun.net/console/index.html"
+    window.location.href = "https://www.youjiyun.net/console/index.html"
 });