dcs 1 年之前
父节点
当前提交
569a8af7dd

+ 7 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/controller/ProjectItemTargetRoomController.java

@@ -78,4 +78,11 @@ public class ProjectItemTargetRoomController {
         room.setTagList(tags);
         room.setTagList(tags);
         return Response.ok(room);
         return Response.ok(room);
     }
     }
+
+    @ApiOperation("层级结构")
+    @RequestMapping(value = "/level/{projectId}", method = RequestMethod.GET)
+    public Response getLevel(@PathVariable long projectId) {
+        return Response.ok(projectItemTargetRoomService.getLevel(projectId));
+    }
+
 }
 }

+ 1 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/ProjectItemDao.java

@@ -27,4 +27,5 @@ public interface ProjectItemDao {
 
 
     List<ProjectItem> getLimit(@Param("p") ProjectItem p, @Param("currIndex") int currIndex, @Param("pageSize") int pageSize);
     List<ProjectItem> getLimit(@Param("p") ProjectItem p, @Param("currIndex") int currIndex, @Param("pageSize") int pageSize);
 
 
+    List<ProjectItem> getProjectId(long projectId);
 }
 }

+ 1 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/ProjectItemTargetRoomDao.java

@@ -12,6 +12,7 @@ public interface ProjectItemTargetRoomDao {
     ProjectItemTargetRoom get(long id);
     ProjectItemTargetRoom get(long id);
 
 
     List<ProjectItemTargetRoom> getProjectItemTargetRoom(ProjectItemTargetRoom projectItemTargetRoom);
     List<ProjectItemTargetRoom> getProjectItemTargetRoom(ProjectItemTargetRoom projectItemTargetRoom);
+    List<ProjectItemTargetRoom> getProjectItemTargetId(long projectItemTargetId);
 
 
     int getTotalCount(ProjectItemTargetRoom projectItemTargetRoom);
     int getTotalCount(ProjectItemTargetRoom projectItemTargetRoom);
 
 

+ 12 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/ProjectItemTarget.java

@@ -1,5 +1,7 @@
 package com.bosshand.virgo.api.model;
 package com.bosshand.virgo.api.model;
 
 
+import java.util.List;
+
 /**
 /**
  * 楼层
  * 楼层
  */
  */
@@ -37,6 +39,8 @@ public class ProjectItemTarget {
      */
      */
     private String roomNumber;
     private String roomNumber;
 
 
+    private List<ProjectItemTargetRoom> projectItemTargetRoomList;
+
     public long getId() {
     public long getId() {
         return id;
         return id;
     }
     }
@@ -92,4 +96,12 @@ public class ProjectItemTarget {
     public void setRoomNumber(String roomNumber) {
     public void setRoomNumber(String roomNumber) {
         this.roomNumber = roomNumber;
         this.roomNumber = roomNumber;
     }
     }
+
+    public List<ProjectItemTargetRoom> getProjectItemTargetRoomList() {
+        return projectItemTargetRoomList;
+    }
+
+    public void setProjectItemTargetRoomList(List<ProjectItemTargetRoom> projectItemTargetRoomList) {
+        this.projectItemTargetRoomList = projectItemTargetRoomList;
+    }
 }
 }

+ 13 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/service/ProjectItemTargetRoomService.java

@@ -129,5 +129,18 @@ public class ProjectItemTargetRoomService {
         return projectItemTargetRoomDao.update(projectItemTargetRoom);
         return projectItemTargetRoomDao.update(projectItemTargetRoom);
     }
     }
 
 
+    public Project getLevel(long projectId) {
+        Project project = projectDao.getProject(projectId);
+        List<ProjectItem> itemList = projectItemDao.getProjectId(project.getId());
+        for (ProjectItem item : itemList) {
+            List<ProjectItemTarget> targetList = item.getProjectItemTargetList();
+            for (ProjectItemTarget target : targetList) {
+                target.setProjectItemTargetRoomList(projectItemTargetRoomDao.getProjectItemTargetId(target.getId()));
+            }
+        }
+        project.setProjectItemList(itemList);
+        return project;
+    }
+
 
 
 }
 }

+ 5 - 0
virgo.api/src/main/resources/mapper/ProjectItemMapper.xml

@@ -54,6 +54,11 @@
 		where p.id=#{id}
 		where p.id=#{id}
 	</select>
 	</select>
 
 
+	<select id="getProjectId" resultMap="result">
+		<include refid="query"/>
+		where p.projectId=#{projectId}
+	</select>
+
 	<select id="getIds" resultMap="result">
 	<select id="getIds" resultMap="result">
 		<include refid="query"/>
 		<include refid="query"/>
 		where p.id in
 		where p.id in

