dcs há 1 ano atrás
pai
commit
1c8f5fb615
26 ficheiros alterados com 861 adições e 196 exclusões
  1. 7 25
      virgo.api/src/main/java/com/bosshand/virgo/api/controller/ProjectController.java
  2. 0 17
      virgo.api/src/main/java/com/bosshand/virgo/api/dao/ProjectBindDao.java
  3. 0 28
      virgo.api/src/main/java/com/bosshand/virgo/api/service/ProjectBindService.java
  4. 0 26
      virgo.api/src/main/resources/mapper/ProjectBindMapper.xml
  5. 18 0
      virgo.core/src/main/java/com/bosshand/virgo/core/controller/UserContextController.java
  6. 21 0
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/IdentityDao.java
  7. 25 0
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrClientDao.java
  8. 19 0
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationProjectDao.java
  9. 43 0
      virgo.core/src/main/java/com/bosshand/virgo/core/model/Identity.java
  10. 239 0
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrClient.java
  11. 37 3
      virgo.api/src/main/java/com/bosshand/virgo/api/model/ProjectBind.java
  12. 0 13
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrUserRole.java
  13. 37 7
      virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java
  14. 34 0
      virgo.core/src/main/resources/mapper/IdentityMapper.xml
  15. 109 0
      virgo.core/src/main/resources/mapper/MgrClientMapper.xml
  16. 32 0
      virgo.core/src/main/resources/mapper/MgrOrganizationProjectMapper.xml
  17. 2 4
      virgo.core/src/main/resources/mapper/MgrUserRoleMapper.xml
  18. 64 0
      virgo.manager/src/main/java/com/bosshand/virgo/controller/ClientController.java
  19. 45 0
      virgo.manager/src/main/java/com/bosshand/virgo/controller/IdentityController.java
  20. 27 0
      virgo.manager/src/main/java/com/bosshand/virgo/controller/OrganizationProjectController.java
  21. 0 25
      virgo.manager/src/main/java/com/bosshand/virgo/controller/UserController.java
  22. 40 0
      virgo.manager/src/main/java/com/bosshand/virgo/service/ClientService.java
  23. 32 0
      virgo.manager/src/main/java/com/bosshand/virgo/service/IdentityService.java
  24. 28 0
      virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationProjectService.java
  25. 1 47
      virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java
  26. 1 1
      virgo.warpdrive/bin/pom.xml

+ 7 - 25
virgo.api/src/main/java/com/bosshand/virgo/api/controller/ProjectController.java

@@ -1,8 +1,6 @@
 package com.bosshand.virgo.api.controller;
 
 import com.bosshand.virgo.api.model.Project;
-import com.bosshand.virgo.api.model.ProjectBind;
-import com.bosshand.virgo.api.service.ProjectBindService;
 import com.bosshand.virgo.api.service.ProjectItemTargetRoomService;
 import com.bosshand.virgo.api.service.ProjectService;
 import com.bosshand.virgo.core.response.Response;
