| | |
| | | import com.alibaba.xxpt.gateway.shared.api.response.OapiMoziOrganizationPageSubOrganizationCodesResponse; |
| | | import com.alibaba.xxpt.gateway.shared.client.http.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.ycl.config.DingConfig; |
| | | import com.ycl.entity.depart.UmsDepart; |
| | | import com.ycl.entity.dingding.DingUserInfo; |
| | |
| | | */ |
| | | public List<UmsDepart> getOrgInfo(JSONArray deptTopArr) { |
| | | List<UmsDepart> orgList = new ArrayList<>(); |
| | | if(CollectionUtils.isEmpty(deptTopArr)){ |
| | | return null; |
| | | } |
| | | //获取全部部门code |
| | | //JSONObject topObj = getBookAuthority(); |
| | | //顶级部门id |
| | |
| | | //查询任职 |
| | | JSONArray jobArr = getStaffAppointment(employeeCode); |
| | | assert jobArr != null; |
| | | log.info("任职----------------->{}",jobArr); |
| | | //临时保存任职的ids(系统的用户体系) |
| | | List<Long> posIds = new ArrayList<>(); |
| | | //用户角色code |
| | |
| | | if (isMain) { |
| | | JSONObject holdapost = jobArr.getJSONObject(0); |
| | | String orgCode = holdapost.getString("organizationCode"); |
| | | log.info("orgCode---------------->{}",orgCode); |
| | | if (StrUtil.isNotBlank(orgCode)) { |
| | | JSONObject orgDetail = getOrgDetailByCode(orgCode); |
| | | if (null != orgDetail) { |
| | | String orgId = orgDetail.getString("organizationCode"); |
| | | String orgName = orgDetail.getString("organizationName"); |
| | | orgId = DingEncodeUtil.getMD5(orgId.getBytes()); |
| | | // JSONObject orgDetail = getOrgDetailByCode(orgCode); |
| | | // if (null != orgDetail) { |
| | | // String orgId = orgDetail.getString("organizationCode"); |
| | | // String orgName = orgDetail.getString("organizationName"); |
| | | Long orgId = Long.parseLong(DingEncodeUtil.getMD5(orgCode.getBytes())); |
| | | log.info("解密后的orgId-------------->{}",orgId); |
| | | empCodeObj.put("orgId", orgId); |
| | | empCodeObj.put("orgName", orgName); |
| | | } |
| | | // empCodeObj.put("orgName", orgName); |
| | | // } |
| | | } |
| | | } |
| | | //职位信息 |
| | |
| | | //转换为实体类 |
| | | DingUserInfo dingUserInfo = BeanUtil.toBean(empCodeObj, DingUserInfo.class); |
| | | Long orgId = dingUserInfo.getOrgId(); |
| | | log.info("最后结果的orgId----------->{}",orgId); |
| | | if (ObjectUtil.isNotEmpty(orgId)) { |
| | | dingUserInfo.setPosIdList(posIds); |
| | | dingUserInfo.setRoleCodeList(roleCodeList); |
| | |
| | | postClient.addParameter("employeeCode", empCode); |
| | | String apiResult = postClient.post(); |
| | | JSONObject dataObj = parsingJson(apiResult); |
| | | log.info("任职------------->{}",dataObj); |
| | | if (null != dataObj) { |
| | | return dataObj.getJSONArray("data"); |
| | | } |