+ 5 - 0
virgo.api/src/main/resources/mapper/ProjectItemTargetRoomMapper.xml

@@ -38,6 +38,11 @@
         where id=#{id}
         where id=#{id}
     </select>
     </select>
 
 
+    <select id="getProjectItemTargetId" resultMap="projectItemTargetRoomResult">
+        <include refid="ProjectItemTargetRoomQuery"/>
+        where projectItemTargetId=#{projectItemTargetId}
+    </select>
+
     <select id="getProjectItemTargetRoom" resultMap="projectItemTargetRoomResult">
     <select id="getProjectItemTargetRoom" resultMap="projectItemTargetRoomResult">
         <include refid="ProjectItemTargetRoomQuery"/>
         <include refid="ProjectItemTargetRoomQuery"/>
         <where>
         <where>

+ 10 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganization.java

@@ -10,6 +10,8 @@ public class MgrOrganization implements BaseModel {
 
 
     private long id;
     private long id;
 
 
+    private String logo;
+
     private String name;
     private String name;
 
 
     private String contact;
     private String contact;
@@ -52,6 +54,14 @@ public class MgrOrganization implements BaseModel {
         this.id = id;
         this.id = id;
     }
     }
 
 
+    public String getLogo() {
+        return logo;
+    }
+
+    public void setLogo(String logo) {
+        this.logo = logo;
+    }
+
     public String getName() {
     public String getName() {
         return name;
         return name;
     }
     }

+ 3 - 1
virgo.core/src/main/resources/mapper/MgrOrganizationMapper.xml

@@ -6,6 +6,7 @@
 
 
 <resultMap type="com.bosshand.virgo.core.model.MgrOrganization" id="MgrOrganizationResult" >
 <resultMap type="com.bosshand.virgo.core.model.MgrOrganization" id="MgrOrganizationResult" >
 	<id column="id" property="id"/>
 	<id column="id" property="id"/>
+	<result column="logo" property="logo"/>
 	<result column="name" property="name"/>
 	<result column="name" property="name"/>
 	<result column="contact" property="contact"/>
 	<result column="contact" property="contact"/>
 	<result column="contactTel" property="contactTel"/>
 	<result column="contactTel" property="contactTel"/>
@@ -90,13 +91,14 @@
 </select>
 </select>
 
 
 <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrOrganization" useGeneratedKeys="true" keyProperty="id">
 <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrOrganization" useGeneratedKeys="true" keyProperty="id">