@@ -11,7 +9,6 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -24,31 +21,9 @@ public class ProjectController {
     @Autowired
     ProjectService projectService;
 
-    @Autowired
-    ProjectBindService projectBindService;
-
     @Autowired
     ProjectItemTargetRoomService projectItemTargetRoomService;
 
-    @ApiOperation("获取绑定项目")
-    @RequestMapping(value = "/bindProject/{organizationId}/{userId}", method = RequestMethod.GET)
-    public Response getBindProject(@PathVariable long organizationId, @PathVariable long userId) {
-        List<ProjectBind> list = projectBindService.get(organizationId, userId);
-        List<Long> ids = new ArrayList<>();
-        list.forEach(ls -> ids.add(ls.getProjectId()));
-        if (ids.size() > 0) {
-            return Response.ok(projectService.getIds(ids));
-        }
-        return Response.ok();
-    }
-
-    @ApiOperation("绑定项目")
-    @RequestMapping(value = "/bindProject", method = RequestMethod.POST)
-    public Response bindProject(@RequestBody ProjectBind projectBind) {
-        projectBindService.insert(projectBind);
-        return Response.ok();
-    }
-
     @ApiOperation("获取")
     @RequestMapping(value = "/{currPage}/{pageSize}", method = RequestMethod.POST)
     public Response list(@RequestBody Project project, @PathVariable int currPage, @PathVariable int pageSize) {
@@ -60,6 +35,13 @@ public class ProjectController {
         return Response.ok(result);
     }
 
+    @ApiOperation("根据id列表获取")
+    @RequestMapping(value = "/getIds", method = RequestMethod.POST)
+    public Response getIds(@RequestBody List<Long> ids) {
+        List<Project> list = projectService.getIds(ids);
+        return Response.ok(list);
+    }
+
     @ApiOperation("详情")
     @RequestMapping(value = "/getProject/{id}", method = RequestMethod.GET)
     public Response getProject(@PathVariable long id) {

+ 0 - 17
virgo.api/src/main/java/com/bosshand/virgo/api/dao/ProjectBindDao.java

@@ -1,17 +0,0 @@
-package com.bosshand.virgo.api.dao;
-
-import com.bosshand.virgo.api.model.ProjectBind;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-@Mapper
-public interface ProjectBindDao {
-
-    List<ProjectBind> get(long organizationId, long userId);
-
-    int insert(ProjectBind projectBind);
-
-    int delete(long projectId);
-
-}

+ 0 - 28
virgo.api/src/main/java/com/bosshand/virgo/api/service/ProjectBindService.java

@@ -1,28 +0,0 @@
-package com.bosshand.virgo.api.service;
-
-import com.bosshand.virgo.api.dao.ProjectBindDao;
-import com.bosshand.virgo.api.model.ProjectBind;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class ProjectBindService {
-
-    @Autowired
-    ProjectBindDao projectBindDao;
-
-    public List<ProjectBind> get(long organizationId, long userId) {
-        return projectBindDao.get(organizationId, userId);
-    }
-
-    public int insert(ProjectBind projectBind) {
-        return projectBindDao.insert(projectBind);
-    }
-
-    public int delete(long projectId) {
-        return projectBindDao.delete(projectId);
-    }
-
-}

+ 0 - 26
virgo.api/src/main/resources/mapper/ProjectBindMapper.xml

@@ -1,26 +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.api.dao.ProjectBindDao">
-
-    <resultMap type="com.bosshand.virgo.api.model.ProjectBind" id="ProjectBindResult" >
-        <id column="id" property="id"/>
-        <result column="organizationId" property="organizationId"/>
-        <result column="projectId" property="projectId"/>
-        <result column="userId" property="userId"/>
-    </resultMap>
-
-    <select id="get" resultMap="ProjectBindResult">
-        select * from project_bind where organizationId = #{organizationId} and userId = #{userId}
-    </select>
-
-    <insert id="insert">
-        insert into project_bind (organizationId, projectId, userId) value (#{organizationId}, #{projectId}, #{userId})
-    </insert>
-
-    <delete id="delete">
-        delete from project_bind where projectId = #{projectId}
-    </delete>
-
-</mapper>

+ 18 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/controller/UserContextController.java

@@ -1,5 +1,6 @@
 package com.bosshand.virgo.core.controller;
 
+import com.bosshand.virgo.core.model.Identity;
 import com.bosshand.virgo.core.model.MgrOrganization;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.model.UserContext;
@@ -18,6 +19,7 @@ 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;
 import java.util.Random;
 
@@ -104,6 +106,22 @@ public class UserContextController {
 		return Response.ok(userContext.getOrganizationList());
 	}
 
+	@ApiOperation(value="获取项目Id列表", notes="获取项目Id列表")
+	@RequestMapping(value = "/userContext/project", method = RequestMethod.GET)
+	public Response listProject() {
+		UserContext userContext = ContextUtils.getUserContext();
+		List<Long> projectIds = mgrUserService.getProjectIds(userContext.getOrganizationId(), userContext.getUserId());
+		return Response.ok(projectIds);
+	}
+
+	@ApiOperation(value="获取身份列表", notes="获取身份列表")
+	@RequestMapping(value = "/userContext/identity", method = RequestMethod.GET)
+	public Response listIdentity() {
+		UserContext userContext = ContextUtils.getUserContext();
+		List<Identity> identityList = mgrUserService.getIdentityList(userContext.getProjectId(), userContext.getUserId());
+		return Response.ok(identityList);
+	}
+
 	@ApiOperation(value="切换组织", notes="切换组织")
 	@RequestMapping(value = "/userContext/organization", method = RequestMethod.POST)
 	public Response saveLastOrganization(@RequestBody MgrOrganization organization) {

+ 21 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/dao/IdentityDao.java

@@ -0,0 +1,21 @@
+package com.bosshand.virgo.core.dao;
+
+import com.bosshand.virgo.core.model.Identity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface IdentityDao {
+
+    int insert(Identity identity);
+
+    int update(Identity identity);
+
+    List<Identity> getList();
+
+    List<Identity> getIds(List<Long> ids);
+
+    int delete(long id);
+
+}

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

@@ -0,0 +1,25 @@
+package com.bosshand.virgo.core.dao;
+
+import com.bosshand.virgo.core.model.MgrClient;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface MgrClientDao {
+
+    int insert(MgrClient mgrClient);
+
+    int update(MgrClient mgrClient);
+
+    MgrClient get(long id);
+
+    int delete(long id);
+
+    int getTotalCount(MgrClient mgrClient);
+
+    List<MgrClient> getLimit(@Param("p") MgrClient p, @Param("currIndex") int currIndex, @Param("pageSize") int pageSize);
+
+
+}

+ 19 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrOrganizationProjectDao.java

@@ -0,0 +1,19 @@
+package com.bosshand.virgo.core.dao;
+
+import com.bosshand.virgo.core.model.MgrOrganizationProject;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface MgrOrganizationProjectDao {
+
+    List<MgrOrganizationProject> get(long organizationId, long userId);
+
+    List<MgrOrganizationProject> getProject(long projectId, long userId);
+
+    int insert(MgrOrganizationProject mgrOrganizationProject);
+
+    int delete(long projectId);
+
+}

+ 43 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/model/Identity.java

@@ -0,0 +1,43 @@
+package com.bosshand.virgo.core.model;
+
+/**
+ * 身份
+ */
+public class Identity {
+
+    private long id;
+
+    /**
+     * 身份名称
+     */
+    private String name;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    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 getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

+ 239 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrClient.java

@@ -0,0 +1,239 @@
+package com.bosshand.virgo.core.model;
+
+/**
+ * 客户
+ */
+public class MgrClient {
+
+    private long id;
+
+    /**
+     * 组织id
+     */
+    private long organizationId;
+
+    /**
+     * 创建者id
+     */
+    private long userId;
+
+    /**
+     * 客户名称
+     */
+    private String name;
+
+    /**
+     * 客户类型
+     */
+    private int type;
+
+    /**
+     * 联系人
+     */
+    private String person;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 微信号
+     */
+    private String weChatAccount;
+
+    /**
+     * 跟进状态
+     */
+    private int followUpState;
+
+    /**
+     * 职位
+     */
+    private String job;
+
+    /**
+     * 需求区间
+     */
+    private String demand;
+
+    /**
+     * 装修要求
+     */
+    private String decorationRequirements;
+
+    /**
+     * 客户行业
+     */
+    private String customerIndustry;
+
+    /**
+     * 跟进人
+     */
+    private String followUpPerson;
+
+    /**
+     * 首次带看房源
+     */
+    private String firsTimeRoom;
+
+    /**
+     * 来访渠道
+     */
+    private String visitingChannels;
+
+    /**
+     * 首次来访时间
+     */
+    private String visitingTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(long organizationId) {
+        this.organizationId = organizationId;
+    }
+
+    public long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(long userId) {
+        this.userId = userId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public String getPerson() {
+        return person;
+    }
+
+    public void setPerson(String person) {
+        this.person = person;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getWeChatAccount() {
+        return weChatAccount;
+    }
+
+    public void setWeChatAccount(String weChatAccount) {
+        this.weChatAccount = weChatAccount;
+    }
+
+    public int getFollowUpState() {
+        return followUpState;
+    }
+
+    public void setFollowUpState(int followUpState) {
+        this.followUpState = followUpState;
+    }
+
+    public String getJob() {
+        return job;
+    }
+
+    public void setJob(String job) {
+        this.job = job;
+    }
+
+    public String getDemand() {
+        return demand;
+    }
+
+    public void setDemand(String demand) {
+        this.demand = demand;
+    }
+
+    public String getDecorationRequirements() {
+        return decorationRequirements;
+    }
+
+    public void setDecorationRequirements(String decorationRequirements) {
+        this.decorationRequirements = decorationRequirements;
+    }
+
+    public String getCustomerIndustry() {
+        return customerIndustry;
+    }
+
+    public void setCustomerIndustry(String customerIndustry) {
+        this.customerIndustry = customerIndustry;
+    }
+
+    public String getFollowUpPerson() {
+        return followUpPerson;
+    }
+
+    public void setFollowUpPerson(String followUpPerson) {
+        this.followUpPerson = followUpPerson;
+    }
+
+    public String getFirsTimeRoom() {
+        return firsTimeRoom;
+    }
+
+    public void setFirsTimeRoom(String firsTimeRoom) {
+        this.firsTimeRoom = firsTimeRoom;
+    }
+
+    public String getVisitingChannels() {
+        return visitingChannels;
+    }
+
+    public void setVisitingChannels(String visitingChannels) {
+        this.visitingChannels = visitingChannels;
+    }
+
+    public String getVisitingTime() {
+        return visitingTime;
+    }
+
+    public void setVisitingTime(String visitingTime) {
+        this.visitingTime = visitingTime;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

+ 37 - 3
virgo.api/src/main/java/com/bosshand/virgo/api/model/ProjectBind.java

@@ -1,18 +1,37 @@
-package com.bosshand.virgo.api.model;
+package com.bosshand.virgo.core.model;
 
 /**
- * 用户项目绑定
+ *  用户项目绑定
  */
-public class ProjectBind {
+public class MgrOrganizationProject {
 
     private int id;
 
+    /**
+     * 组织id
+     */
     private long organizationId;
 
+    /**
+     * 项目id
+     */
     private long projectId;
 
+    /**
+     * 用户id
+     */
     private long userId;
 
+    /**
+     * 客户id
+     */
+    private long clientId;
+
+    /**
+     * 身份id
+     */
+    private long identityId;
+
     public int getId() {
         return id;
     }
@@ -45,4 +64,19 @@ public class ProjectBind {
         this.userId = userId;
     }
 
+    public long getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(long clientId) {
+        this.clientId = clientId;
+    }
+
+    public long getIdentityId() {
+        return identityId;
+    }
+
+    public void setIdentityId(long identityId) {
+        this.identityId = identityId;
+    }
 }

+ 0 - 13
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrUserRole.java

@@ -29,11 +29,6 @@ public class MgrUserRole implements BaseModel {
 	 */
 	private String roles;
 
-	/**
-	 * 身份 1:客户,2:经纪人
-	 */
-	private String identity;
-
 	private boolean admin;
 
 	public int getId() {
@@ -84,14 +79,6 @@ public class MgrUserRole implements BaseModel {
 		this.roles = roles;
 	}
 
-	public String getIdentity() {
-		return identity;
-	}
-
-	public void setIdentity(String identity) {
-		this.identity = identity;
-	}
-
 	public boolean isAdmin() {
 		return admin;
 	}

+ 37 - 7
virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java

@@ -1,10 +1,7 @@
 package com.bosshand.virgo.core.service;
 
 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.dao.*;
 import com.bosshand.virgo.core.model.*;
 import com.bosshand.virgo.core.utils.Utils;
 import com.bosshand.virgo.core.utils.WeChatUtil;
@@ -17,8 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
 
 @Service
 public class MgrUserService {
@@ -31,7 +27,13 @@ public class MgrUserService {
 
 	@Autowired
 	private MgrOrganizationDao mgrOrganizationDao;
-	
+
+	@Autowired
+	private MgrOrganizationProjectDao mgrOrganizationProjectDao;
+
+	@Autowired
+	private IdentityDao identityDao;
+
 	@Autowired
 	private MgrResourceDao mgrResourceDao;
 
@@ -178,6 +180,34 @@ public class MgrUserService {
 		user.setLastProjectId(projectId);
 		mgrUserDao.updateLastProjectId(user);
 	}
+
+	public List<Identity> getIdentityList(long projectId, long userId) {
+		List<MgrOrganizationProject> list = mgrOrganizationProjectDao.getProject(projectId, userId);
+		Set<Long> identityIds = new HashSet<>();
+		if (list.size() > 0) {
+			if (list != null) {
+				for (MgrOrganizationProject mop : list) {
+					identityIds.add(mop.getIdentityId());
+				}
+			}
+			ArrayList<Long> ids = new ArrayList<>(identityIds);
+			return identityDao.getIds(ids);
+		}
+		return new ArrayList();
+	}
+
+	public List<Long> getProjectIds(long organizationId, long userId) {
+		List<MgrOrganizationProject> list = mgrOrganizationProjectDao.get(organizationId, userId);
+		Set<Long> projectIds = new HashSet<>();
+		if (list != null) {
+			for (MgrOrganizationProject mop : list) {
+				projectIds.add(mop.getProjectId());
+			}
+		}
+		return new ArrayList<Long>(projectIds);
+	}
+
+
 	
 	public MgrResource getDefaultResource() {
 		return mgrResourceDao.defaultResource();

+ 34 - 0
virgo.core/src/main/resources/mapper/IdentityMapper.xml

@@ -0,0 +1,34 @@
+<?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.IdentityDao">
+
+    <resultMap type="com.bosshand.virgo.core.model.Identity" id="identityResult">
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="remark" property="remark"/>
+    </resultMap>
+
+    <select id="getList" resultMap="identityResult">
+        select * from identity
+    </select>
+
+    <select id="getIds" resultMap="identityResult">
+        select * from identity id in
+        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <insert id="insert" parameterType="com.bosshand.virgo.core.model.Identity" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO identity(name, remark) VALUES (#{name}, #{remark})
+    </insert>
+
+    <delete id="delete">
+        DELETE FROM identity WHERE id = #{id}
+    </delete>
+
+    <update id="update" parameterType="com.bosshand.virgo.core.model.Identity">
+        UPDATE identity SET name = #{name}, remark= #{remark} WHERE id = #{id}
+    </update>
+
+</mapper>

+ 109 - 0
virgo.core/src/main/resources/mapper/MgrClientMapper.xml

@@ -0,0 +1,109 @@
+<!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.MgrClientDao">
+
+    <resultMap type="com.bosshand.virgo.core.model.MgrClient" id="clientResult">
+        <id column="id" property="id"/>
+        <result column="organizationId" property="organizationId"/>
+        <result column="userId" property="userId"/>
+        <result column="name" property="name"/>
+        <result column="type" property="type"/>
+        <result column="person" property="person"/>
+        <result column="phone" property="phone"/>
+        <result column="weChatAccount" property="weChatAccount"/>
+        <result column="followUpState" property="followUpState"/>
+        <result column="job" property="job"/>
+        <result column="demand" property="demand"/>
+        <result column="decorationRequirements" property="decorationRequirements"/>
+        <result column="customerIndustry" property="customerIndustry"/>
+        <result column="followUpPerson" property="followUpPerson"/>
+        <result column="firsTimeRoom" property="firsTimeRoom"/>
+        <result column="visitingChannels" property="visitingChannels"/>
+        <result column="visitingTime" property="visitingTime"/>
+        <result column="remark" property="remark"/>
+    </resultMap>
+
+    <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrClient" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO mgr_client(`organizationId`, `userId`, `name`, `type`, `person`, `phone`, `weChatAccount`, `followUpState`, `job`, `demand`, `decorationRequirements`,
+                               `customerIndustry`, `followUpPerson`, `firsTimeRoom`, `visitingChannels`, `visitingTime`, `remark`)
+        VALUES (#{organizationId}, #{userId}, #{name}, #{type}, #{person}, #{phone}, #{weChatAccount}, #{followUpState}, #{job}, #{demand}, #{decorationRequirements},
+                #{customerIndustry}, #{followUpPerson}, #{firsTimeRoom}, #{visitingChannels}, #{visitingTime}, #{remark})
+    </insert>
+
+    <delete id="delete">
+        DELETE from mgr_client where id=#{id}
+    </delete>
+
+    <update id="update" parameterType="com.bosshand.virgo.core.model.MgrClient">
+        UPDATE mgr_client
+        <trim prefix="set" suffixOverrides=",">
+            <if test="name!=null">name=#{name},</if>
+            <if test="type!=0">type=#{type},</if>
+            <if test="person!=null">person=#{person},</if>
+            <if test="weChatAccount!=null">weChatAccount=#{weChatAccount},</if>
+            <if test="followUpState!=0">followUpState=#{followUpState},</if>
+            <if test="job!=null">job=#{job},</if>
+            <if test="demand!=null">demand=#{demand},</if>
+            <if test="decorationRequirements!=null">decorationRequirements=#{decorationRequirements},</if>
+            <if test="customerIndustry!=null">customerIndustry=#{customerIndustry},</if>
+            <if test="followUpPerson!=null">followUpPerson=#{followUpPerson},</if>
+            <if test="firsTimeRoom!=null">firsTimeRoom=#{firsTimeRoom},</if>
+            <if test="visitingChannels!=null">visitingChannels=#{visitingChannels},</if>
+            <if test="visitingTime!=null">visitingTime=#{visitingTime},</if>
+            <if test="remark!=null">remark=#{remark},</if>
+        </trim>
+        WHERE id=#{id}
+    </update>
+
+    <select id="get" resultMap="clientResult">
+        SELECT * FROM mgr_client where id = #{id}
+    </select>
+
+    <select id="getTotalCount" parameterType="com.bosshand.virgo.core.model.MgrClient" resultType="Integer">
+        SELECT count(*) FROM mgr_client
+        <where>
+            <if test="organizationId!=0">and organizationId=#{organizationId}</if>
+            <if test="userId!=0">and userId=#{userId}</if>
+            <if test="name!=null">and name=#{name}</if>
+            <if test="type!=0">and type=#{type}</if>
+            <if test="person!=null">and person=#{person}</if>
+            <if test="weChatAccount!=null">and weChatAccount=#{weChatAccount}</if>
+            <if test="followUpState!=0">and followUpState=#{followUpState}</if>
+            <if test="job!=null">and job=#{job}</if>
+            <if test="demand!=null">and demand=#{demand}</if>
+            <if test="decorationRequirements!=null">and decorationRequirements=#{decorationRequirements}</if>
+            <if test="customerIndustry!=null">and customerIndustry=#{customerIndustry}</if>
+            <if test="followUpPerson!=null">and followUpPerson=#{followUpPerson}</if>
+            <if test="firsTimeRoom!=null">and firsTimeRoom=#{firsTimeRoom}</if>
+            <if test="visitingChannels!=null">and visitingChannels=#{visitingChannels}</if>
+            <if test="visitingTime!=null">and visitingTime=#{visitingTime}</if>
+            <if test="remark!=null">and remark=#{remark}</if>
+        </where>
+    </select>
+
+    <select id="getLimit" resultMap="clientResult">
+        SELECT * FROM mgr_client
+        <where>
+            <if test="p.organizationId!=0">and organizationId=#{p.organizationId}</if>
+            <if test="p.userId!=0">and userId=#{p.userId}</if>
+            <if test="p.name!=null">and name=#{p.name}</if>
+            <if test="p.type!=0">and type=#{p.type}</if>
+            <if test="p.person!=null">and person=#{p.person}</if>
+            <if test="p.weChatAccount!=null">and weChatAccount=#{p.weChatAccount}</if>
+            <if test="p.followUpState!=0">and followUpState=#{p.followUpState}</if>
+            <if test="p.job!=null">and job=#{p.job}</if>
+            <if test="p.demand!=null">and demand=#{p.demand}</if>
+            <if test="p.decorationRequirements!=null">and decorationRequirements=#{p.decorationRequirements}</if>
+            <if test="p.customerIndustry!=null">and customerIndustry=#{p.customerIndustry}</if>
+            <if test="p.followUpPerson!=null">and followUpPerson=#{p.followUpPerson}</if>
+            <if test="p.firsTimeRoom!=null">and firsTimeRoom=#{p.firsTimeRoom}</if>
+            <if test="p.visitingChannels!=null">and visitingChannels=#{p.visitingChannels}</if>
+            <if test="p.visitingTime!=null">and visitingTime=#{p.visitingTime}</if>
+            <if test="p.remark!=null">and remark=#{p.remark}</if>
+        </where>
+        limit #{currIndex} , #{pageSize}
+    </select>
+
+</mapper>

+ 32 - 0
virgo.core/src/main/resources/mapper/MgrOrganizationProjectMapper.xml

@@ -0,0 +1,32 @@
+<!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.MgrOrganizationProjectDao">
+
+    <resultMap type="com.bosshand.virgo.core.model.MgrOrganizationProject" id="mgrOrganizationProjectResult" >
+        <id column="id" property="id"/>
+        <result column="organizationId" property="organizationId"/>
+        <result column="projectId" property="projectId"/>
+        <result column="userId" property="userId"/>
+        <result column="clientId" property="clientId"/>
+        <result column="identityId" property="identityId"/>
+    </resultMap>
+
+    <select id="get" resultMap="mgrOrganizationProjectResult">
+        select * from mgr_organization_project where organizationId = #{organizationId} and userId = #{userId}
+    </select>
+
+    <select id="getProject" resultMap="mgrOrganizationProjectResult">
+        select * from mgr_organization_project where projectId = #{projectId} and userId = #{userId}
+    </select>
+
+    <insert id="insert">
+        insert into mgr_organization_project (organizationId, projectId, userId, clientId, identityId) value (#{organizationId}, #{projectId}, #{userId}, #{clientId}, #{identityId})
+    </insert>
+
+    <delete id="delete">
+        delete from mgr_organization_project where projectId = #{projectId}
+    </delete>
+
+</mapper>

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

@@ -11,7 +11,6 @@
 	<result column="menus" property="menus"/>	
 	<result column="resources" property="resources"/>	
 	<result column="roles" property="roles"/>
-	<result column="identity" property="identity"/>
 	<result column="admin" property="admin"/>
 </resultMap>
 
@@ -32,8 +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, identity, admin)
-	values(#{userId}, #{organizationId}, #{menus}, #{resources}, #{roles} ,#{identity} ,#{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,7 +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="identity!=null">identity=#{identity},</if>
 			<if test="admin!=null">admin=#{admin},</if>
 		</trim>		
 	WHERE id=#{id}

+ 64 - 0
virgo.manager/src/main/java/com/bosshand/virgo/controller/ClientController.java

@@ -0,0 +1,64 @@
+package com.bosshand.virgo.controller;
+
+import com.bosshand.virgo.core.model.MgrClient;
+import com.bosshand.virgo.core.response.Response;
+import com.bosshand.virgo.core.utils.ContextUtils;
+import com.bosshand.virgo.service.ClientService;
+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("client")
+public class ClientController {
+
+    @Autowired
+    ClientService clientService;
+
+    @ApiOperation("获取")
+    @RequestMapping(value = "/{currPage}/{pageSize}", method = RequestMethod.POST)
+    public Response list(@RequestBody MgrClient mgrClient, @PathVariable int currPage, @PathVariable int pageSize) {
+        long id = ContextUtils.getCurrentUser().getId();
+        mgrClient.setUserId(id);
+        int totalCount = clientService.getTotalCount(mgrClient);
+        List<MgrClient> dataList = clientService.getLimit(mgrClient, currPage, pageSize);
+        Map<String, Object> result = new HashMap<>();
+        result.put("dataList", dataList);
+        result.put("totalCount", totalCount);
+        return Response.ok(result);
+    }
+
+    @ApiOperation("保存")
+    @RequestMapping(value = "", method = RequestMethod.POST)
+    public Response insert(@RequestBody MgrClient mgrClient) {
+        long id = ContextUtils.getCurrentUser().getId();
+        mgrClient.setUserId(id);
+        clientService.insert(mgrClient);
+        return Response.ok();
+    }
+
+    @ApiOperation("更新")
+    @RequestMapping(value = "/update", method = RequestMethod.PUT)
+    public Response update(@RequestBody MgrClient mgrClient) {
+        clientService.update(mgrClient);
+        return Response.ok();
+    }
+
+    @ApiOperation("删除")
+    @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
+    public Response delete(@PathVariable long id) {
+        clientService.delete(id);
+        return Response.ok();
+    }
+
+    @ApiOperation("详情")
+    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+    public Response get(@PathVariable long id) {
+        return Response.ok(clientService.get(id));
+    }
+
+}

+ 45 - 0
virgo.manager/src/main/java/com/bosshand/virgo/controller/IdentityController.java

@@ -0,0 +1,45 @@
+package com.bosshand.virgo.controller;
+
+import com.bosshand.virgo.core.model.Identity;
+import com.bosshand.virgo.core.response.Response;
+import com.bosshand.virgo.service.IdentityService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("identity")
+public class IdentityController {
+
+    @Autowired
+    IdentityService identityService;
+
+    @ApiOperation("身份获取")
+    @RequestMapping(value = "", method = RequestMethod.GET)
+    public Response list() {
+        return Response.ok(identityService.getList());
+    }
+
+    @ApiOperation("身份保存")
+    @RequestMapping(value = "", method = RequestMethod.POST)
+    public Response insert(@RequestBody Identity identity) {
+        identityService.insert(identity);
+        return Response.ok();
+    }
+
+    @ApiOperation("身份更新")
+    @RequestMapping(value = "/update", method = RequestMethod.PUT)
+    public Response update(@RequestBody Identity identity) {
+        identityService.update(identity);
+        return Response.ok();
+    }
+
+    @ApiOperation("身份删除")
+    @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
+    public Response delete(@PathVariable long id) {
+        identityService.delete(id);
+        return Response.ok();
+    }
+
+
+}

+ 27 - 0
virgo.manager/src/main/java/com/bosshand/virgo/controller/OrganizationProjectController.java

@@ -0,0 +1,27 @@
+package com.bosshand.virgo.controller;
+
+import com.bosshand.virgo.core.model.MgrOrganizationProject;
+import com.bosshand.virgo.core.response.Response;
+import com.bosshand.virgo.service.OrganizationProjectService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+@RestController
+@RequestMapping("bindProject")
+public class OrganizationProjectController {
+
+    @Autowired
+    OrganizationProjectService organizationProjectService;
+
+    @ApiOperation("绑定项目")
+    @RequestMapping(value = "", method = RequestMethod.POST)
+    public Response bindProject(@RequestBody MgrOrganizationProject mgrOrganizationProject) {
+        organizationProjectService.insert(mgrOrganizationProject);
+        return Response.ok();
+    }
+
+}

+ 0 - 25
virgo.manager/src/main/java/com/bosshand/virgo/controller/UserController.java

@@ -1,6 +1,5 @@
 package com.bosshand.virgo.controller;
 
-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;
@@ -15,30 +14,6 @@ public class UserController {
 	@Autowired
 	UserService userService;
 
-	@ApiOperation(value = "客户列表", notes = "客户列表")
-	@RequestMapping(value = "/list/{organizationId}/{identity}", method = RequestMethod.POST)
-	public Response getUserList(@PathVariable long organizationId, @PathVariable int identity) {
-		return Response.ok(userService.getUserList(organizationId, String.valueOf(identity)));
-	}
-
-	@ApiOperation(value = "新增客户", notes = "新增客户")
-	@RequestMapping(value = "/addClient/{organizationId}/{identity}/{phone}", method = RequestMethod.POST)
-	public Response insertUser(@PathVariable long organizationId, @PathVariable int identity, @PathVariable String phone) {
-		MgrUser user = userService.getByPhone(phone);
-		if (user == null) {
-			return Response.fail(20001, "客户未注册!");
-		}
-		userService.addClient(user.getId(), organizationId, String.valueOf(identity));
-		return Response.ok(user);
-	}
-
-	@ApiOperation(value = "删除客户", notes = "删除客户")
-	@RequestMapping(value = "/delClient/{organizationId}/{userId}", method = RequestMethod.DELETE)
-	public Response deleteUser(@PathVariable long organizationId, @PathVariable long userId) {
-		userService.deleteUser(organizationId, userId);
-		return Response.ok();
-	}
-
 	@ApiOperation(value="更新部门角色", notes="更新部门角色")
 	@RequestMapping(value = "/updateUserRole", method = RequestMethod.POST)
 	public Response updateUserRole(@RequestBody MgrUserRole userRole) {

+ 40 - 0
virgo.manager/src/main/java/com/bosshand/virgo/service/ClientService.java

@@ -0,0 +1,40 @@
+package com.bosshand.virgo.service;
+
+import com.bosshand.virgo.core.dao.MgrClientDao;
+import com.bosshand.virgo.core.model.MgrClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ClientService {
+
+    @Autowired
+    MgrClientDao clientDao;
+
+    public int insert(MgrClient mgrClient) {
+        return clientDao.insert(mgrClient);
+    }
+
+    public int update(MgrClient mgrClient) {
+        return clientDao.update(mgrClient);
+    }
+
+    public MgrClient get(long id) {
+        return clientDao.get(id);
+    }
+
+    public int delete(long id) {
+        return clientDao.delete(id);
+    }
+
+    public int getTotalCount(MgrClient mgrClient) {
+        return clientDao.getTotalCount(mgrClient);
+    }
+
+    public List<MgrClient> getLimit(MgrClient mgrClient, int currPage, int pageSize) {
+        int currIndex = (currPage - 1) * pageSize;
+        return clientDao.getLimit(mgrClient, currIndex, pageSize);
+    }
+}

+ 32 - 0
virgo.manager/src/main/java/com/bosshand/virgo/service/IdentityService.java

@@ -0,0 +1,32 @@
+package com.bosshand.virgo.service;
+
+import com.bosshand.virgo.core.dao.IdentityDao;
+import com.bosshand.virgo.core.model.Identity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class IdentityService {
+
+    @Autowired
+    IdentityDao identityDao;
+
+    public int insert(Identity identity) {
+        return identityDao.insert(identity);
+    }
+
+    public int update(Identity identity) {
+        return identityDao.update(identity);
+    }
+
+    public List<Identity> getList() {
+        return identityDao.getList();
+    }
+
+    public int delete(long id) {
+        return identityDao.delete(id);
+    }
+
+}

+ 28 - 0
virgo.manager/src/main/java/com/bosshand/virgo/service/OrganizationProjectService.java

@@ -0,0 +1,28 @@
+package com.bosshand.virgo.service;
+
+import com.bosshand.virgo.core.dao.MgrOrganizationProjectDao;
+import com.bosshand.virgo.core.model.MgrOrganizationProject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class OrganizationProjectService {
+
+    @Autowired
+    MgrOrganizationProjectDao mgrOrganizationProjectDao;
+
+    public List<MgrOrganizationProject> get(long organizationId, long userId) {
+        return mgrOrganizationProjectDao.get(organizationId, userId);
+    }
+
+    public int insert(MgrOrganizationProject mgrOrganizationProject) {
+        return mgrOrganizationProjectDao.insert(mgrOrganizationProject);
+    }
+
+    public int delete(long projectId) {
+        return mgrOrganizationProjectDao.delete(projectId);
+    }
+
+}

+ 1 - 47
virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java

@@ -55,29 +55,6 @@ public class UserService {
         return mgrUserDao.checkFace(id);
     }
 
-    public void deleteUser(long organizationId, long userId) {
-        MgrUserRole mgrUserRole = mgrUserRoleDao.getUser(userId, organizationId);
-        if (mgrUserRole != null) {
-            mgrUserRoleDao.delete(mgrUserRole.getId());
-        }
-    }
-
-    public List<MgrUser> getUserList(long organizationId, String identity) {
-        List<MgrUserRole> list = mgrUserRoleDao.getOrganizationId(organizationId);
-        List<Long> ids = new ArrayList<>();
-        for (MgrUserRole mur : list) {
-            if (mur.getIdentity() != null) {
-                if (Arrays.asList(mur.getIdentity().split(",")).contains(identity)) {
-                    ids.add(mur.getUserId());
-                }
-            }
-        }
-        if (ids.size() > 0) {
-            return mgrUserDao.getIds(ids);
-        }
-        return new ArrayList<>();
-    }
-
     public List<MgrUser> getUserByOrganizationId(long organizationId) {
         List<MgrUserRole> list = mgrUserRoleDao.getOrganizationId(organizationId);
         List<Long> ids = new ArrayList<>();
@@ -90,35 +67,12 @@ public class UserService {
         return new ArrayList<>();
     }
 
-    public void addClient(long userId, long organizationId, String identity) {
-        MgrUserRole mur = mgrUserRoleDao.getUser(userId, organizationId);
-        if (mur != null) {
-            if (mur.getIdentity() == null) {
-                mur.setIdentity(identity);
-            } else {
-                List<String> list = new ArrayList<>(Arrays.asList(mur.getIdentity().split(",")));
-                if (list.contains(identity)) {
-                    return;
-                }
-                list.add(identity);
-                mur.setIdentity(String.join(",", list));
-            }
-            mgrUserRoleDao.update(mur);
-        } else {
-            MgrUserRole userRole = new MgrUserRole();
-            userRole.setUserId(userId);
-            userRole.setOrganizationId(organizationId);
-            userRole.setIdentity(identity);
-            mgrUserRoleDao.insert(userRole);
-        }
-    }
-
     public void updateUserRole(MgrUserRole userRole) {
         MgrUserRole mur = mgrUserRoleDao.getUser(userRole.getUserId(), userRole.getOrganizationId());
         if (mur.getRoles() == null) {
             mur.setRoles(userRole.getRoles());
         } else {
-            List<String> list = new ArrayList<>(Arrays.asList(mur.getIdentity().split(",")));
+            List<String> list = new ArrayList<>(Arrays.asList(mur.getRoles().split(",")));
             String[] split = userRole.getRoles().split(",");
             for (String s : split) {
                 if (!list.contains(s)) {

+ 1 - 1
virgo.warpdrive/bin/pom.xml

@@ -25,7 +25,7 @@
 		</dependency>
 	    <dependency>
 	      <groupId>org.springframework.cloud</groupId>
-	      <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+	      <artifactId>spring-cloud-starter-netflix-eureka-mgrClient</artifactId>
 	    </dependency>
 	    <dependency>
 	      <groupId>org.springframework.boot</groupId>