wangzhe 3 years ago
parent
commit
ac9e5d3e15

+ 1 - 0
leiSP-system/src/main/java/com/sooka/system/domain/SysUser.java

@@ -35,6 +35,7 @@ public class SysUser extends BaseEntity {
      */
     @Excel(name = "部门编号", type = Type.IMPORT)
     private Long deptId;
+    private Long deptIdOnly;//查询条件只按照deptId查询用户,不管理子部门内人员
 
     private Long orgDeptId;
 

+ 3 - 0
leiSP-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -116,6 +116,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="deptId != null and deptId != 0">
 			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
 		</if>
+		<if test="deptIdOnly != null and deptIdOnly != 0">
+			AND u.dept_id = #{deptIdOnly}
+		</if>
 		<if test="orgDeptId != null and orgDeptId != 0">
 			AND (u.org_dept_id = #{orgDeptId} OR u.org_dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{orgDeptId},ancestors) ))
 		</if>

+ 33 - 1
mybusiness/src/main/java/com/business/slfh/app/event/service/impl/AppEventServiceImpl.java

@@ -225,7 +225,8 @@ public class AppEventServiceImpl extends AppBaseService implements AppEventServi
 
         SysUser sysUser = userMapper.selectUserById(appEventVo.getUserId());
         SysUser u = new SysUser();
-        u.setDeptId(sysUser.getDeptId());
+        //u.setDeptId(sysUser.getDeptId());//包括下属部门用户
+        u.setDeptIdOnly(sysUser.getDeptId());//不包括下属部门用户,只查询当前部门下用户
 
 
         Set<String> userIds = webSocketService.getUsers(u.getDeptId(), appEventVo.getReserveplanType());
@@ -250,7 +251,38 @@ public class AppEventServiceImpl extends AppBaseService implements AppEventServi
 
 
         List<SysUser> list = userMapper.selectUserList(u);
+        //App推送消息
+//        SysUser sysUser = new SysUser();
+//        sysUser.setDeptIdOnly(appEventVo.getDeptId());
+        List<SysUser> userList = list;
+        for (int i = 0; i < userList.size(); i++) {
+            try {
+//                    if (!userList.get(i).getLoginName().equals("admin")){
+//                        continue;
+//                    }
+                //JiGuangPushUtil.pushMsg("alias", "admin", "abc123");
+                System.out.println(appEventVo.getName() + "=appEventVo.getName()");
+                System.out.println(appEventVo.getReportContent() + "=appEventVo.getReportContent()");
+                System.out.println(appEventVo.getDeptId() + "=appEventVo.getDeptId()");
+                System.out.println(userList.size() + "=userList.size()");
+                //JiGuangPushUtil.pushMsg("alias", userList.get(i).getLoginName(), appEventVo.getName() + ":" + appEventVo.getReportContent());
+                String retJSON = "";
+                String id = appEventVo.getId();
+                String type = appEventVo.getReserveplanType();
+                String title = appEventVo.getName();
+                String content = appEventVo.getReportContent();
+                retJSON += "{";
+                retJSON += "\"id\":" + "\"" + id + "\"";
+                retJSON += ",\"type\":" + "\"" + type + "\"";
+                retJSON += ",\"title\":" + "\"" + title + "\"";
+                retJSON += ",\"content\":" + "\"" + content + "\"";
+                retJSON += "}";
+                System.out.println(retJSON + "=retJSON");
+                JiGuangPushUtil.pushMsg("alias", userList.get(i).getLoginName(), retJSON);
+            } catch (Exception e) {
 
+            }
+        }
         String ids = "";
         for (int i = 0; i < list.size(); i++) {
             ids += list.get(i).getUserId() + ",";

+ 1 - 1
mybusiness/src/main/java/com/business/slfh/tools/JiGuangPushUtil.java

@@ -113,7 +113,7 @@ public class JiGuangPushUtil {
      * @param value 推送的标签或别名值
      * @param alert 推送的内容
      */
-    private static void pushMsg(String type, String value, String alert) {
+    public static void pushMsg(String type, String value, String alert) {
         PushPayload.Builder builder = PushPayload.newBuilder();
         builder.setPlatform(Platform.all());//设置接受的平台
         if (type.equals("alias")) {