-	INSERT into mgr_organization(name, contact, contactTel, address, businessLicense, registerDate, status, organizationCode) values(#{name}, #{contact}, #{contactTel}, #{address}, #{businessLicense}, now(), #{status}, #{organizationCode})
+	INSERT into mgr_organization(logo, name, contact, contactTel, address, businessLicense, registerDate, status, organizationCode) values(#{logo}, #{name}, #{contact}, #{contactTel}, #{address}, #{businessLicense}, now(), #{status}, #{organizationCode})
 </insert>
 </insert>
 
 
 <update id="update" parameterType="com.bosshand.virgo.core.model.MgrOrganization">
 <update id="update" parameterType="com.bosshand.virgo.core.model.MgrOrganization">
 	UPDATE mgr_organization
 	UPDATE mgr_organization
 	<trim prefix="set" suffixOverrides=",">
 	<trim prefix="set" suffixOverrides=",">
 		<if test="id!=null">id=#{id},</if>
 		<if test="id!=null">id=#{id},</if>
+		<if test="logo!=null">logo=#{logo},</if>
 		<if test="name!=null">name=#{name},</if>
 		<if test="name!=null">name=#{name},</if>
 		<if test="contact!=null">contact=#{contact},</if>
 		<if test="contact!=null">contact=#{contact},</if>
 		<if test="contactTel!=null">contactTel=#{contactTel},</if>
 		<if test="contactTel!=null">contactTel=#{contactTel},</if>

+ 43 - 63
virgo.manager/src/main/java/com/bosshand/virgo/controller/MessageController.java

@@ -15,75 +15,55 @@ import com.bosshand.virgo.message.service.MessageService;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 
 
 @RestController
 @RestController
-@RequestMapping(value ="message")
+@RequestMapping(value = "message")
 public class MessageController {
 public class MessageController {
 
 
-	@Autowired
-	private MessageService messageService;
+    @Autowired
+    private MessageService messageService;
 
 
-	@ApiOperation(value="个人消息列表", notes="个人消息列表")
-	@RequestMapping(value ="/{userId}", method = RequestMethod.GET)
-	public Response getByUserId(@PathVariable long userId) {
-		return Response.ok(messageService.getMessageByUserId(userId));
-	}
+    @ApiOperation(value = "个人消息列表", notes = "个人消息列表")
+    @RequestMapping(value = "/{userId}", method = RequestMethod.GET)
+    public Response getByUserId(@PathVariable long userId) {
+        return Response.ok(messageService.getMessageByUserId(userId));
+    }
 
 
-	@ApiOperation(value="统计数据", notes="统计数据")
-	@RequestMapping(value ="/{projectId}/{userId}", method = RequestMethod.GET)
-	public Response getByProject(@PathVariable long projectId, @PathVariable long userId) {
-		return Response.ok(messageService.getByProject(projectId,userId));
-	}
+    @ApiOperation(value = "待办事项", notes = "待办事项")
+    @RequestMapping(value = "/backlog/{userId}", method = RequestMethod.GET)
+    public Response backlog(@PathVariable long userId) {
+        return Response.ok(messageService.getMessage(userId, false));
+    }
 
 
-	@ApiOperation(value="根据类型7统计flowType数量", notes="根据类型7统计flowType数量")
-	@RequestMapping(value ="/flowType/{projectId}/{userId}", method = RequestMethod.GET)
-	public Response getByFlowType(@PathVariable long projectId, @PathVariable long userId) {
-		return Response.ok(messageService.getByFlowType(projectId,userId));
-	}
+    @ApiOperation(value = "已办事项", notes = "已办事项")
+    @RequestMapping(value = "/finishBacklog/{userId}", method = RequestMethod.GET)
+    public Response finishBacklog(@PathVariable long userId) {
+        return Response.ok(messageService.getMessage(userId, true));
+    }
 
 
-	@ApiOperation(value="根据类型7的flowTypes串获取数据", notes="根据类型7的flowTypes串获取数据")
-	@RequestMapping(value ="/flowType/{projectId}/{userId}/{flowTypes}", method = RequestMethod.GET)
-	public Response getByFlowTypes(@PathVariable long projectId,
-								   @PathVariable long userId,
-								   @PathVariable String flowTypes) {
-		return Response.ok(messageService.getByFlowTypes(projectId,userId,flowTypes));
-	}
+    @ApiOperation(value = "审核消息发送", notes = "审核消息发送")
+    @RequestMapping(value = "/", method = RequestMethod.POST)
+    public Response pushMesssage(@RequestBody JSONObject parameter) {
+        messageService.pushMesssage(parameter);
+        return Response.ok();
+    }
 
 
-	@ApiOperation(value="待办事项", notes="待办事项")
-	@RequestMapping(value ="/backlog/{userId}", method = RequestMethod.GET)
-	public Response backlog(@PathVariable long userId) {
-		return Response.ok(messageService.getMessage(userId, false));
-	}
-	
-	@ApiOperation(value="已办事项", notes="已办事项")
-	@RequestMapping(value ="/finishBacklog/{userId}", method = RequestMethod.GET)
-	public Response finishBacklog(@PathVariable long userId) {
-		return Response.ok(messageService.getMessage(userId, true));
-	}
-	
-	@ApiOperation(value="审核消息发送", notes="审核消息发送")
-	@RequestMapping(value ="/", method = RequestMethod.POST)
-	public Response pushMesssage(@RequestBody JSONObject parameter) {
-		messageService.pushMesssage(parameter);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="其他消息发送", notes="其他消息发送")
-	@RequestMapping(value ="/{userIds}", method = RequestMethod.POST)
-	public Response pushOtherMesssage(@PathVariable String userIds, @RequestBody NotificationMessage message) {
-		messageService.pushOtherMesssage(userIds, message);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="修改", notes="修改")
-	@RequestMapping(value ="/{id}", method = RequestMethod.PUT)
-	public Response updateViewed(@PathVariable long id) {
-		messageService.updateViewed(id); 
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="根据type获取消息列表", notes="根据type获取消息列表")
-	@RequestMapping(value ="/messageType/{userId}/{messageType}", method = RequestMethod.GET)
-	public Response getByUserId(@PathVariable int messageType, @PathVariable long userId) {
-		return Response.ok(messageService.getMessageByUserId(messageType, userId));
-	}
+    @ApiOperation(value = "其他消息发送", notes = "其他消息发送")
+    @RequestMapping(value = "/{userIds}", method = RequestMethod.POST)
+    public Response pushOtherMesssage(@PathVariable String userIds, @RequestBody NotificationMessage message) {
+        messageService.pushOtherMesssage(userIds, message);
+        return Response.ok();
+    }
+
+    @ApiOperation(value = "修改", notes = "修改")
+    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
+    public Response updateViewed(@PathVariable long id) {
+        messageService.updateViewed(id);
+        return Response.ok();
+    }
+
+    @ApiOperation(value = "根据type获取消息列表", notes = "根据type获取消息列表")
+    @RequestMapping(value = "/messageType/{userId}/{messageType}", method = RequestMethod.GET)
+    public Response getByUserId(@PathVariable int messageType, @PathVariable long userId) {
+        return Response.ok(messageService.getMessageByUserId(messageType, userId));
+    }
 
 
 }
 }

+ 44 - 23
virgo.manager/src/main/java/com/bosshand/virgo/controller/UserController.java

@@ -1,5 +1,6 @@
 package com.bosshand.virgo.controller;
 package com.bosshand.virgo.controller;
 
 
+import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.model.MgrUserRole;
 import com.bosshand.virgo.core.model.MgrUserRole;
 import com.bosshand.virgo.core.response.Response;
 import com.bosshand.virgo.core.response.Response;
 import com.bosshand.virgo.service.UserService;
 import com.bosshand.virgo.service.UserService;
@@ -11,28 +12,48 @@ import org.springframework.web.bind.annotation.*;
 @RequestMapping("user")
 @RequestMapping("user")
 public class UserController {
 public class UserController {
 
 
-	@Autowired
-	UserService userService;
-
-	@ApiOperation(value="更新部门角色", notes="更新部门角色")
-	@RequestMapping(value = "/updateUserRole", method = RequestMethod.POST)
-	public Response updateUserRole(@RequestBody MgrUserRole userRole) {
-		userService.updateUserRole(userRole);
-		return Response.ok();
-	}
-
-	@ApiOperation(value="更新用户权限菜单", notes="更新用户权限菜单")
-	@RequestMapping(value = "/userRole", method = RequestMethod.PUT)
-	public Response updateResources(@RequestBody MgrUserRole userRole) {
-		userService.updateResources(userRole);
-		return Response.ok();
-	}
-
-	@ApiOperation(value="禁止用户", notes="禁止用户")
-	@RequestMapping(value = "/banUser/{id}/{status}", method = RequestMethod.GET)
-	public Response banUser(@PathVariable long id, @PathVariable int status) {
-		userService.banUser(id, status);
-		return Response.ok("成功");
-	}
+    @Autowired
+    UserService userService;
+
+    @ApiOperation(value = "用户列表", notes = "用户列表")
+    @RequestMapping(value = "/list/{organizationId}/{roleId}", method = RequestMethod.POST)
+    public Response listUser(@PathVariable long organizationId, @PathVariable long roleId) {
+        return Response.ok(userService.listUser(organizationId, roleId));
+    }
+
+    @ApiOperation(value = "用户新增", notes = "用户新增")
+    @RequestMapping(value = "/add/{organizationId}/{roleIds}", method = RequestMethod.POST)
+    public Response addUser(@RequestBody MgrUser user, @PathVariable long organizationId, @PathVariable String roleIds) {
+        userService.addUser(user, organizationId, roleIds);
+        return Response.ok();
+    }
+
+    @ApiOperation(value = "删除用户", notes = "删除用户")
+    @RequestMapping(value = "/delete/{organizationId}/{id}", method = RequestMethod.DELETE)
+    public Response deleteUser(@PathVariable long organizationId, @PathVariable long id) {
+        userService.deleteUser(organizationId, id);
+        return Response.ok("成功");
+    }
+
+    @ApiOperation(value = "更新部门角色", notes = "更新部门角色")
+    @RequestMapping(value = "/updateUserRole", method = RequestMethod.POST)
+    public Response updateUserRole(@RequestBody MgrUserRole userRole) {
+        userService.updateUserRole(userRole);
+        return Response.ok();
+    }
+
+    @ApiOperation(value = "更新用户权限菜单", notes = "更新用户权限菜单")
+    @RequestMapping(value = "/userRole", method = RequestMethod.PUT)
+    public Response updateResources(@RequestBody MgrUserRole userRole) {
+        userService.updateResources(userRole);
+        return Response.ok();
+    }
+
+    @ApiOperation(value = "禁止用户", notes = "禁止用户")
+    @RequestMapping(value = "/banUser/{id}/{status}", method = RequestMethod.GET)
+    public Response banUser(@PathVariable long id, @PathVariable int status) {
+        userService.banUser(id, status);
+        return Response.ok("成功");
+    }
 
 
 }
 }

+ 98 - 95
virgo.manager/src/main/java/com/bosshand/virgo/message/model/NotificationMessage.java

@@ -1,142 +1,145 @@
 package com.bosshand.virgo.message.model;
 package com.bosshand.virgo.message.model;
 
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-
 public class NotificationMessage implements Serializable {
 public class NotificationMessage implements Serializable {
 
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
 
-	public static final int MESSAGE_TYPE_NOTIFY = 1;
+    public static final int MESSAGE_TYPE_NOTIFY = 1;
 
 
-	long id;
+    long id;
 
 
-	String message;
+    String message;
 
 
-	String title;
+    String title;
 
 
-	int messageType;
+    int messageType;
 
 
-	@JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
-	Date sentTime;
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    Date sentTime;
 
 
-	boolean viewed;
+    boolean viewed;
 
 
-	long userId;
+    long userId;
 
 
-	String sender;
+    String sender;
 
 
-	boolean systemMessage;
+    boolean systemMessage;
 
 
-	boolean pushed; // push to app.
+    /**
+     * push to app
+     */
+    boolean pushed;
 
 
-	String json;
+    String json;
 
 
-	private int isCC;
+    private int isCC;
 
 
-	public int getIsCC() {
-		return isCC;
-	}
+    public int getIsCC() {
+        return isCC;
+    }
 
 
-	public void setIsCC(int isCC) {
-		this.isCC = isCC;
-	}
+    public void setIsCC(int isCC) {
+        this.isCC = isCC;
+    }
 
 
-	public String getTitle() {
-		return title;
-	}
+    public String getTitle() {
+        return title;
+    }
 
 
-	public void setTitle(String title) {
-		this.title = title;
-	}
+    public void setTitle(String title) {
+        this.title = title;
+    }
 
 
-	public long getId() {
-		return id;
-	}
+    public long getId() {
+        return id;
+    }
 
 
-	public void setId(long id) {
-		this.id = id;
-	}
+    public void setId(long id) {
+        this.id = id;
+    }
 
 
-	public String getMessage() {
-		return message;
-	}
+    public String getMessage() {
+        return message;
+    }
 
 
-	public void setMessage(String message) {
-		this.message = message;
-	}
+    public void setMessage(String message) {
+        this.message = message;
+    }
 
 
-	public int getMessageType() {
-		return messageType;
-	}
+    public int getMessageType() {
+        return messageType;
+    }
 
 
-	public void setMessageType(int messageType) {
-		this.messageType = messageType;
-	}
+    public void setMessageType(int messageType) {
+        this.messageType = messageType;
+    }
 
 
-	public Date getSentTime() {
-		return sentTime;
-	}
+    public Date getSentTime() {
+        return sentTime;
+    }
 
 
-	public void setSentTime(Date sentTime) {
-		this.sentTime = sentTime;
-	}
+    public void setSentTime(Date sentTime) {
+        this.sentTime = sentTime;
+    }
 
 
-	public long getUserId() {
-		return userId;
-	}
+    public long getUserId() {
+        return userId;
+    }
 
 
-	public void setUserId(long userId) {
-		this.userId = userId;
-	}
+    public void setUserId(long userId) {
+        this.userId = userId;
+    }
 
 
-	public String getSender() {
-		return sender;
-	}
+    public String getSender() {
+        return sender;
+    }
 
 
-	public void setSender(String sender) {
-		this.sender = sender;
-	}
+    public void setSender(String sender) {
+        this.sender = sender;
+    }
 
 
-	public boolean isSystemMessage() {
-		return systemMessage;
-	}
+    public boolean isSystemMessage() {
+        return systemMessage;
+    }
 
 
-	public void setSystemMessage(boolean systemMessage) {
-		this.systemMessage = systemMessage;
-	}
+    public void setSystemMessage(boolean systemMessage) {
+        this.systemMessage = systemMessage;
+    }
 
 
-	public boolean isViewed() {
-		return viewed;
-	}
+    public boolean isViewed() {
+        return viewed;
+    }
 
 
-	public void setViewed(boolean viewed) {
-		this.viewed = viewed;
-	}
+    public void setViewed(boolean viewed) {
+        this.viewed = viewed;
+    }
 
 
-	public boolean isPushed() {
-		return pushed;
-	}
+    public boolean isPushed() {
+        return pushed;
+    }
 
 
-	public void setPushed(boolean pushed) {
-		this.pushed = pushed;
-	}
+    public void setPushed(boolean pushed) {
+        this.pushed = pushed;
+    }
 
 
-	public String getJson() {
-		return json;
-	}
+    public String getJson() {
+        return json;
+    }
 
 
-	public void setJson(String json) {
-		this.json = json;
-	}
+    public void setJson(String json) {
+        this.json = json;
+    }
 
 
-	@Override
-	public String toString() {
-		return "NotificationMessage [id=" + id + ", message=" + message + ", title=" + title + ", messageType="
-				+ messageType + ", sentTime=" + sentTime + ", viewed=" + viewed + ", userId=" + userId + ", sender="
-				+ sender + ", systemMessage=" + systemMessage + ", pushed=" + pushed + ", json=" + json + "]";
-	}
+    @Override
+    public String toString() {
+        return "NotificationMessage [id=" + id + ", message=" + message + ", title=" + title + ", messageType="
+                + messageType + ", sentTime=" + sentTime + ", viewed=" + viewed + ", userId=" + userId + ", sender="
+                + sender + ", systemMessage=" + systemMessage + ", pushed=" + pushed + ", json=" + json + "]";
+    }
 
 
 }
 }

+ 0 - 10
virgo.manager/src/main/java/com/bosshand/virgo/message/service/ApiClient.java

@@ -1,18 +1,8 @@
 package com.bosshand.virgo.message.service;
 package com.bosshand.virgo.message.service;
 
 
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
-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;
 
 
 @FeignClient("virgo-api")
 @FeignClient("virgo-api")
 public interface ApiClient {
 public interface ApiClient {
 
 
-    @RequestMapping(value = "/configurationUrl/url", method = RequestMethod.GET)
-    public String get();
-
-    @RequestMapping(value = "/constructionLog/saveNotice", method = RequestMethod.POST)
-    public void saveNotice(@RequestBody String data);
-
 }
 }

+ 6 - 171
virgo.manager/src/main/java/com/bosshand/virgo/message/service/MessageService.java

@@ -1,8 +1,6 @@
 package com.bosshand.virgo.message.service;
 package com.bosshand.virgo.message.service;
 
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.core.utils.HttpsUtils;
 import com.bosshand.virgo.exception.ServiceException;
 import com.bosshand.virgo.exception.ServiceException;
 import com.bosshand.virgo.message.beetl.FlowMessageGenerator;
 import com.bosshand.virgo.message.beetl.FlowMessageGenerator;
 import com.bosshand.virgo.message.beetl.MessageGenerator;
 import com.bosshand.virgo.message.beetl.MessageGenerator;
@@ -14,8 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.io.IOException;
 import java.io.IOException;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 
 @Service
 @Service
 public class MessageService {
 public class MessageService {
@@ -57,86 +57,6 @@ public class MessageService {
 		return notificationMessageDao.getMessageByMessageType(messageType, userId);
 		return notificationMessageDao.getMessageByMessageType(messageType, userId);
 	}
 	}
 
 
-	public Map<Integer, Integer> getByProject(long projectId, long userId) {
-		Map<Integer, Integer> m = new HashMap<>();
-		List<NotificationMessage> list = notificationMessageDao.getMessageByUserId(userId);
-		Map<Integer, List<NotificationMessage>> map = list.stream().collect(Collectors.groupingBy(t -> t.getMessageType()));
-		for (Integer key : map.keySet()) {
-			if (key != 1 & key != 3 & key != 9) {
-				int b = 0;
-				for (NotificationMessage mss : map.get(key)) {
-					if (projectId == JSONObject.parseObject(mss.getJson()).getIntValue("projectId")) {
-						if (!mss.isViewed()) {
-							b += 1;
-						}
-					}
-				}
-				m.put(key, b);
-			}
-			if (key == 3 | key == 9) {
-				int c = 0;
-				for (NotificationMessage mss : map.get(key)) {
-					if (-projectId == JSONObject.parseObject(mss.getJson()).getIntValue("yuiProjectId")) {
-						if (!mss.isViewed()) {
-							c += 1;
-						}
-					}
-				}
-				m.put(key, c);
-			}
-		}
-		return m;
-	}
-
-	public Map<Integer, Integer> getByFlowType(long projectId, long userId) {
-		Map<Integer, Integer> m = new HashMap<>();
-		List<NotificationMessage> nms = notificationMessageDao.getMessageByUserId(userId);
-		Map<Integer, List<NotificationMessage>> map = nms.stream().collect(Collectors.groupingBy(t -> t.getMessageType()));
-		if (map.containsKey(7)) {
-			List<NotificationMessage> notificationMessages = map.get(7);
-			if (notificationMessages.size() > 0) {
-				for (NotificationMessage mss : notificationMessages) {
-					if (projectId == JSONObject.parseObject(mss.getJson()).getIntValue("projectId")) {
-						if (!mss.isViewed()) {
-							int flowType = JSONObject.parseObject(mss.getJson()).getIntValue("flowType");
-							if (!m.containsKey(flowType)) {
-								m.put(flowType, 1);
-							} else {
-								Integer i = m.get(flowType);
-								m.put(flowType, i += 1);
-							}
-						}
-					}
-				}
-			}
-		}
-		return m;
-	}
-
-	public List<NotificationMessage> getByFlowTypes(long projectId, long userId, String flowTypes) {
-		List<NotificationMessage> list = new ArrayList<>();
-		List<String> types = Arrays.asList(flowTypes.split(","));
-		List<NotificationMessage> nms = notificationMessageDao.getMessageByUserId(userId);
-		Map<Integer, List<NotificationMessage>> map = nms.stream().collect(Collectors.groupingBy(t -> t.getMessageType()));
-		if (map.containsKey(7)) {
-			List<NotificationMessage> notificationMessages = map.get(7);
-			if (notificationMessages.size() > 0) {
-				for (NotificationMessage mss : notificationMessages) {
-					if (projectId == JSONObject.parseObject(mss.getJson()).getIntValue("projectId")) {
-						int flowType = JSONObject.parseObject(mss.getJson()).getIntValue("flowType");
-						if (types.contains(String.valueOf(flowType))) {
-							list.add(mss);
-						}
-					}
-				}
-			}
-		}
-		if (list.size() > 0) {
-			list.sort((o1, o2) -> o2.getSentTime().compareTo(o1.getSentTime()));
-		}
-		return list;
-	}
-
 	public List<NotificationMessage> getMessageByViewed(long userId, boolean viewed) {
 	public List<NotificationMessage> getMessageByViewed(long userId, boolean viewed) {
 		return notificationMessageDao.getMessageByViewed(userId, viewed);
 		return notificationMessageDao.getMessageByViewed(userId, viewed);
 	}
 	}
@@ -161,35 +81,14 @@ public class MessageService {
 				insert(message);
 				insert(message);
 			});
 			});
 		}
 		}
