Browse Source

临时加打印日志

seyason 2 years ago
parent
commit
76c8674dc9

+ 73 - 73
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -977,79 +977,79 @@ public class WeiXinCorpController {
     }
 
     //老版本
-//    @RequestMapping("/getCorpMembs")
-//    public HttpRespMsg getCorpMembs(String corpId) {
-//
-//        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
-//
-//        Company company = companyMapper.selectById(wxCorpInfo.getCompanyId());
-//        String curCorpAccessToken = null;
-//        try {
-//            curCorpAccessToken = getCorpAccessToken(wxCorpInfo);
-//        } catch (Exception exception) {
-//            exception.printStackTrace();
-//        }
-//        int companyId = company.getId();
-//        //获取公司根部门人员,也就是没有分配部门的人员
-//        int companyRootDeptId = 1;
-//        JSONArray unAssignedUserList = getDeptUserSimple(curCorpAccessToken, companyRootDeptId);
-//        SysRole defaultRole = sysRoleMapper.selectOne(
-//                new QueryWrapper<SysRole>().eq("company_id", companyId).eq("is_default", 1));
-//
-//        for (int m=0;m<unAssignedUserList.size(); m++) {
-//            JSONObject userJson = unAssignedUserList.getJSONObject(m);
-//            String curUserid = userJson.getString("userid");
-//            System.out.println("userid="+curUserid+", name=" + userJson.getString("name")+", mobile="+userJson.getString("mobile"));
-//            //不存在的人员, 进行插入
-//            User user = new User();
-//
-//            user.setId(SnowFlake.nextId()+"")
-//                    .setRoleId(defaultRole.getId())//默认普通员工
-//                    .setRoleName(defaultRole.getRolename())
-//                    .setCompanyId(companyId)
-//                    .setName(userJson.getString("name"))
-//                    .setCorpwxUserid(curUserid)
-//                    .setColor(ColorUtil.randomColor());
-//
-//            //检查用户是否已经存在
-//            if (userMapper.selectCount(new QueryWrapper<User>().eq("corpwx_userid", curUserid)) == 0) {
-//                userMapper.insert(user);
-//            }
-//        }
-//
-//        //获取部门
-//        JSONObject deptObj = getAllDepartments(curCorpAccessToken);
-//        JSONArray deptObjJSONArray = deptObj.getJSONArray("department");
-//
-//        for (int i=0;i<deptObjJSONArray.size(); i++) {
-//            int deptId = deptObjJSONArray.getJSONObject(i).getIntValue("id");
-//
-//            JSONArray userList = getDeptUserSimple(curCorpAccessToken, deptId);
-//            for (int m=0;m<userList.size(); m++) {
-//                JSONObject userJson = userList.getJSONObject(m);
-//                String curUserid = userJson.getString("userid");
-//                System.out.println("userid="+curUserid+", name=" + userJson.getString("name")+", mobile="+userJson.getString("mobile"));
-//                //不存在的人员, 进行插入
-//                User user = new User();
-//
-//                user.setId(SnowFlake.nextId()+"")
-//                        .setRoleId(defaultRole.getId())//默认普通员工
-//                        .setRoleName(defaultRole.getRolename())
-//                        .setCompanyId(companyId)
-//                        .setDepartmentId(0)
-//                        .setName(userJson.getString("name"))
-//                        .setCorpwxUserid(curUserid)
-//                        .setColor(ColorUtil.randomColor());
-//
-//                //检查用户是否已经存在
-//                if (userMapper.selectCount(new QueryWrapper<User>().eq("corpwx_userid", curUserid)) == 0) {
-//                    userMapper.insert(user);
-//                }
-//            }
-//        }
-//
-//        return new HttpRespMsg();
-//    }
+    @RequestMapping("/getCorpMembsOld")
+    public HttpRespMsg getCorpMembsOld(String corpId) {
+
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
+
+        Company company = companyMapper.selectById(wxCorpInfo.getCompanyId());
+        String curCorpAccessToken = null;
+        try {
+            curCorpAccessToken = getCorpAccessToken(wxCorpInfo);
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        int companyId = company.getId();
+        //获取公司根部门人员,也就是没有分配部门的人员
+        int companyRootDeptId = 1;
+        JSONArray unAssignedUserList = getDeptUserSimple(curCorpAccessToken, companyRootDeptId);
+        SysRole defaultRole = sysRoleMapper.selectOne(
+                new QueryWrapper<SysRole>().eq("company_id", companyId).eq("is_default", 1));
+
+        for (int m=0;m<unAssignedUserList.size(); m++) {
+            JSONObject userJson = unAssignedUserList.getJSONObject(m);
+            String curUserid = userJson.getString("userid");
+            System.out.println("userid="+curUserid+", name=" + userJson.getString("name")+", mobile="+userJson.getString("mobile"));
+            //不存在的人员, 进行插入
+            User user = new User();
+
+            user.setId(SnowFlake.nextId()+"")
+                    .setRoleId(defaultRole.getId())//默认普通员工
+                    .setRoleName(defaultRole.getRolename())
+                    .setCompanyId(companyId)
+                    .setName(userJson.getString("name"))
+                    .setCorpwxUserid(curUserid)
+                    .setColor(ColorUtil.randomColor());
+
+            //检查用户是否已经存在
+            if (userMapper.selectCount(new QueryWrapper<User>().eq("corpwx_userid", curUserid)) == 0) {
+                userMapper.insert(user);
+            }
+        }
+
+        //获取部门
+        JSONObject deptObj = getAllDepartments(curCorpAccessToken);
+        JSONArray deptObjJSONArray = deptObj.getJSONArray("department");
+
+        for (int i=0;i<deptObjJSONArray.size(); i++) {
+            int deptId = deptObjJSONArray.getJSONObject(i).getIntValue("id");
+
+            JSONArray userList = getDeptUserSimple(curCorpAccessToken, deptId);
+            for (int m=0;m<userList.size(); m++) {
+                JSONObject userJson = userList.getJSONObject(m);
+                String curUserid = userJson.getString("userid");
+                System.out.println("userid="+curUserid+", name=" + userJson.getString("name")+", mobile="+userJson.getString("mobile"));
+                //不存在的人员, 进行插入
+                User user = new User();
+
+                user.setId(SnowFlake.nextId()+"")
+                        .setRoleId(defaultRole.getId())//默认普通员工
+                        .setRoleName(defaultRole.getRolename())
+                        .setCompanyId(companyId)
+                        .setDepartmentId(0)
+                        .setName(userJson.getString("name"))
+                        .setCorpwxUserid(curUserid)
+                        .setColor(ColorUtil.randomColor());
+
+                //检查用户是否已经存在
+                if (userMapper.selectCount(new QueryWrapper<User>().eq("corpwx_userid", curUserid)) == 0) {
+                    userMapper.insert(user);
+                }
+            }
+        }
+
+        return new HttpRespMsg();
+    }
 
     //新版本
     @RequestMapping("/getCorpMembs")

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -1268,6 +1268,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                 for (int m=0;m<settings.size(); m++) {
                                     if (settings.get(m).getIsDeptAudit()== 0) {//找到项目审核的那个节点
                                         AuditWorkflowTimeSetting nextNode = settings.get(m + 1);
+//                                        System.out.println("nextNode=="+nextNode.getAuditDeptName());
                                         upR.setIsDeptAudit(nextNode.getIsDeptAudit());
                                         if (upR.getIsDeptAudit() == 1) {
                                             upR.setAuditDeptid(nextNode.getAuditDeptId());
@@ -1281,6 +1282,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                 //全部更新到下一个审核阶段
                                 List<Integer> allRids = sameUserSameDayOtherReports.stream().map(Report::getId).collect(Collectors.toList());
                                 allRids.addAll(ids);
+//                                System.out.println("更新全部的日报到下个阶段:getIsDeptAudit="+upR.getIsDeptAudit()+", ");
                                 reportMapper.update(upR,
                                         new QueryWrapper<Report>().in("id", allRids));
                             }