-		
-		// construction log
-		JSONObject cl = new JSONObject();
-		
-		JSONObject json = JSON.parseObject(message.getJson());
-		
-		JSONObject coment = JSON.parseObject(json.getString("coment"));
-		//cl.setData(coment.getString("content"));
-		cl.put("data", JSONObject.toJSONString(message));
-		
-		JSONObject content = JSON.parseObject(coment.getString("content"));
-		
-		if(content.containsKey("projectId")) {
-			cl.put("projectId", content.getLongValue("projectId"));
-		}else if(content.containsKey("project_id")) {
-			cl.put("projectId", content.getLongValue("project_id"));
-		}
-
-		cl.put("message", message.getMessage());
-
-		apiClient.saveNotice(cl.toJSONString());
 
 
-		List<NotificationMessage> list = notificationMessageDao.getList();
+		/*List<NotificationMessage> list = notificationMessageDao.getList();
 		for (NotificationMessage s : list) {
 		for (NotificationMessage s : list) {
 			if (s.isPushed() == false) {
 			if (s.isPushed() == false) {
 				messagePushService.sendMessage(s);
 				messagePushService.sendMessage(s);
 				notificationMessageDao.updatePushed(s.getId());
 				notificationMessageDao.updatePushed(s.getId());
 			}
 			}
-		}
+		}*/
 		
 		
 	}
 	}
 	
 	
@@ -203,57 +102,11 @@ public class MessageService {
 		json.getJSONArray("receiptList").forEach(id -> receiptList.add(Long.parseLong(id.toString())));
 		json.getJSONArray("receiptList").forEach(id -> receiptList.add(Long.parseLong(id.toString())));
 		pushMessage(receiptList, messageGenerator);
 		pushMessage(receiptList, messageGenerator);
 
 
-		// update state
-		updateYouJiYunFlowState(messageGenerator);
-		
 		if (FlowMessageGenerator.MESSAGE_FLOW_COMPELETED.equals(messageGenerator.getTemplateName())) {
 		if (FlowMessageGenerator.MESSAGE_FLOW_COMPELETED.equals(messageGenerator.getTemplateName())) {
 			completeDataService.saveCompleteData(messageGenerator.getContext());
 			completeDataService.saveCompleteData(messageGenerator.getContext());
 		}
 		}
 	}
 	}
-	
-	private void updateYouJiYunFlowState(FlowMessageGenerator messageGenerator) {
-		
-		JSONObject context = JSON.parseObject(JSON.toJSONString(messageGenerator.getContext()));
-		
-		JSONObject projectFlow = JSON.parseObject(JSON.toJSONString(context.get("projectFlow")));
-		
-		JSONObject coment = JSON.parseObject(context.getString("coment"));
-		
-		JSONObject content = JSON.parseObject(coment.getString("content"));
-		
-		long projectFlowId = content.getLongValue("projectFlowId");
-		
-		if(projectFlowId > 0) {
-		
-			int state = -1;
-	
-			if (projectFlow.getString("statusStr").equals("待提交")) {
-				state = -1;
-			}
-			if (projectFlow.getString("statusStr").equals("审核中")) {
-				state = -2;
-			}
-			if (projectFlow.getString("statusStr").equals("通过")) {
-				state = -3;
-			}
-			if (projectFlow.getString("statusStr").equals("未通过")) {
-				state = -4;
-			}
-			
-			String url = JSONObject.parseObject(apiClient.get()).getString("youjiUrl") + "/workspace/common/updateIsSubmitSynergy?projectFlowId="+projectFlowId+"&state="+state;
 
 
-			try {
-				if (url.indexOf("https") == -1) {
-					HttpsUtils.getPath(url);
-				}else {
-					HttpsUtils.getResult(url);
-				}
-			} catch (Exception e) {
-				log.error("access youjiurl fail.", e);
-			}
-		}
-	}
-	
 	private String getTemplateName(String notifyType) {
 	private String getTemplateName(String notifyType) {
 		switch (notifyType) {
 		switch (notifyType) {
 		case EVENT_SUBMITTED:
 		case EVENT_SUBMITTED:
@@ -283,24 +136,6 @@ public class MessageService {
 			message.setUserId(Long.parseLong(split[i]));
 			message.setUserId(Long.parseLong(split[i]));
 			insert(message);
 			insert(message);
 		}
 		}
-		
-		// bim审核流程
-		if(message.getMessageType() == 7) {
-			JSONObject cl = new JSONObject();
-			cl.put("data", JSONObject.toJSONString(message));
-			JSONObject json = JSON.parseObject(message.getJson());
-			cl.put("projectId", (-json.getLongValue("projectId")));
-			cl.put("message", message.getMessage());
-			apiClient.saveNotice(cl.toJSONString());
-		}
-		
-		List<NotificationMessage> list = notificationMessageDao.getList();
-		for (NotificationMessage s : list) {
-			if (s.isPushed() == false) {
-				messagePushService.sendMessage(s);
-				notificationMessageDao.updatePushed(s.getId());
-			}
-		}
 	}
 	}
 
 
 }
 }

+ 53 - 2
virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java

@@ -55,6 +55,59 @@ public class UserService {
         return mgrUserDao.checkFace(id);
         return mgrUserDao.checkFace(id);
     }
     }
 
 
+    public List<MgrUser> listUser(long organizationId, long roleId) {
+        List<MgrUserRole> list = mgrUserRoleDao.getOrganizationId(organizationId);
+        List<Long> userIds = new ArrayList<>();
+        for (MgrUserRole mur : list) {
+            if (mur.getRoles() != null) {
+                List<String> ll = new ArrayList<>(Arrays.asList(mur.getRoles().split(",")));
+                if (ll.contains(String.valueOf(roleId))) {
+                    userIds.add(mur.getUserId());
+                }
+            }
+        }
+        if (userIds.size() > 0) {
+            return mgrUserDao.getIds(userIds);
+        }
+        return new ArrayList<>();
+    }
+
+    public void deleteUser(long organizationId, long userId) {
+        MgrUserRole mgrUserRole = mgrUserRoleDao.getUser(userId, organizationId);
+        if (mgrUserRole != null) {
+            mgrUserRoleDao.delete(mgrUserRole.getId());
+        }
+    }
+
+    public void addUser(MgrUser user, long organizationId, String roleIds) {
+        MgrUser mgrUser = mgrUserDao.getByPhone(user.getPhone());
+        long userId = mgrUser.getId();
+        if (mgrUser == null) {
+            mgrUserDao.insert(user);
+            userId = user.getId();
+        }
+        MgrUserRole mur = mgrUserRoleDao.getUser(userId, organizationId);
+        if (mur != null) {
+            if (mur.getRoles() == null) {
+                mur.setRoles(roleIds);
+            } else {
+                List<String> list = new ArrayList<>(Arrays.asList(mur.getRoles().split(",")));
+                if (list.contains(roleIds)) {
+                    return;
+                }
+                list.add(roleIds);
+                mur.setRoles(String.join(",", list));
+            }
+            mgrUserRoleDao.update(mur);
+        } else {
+            MgrUserRole userRole = new MgrUserRole();
+            userRole.setUserId(userId);
+            userRole.setOrganizationId(organizationId);
+            userRole.setRoles(roleIds);
+            mgrUserRoleDao.insert(userRole);
+        }
+    }
+
     public List<MgrUser> getUserByOrganizationId(long organizationId) {
     public List<MgrUser> getUserByOrganizationId(long organizationId) {
         List<MgrUserRole> list = mgrUserRoleDao.getOrganizationId(organizationId);
         List<MgrUserRole> list = mgrUserRoleDao.getOrganizationId(organizationId);
         List<Long> ids = new ArrayList<>();
         List<Long> ids = new ArrayList<>();
@@ -95,6 +148,4 @@ public class UserService {
         return attendanceDao.getByUser(attendance);
         return attendanceDao.getByUser(attendance);
     }
     }
 
 
-
-
 }
 }