| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819 |
- package com.uas.sso.util;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONObject;
- import com.uas.sso.AccountConfig;
- import com.uas.sso.ResultWrap;
- import com.uas.sso.common.util.HttpUtil;
- import com.uas.sso.entity.UserSpaceView;
- import com.uas.sso.entity.UserView;
- import org.springframework.ui.ModelMap;
- import org.springframework.util.StringUtils;
- /**
- * 客户端使用,操作企业资料、用户资料
- *
- * @author yingp
- *
- */
- public class AccountUtils {
- /**
- * 企业解除绑定的应用
- *
- * @author wangmh
- * @date 2018/1/26 16:34
- * @param spaceUU 企业uu号
- * @param appId 应用id
- * @throws Exception
- */
- public static void unbindApp(Long spaceUU, String appId) throws Exception {
- String saveUrl = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- ModelMap formData = new ModelMap();
- formData.put("_operate", "unbind");
- formData.put("spaceUU", spaceUU);
- formData.put("appId", appId);
- HttpUtil.ResponseWrap res = HttpUtil.doPost(saveUrl, formData);
- if (!res.isSuccess()) {
- throw new Exception(res.getContent());
- } else {
- ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- if (!result.isSuccess()) {
- throw new Exception(result.getErrMsg());
- }
- }
- }
- }
- /**
- * 企业开通应用
- * @param spaceUU 企业uu号
- * @param appId 应用id
- * @throws Exception
- */
- public static void bindApp(Long spaceUU, String appId) throws Exception {
- String saveUrl = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- ModelMap formData = new ModelMap();
- formData.put("_operate", "bind");
- formData.put("spaceUU", spaceUU);
- formData.put("appId", appId);
- HttpUtil.ResponseWrap res = HttpUtil.doPost(saveUrl, formData);
- if (!res.isSuccess()) {
- throw new Exception(res.getContent());
- } else {
- ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- if (!result.isSuccess()) {
- throw new Exception(result.getErrMsg());
- }
- }
- }
- }
- /**
- * 用户解除绑定企业
- * @param userUU 用户uu号
- * @param spaceUU 企业uu号
- * @throws Exception
- */
- public static void unbindUserSpace(Long userUU, Long spaceUU) throws Exception {
- String saveUrl = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- ModelMap formData = new ModelMap();
- formData.put("_operate", "unbind");
- formData.put("userUU", userUU);
- formData.put("spaceUU", spaceUU);
- HttpUtil.ResponseWrap res = HttpUtil.doPost(saveUrl, formData);
- if (!res.isSuccess()) {
- throw new Exception(res.getContent());
- } else {
- ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- if (!result.isSuccess()) {
- throw new Exception(result.getErrMsg());
- }
- }
- }
- }
- /// 之后方法会恢复并修改
- //
- // /**
- // * 获取校验码
- // *
- // * @param username
- // * 手机号或邮箱地址
- // * @return
- // */
- // public static void sendValidCode(String username) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap res = HttpUtil.doGet(saveUrl, new ModelMap("_operate", "getVcode").addAttribute("username", username));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else {
- // ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- // if (!result.isSuccess())
- // throw new Exception(result.getErrMsg());
- // }
- // }
- // }
- //
- // /**
- // * 验证校验码
- // *
- // * @param username
- // * 手机号或邮箱地址
- // * @param validCode
- // * 校验码
- // * @return
- // */
- // public static boolean checkValidCode(String username, String validCode) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap res = HttpUtil.doGet(saveUrl, new ModelMap("_operate", "checkVcode").addAttribute("username", username)
- // .addAttribute("validCode", validCode));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else {
- // ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- // if (!result.isSuccess())
- // throw new Exception(result.getErrMsg());
- // else
- // return true;
- // }
- // }
- // return false;
- // }
- //
- // public static String getAccessToken(String appId, String spaceDialectUID, String uid) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // saveUrl = saveUrl + "/getToken";
- // JSONObject formData = new JSONObject();
- // formData.put("appId", appId);
- // formData.put("spaceDialectUID", spaceDialectUID);
- // formData.put("uid", uid);
- // ResponseWrap res = HttpUtil.doGet(saveUrl, formData);
- // if (!res.isSuccess()) {
- // throw new Exception(res.getContent());
- // } else {
- // return res.getContent();
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 验证密码,返回绑定身份信息的token
- // *
- // * @return
- // */
- // public static String getAccessToken(User user) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // JSONObject formData = JSON.parseObject(JSON.toJSONString(user));
- // formData.put("_operate", "getToken");
- // ResponseWrap res = HttpUtil.doGet(saveUrl, formData);
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else {
- // ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- // if (!result.isSuccess())
- // throw new Exception(result.getErrMsg());
- // else
- // return String.valueOf(result.getContent());
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 验证token,返回当前应用相关的身份信息
- // *
- // * @return
- // */
- // public static UserView checkAccessToken(String token) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap res = HttpUtil.doGet(
- // saveUrl,
- // new ModelMap("_operate", "checkToken").addAttribute("token", token).addAttribute("appId",
- // SSOHelper.getSSOService().getConfig().getAppName()));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else {
- // ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- // if (!result.isSuccess())
- // throw new Exception(result.getErrMsg());
- // else
- // return JSON.parseObject(JSON.toJSONString(result.getContent()), UserView.class);
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 用token验证登录
- // *
- // * @param request
- // * @param response
- // * @param token
- // * @throws Exception
- // */
- // public static UserView loginByAccessToken(HttpServletRequest request, HttpServletResponse response, String token) throws Exception {
- // UserView user = checkAccessToken(token);
- // if (null != user) {
- // SSOToken st = new SSOToken(request, user.getUid());
- // st.setData(JSON.toJSONString(user));
- // SSOHelper.setSSOCookie(request, response, st, true);
- // }
- // return user;
- // }
- //
- // /**
- // * 传入当前登录的企业的营业执照号,查询发出的申请
- // *
- // * @param businessCode
- // * @param statusCode
- // * @param keyword
- // * @param pageNumber
- // * @param pageSize
- // * @return
- // * @throws Exception
- // */
- // public static Page<PartnershipRecord> getAllRequest(String businessCode, Integer statusCode, String keyword, int pageNumber,
- // int pageSize) throws Exception {
- // String getUrl = AccountConfig.getEnPartnersUrl();
- // if (!StringUtils.isEmpty(getUrl)) {
- // ResponseWrap res = HttpUtil.doGet(getUrl, new ModelMap("_operate", "getAllRequest").addAttribute("businessCode", businessCode)
- // .addAttribute("statusCode", statusCode).addAttribute("businessCode", businessCode).addAttribute("keyword", keyword)
- // .addAttribute("pageNumber", pageNumber).addAttribute("pageSize", pageSize));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // return JSONObject.parseObject(res.getContent(), new TypeReference<Page<PartnershipRecord>>() {
- // });
- // }
- // return null;
- // }
- //
- // /**
- // * 通过已存在uu过滤,取出全部合作伙伴(UAS接口用)
- // * @param businessCode
- // * @param statusCode
- // * @param keyword
- // * @param pageNumber
- // * @param pageSize
- // * @param partnerUUs
- // * @return
- // */
- // public static Page<PartnershipRecord> getRequestFilterByPartnerUUs(String businessCode, Integer statusCode, String keyword, List<Long> partnerUUs, int pageNumber, int pageSize) throws Exception {
- // String getUrl = AccountConfig.getEnPartnersUrl();
- // if (!StringUtils.isEmpty(getUrl)) {
- // ResponseWrap res = HttpUtil.doGet(getUrl, new ModelMap("_operate", "getAllRequestFilterByPartnerUUs").addAttribute("businessCode", businessCode)
- // .addAttribute("statusCode", statusCode).addAttribute("keyword", keyword).addAttribute("partnerUUs", JSON.toJSON(partnerUUs))
- // .addAttribute("pageNumber", pageNumber).addAttribute("pageSize", pageSize));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // return JSON.parseObject(res.getContent(), new TypeReference<Page<PartnershipRecord>>() {
- // });
- // }
- // return null;
- // }
- //
- // /**
- // * 进入企业圈
- // *
- // * @return
- // * @throws Exception
- // */
- // public static String redirectContactPage() throws Exception {
- // String enterUrl = AccountConfig.getContactPageUrl();
- // return enterUrl;
- // }
- //
- // /**
- // * 通过关键词搜索企业信息
- // *
- // * @param keyword
- // * @return
- // * @throws Exception
- // */
- // public static Page<UserSpaceDetail> getUserSpacesByKeyword(String keyword, int pageNumber, int pageSize) throws Exception {
- // String Url = AccountConfig.getEnPartnersUrl();
- // if (!StringUtils.isEmpty(Url)) {
- // ResponseWrap res = HttpUtil.doGet(Url,
- // new ModelMap("_operate", "getUserSpaces").addAttribute("keyword", keyword).addAttribute("pageNumber", pageNumber)
- // .addAttribute("pageSize", pageSize));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // return JSON.parseObject(res.getContent(), new TypeReference<Page<UserSpaceDetail>>() {
- // });
- // }
- // return null;
- // }
- //
- // /**
- // * 通过手机号搜索用户账号信息
- // *
- // * @param uid
- // * @return
- // * @throws Exception
- // */
- // public static List<User> getUserInfoByUid(String uid) throws Exception {
- // String Url = AccountConfig.getSpaceSaveUrl();
- // if (!StringUtils.isEmpty(Url)) {
- // ResponseWrap res = HttpUtil.doGet(Url + "/userInfo",
- // new ModelMap("uid", uid));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // String resText = res.getContent();
- // JSONObject object = JSON.parseObject(resText);
- // String contentText = object.getString("content");
- // return JSON.parseArray(contentText, User.class);
- // }
- // return null;
- // }
- //
- // /**
- // * 通过营业执照号获取企业应用
- // *
- // * @param uid
- // * @return
- // * @throws Exception
- // */
- // public static List<UserSpace> getUserSpaceByUid(String uid) throws Exception {
- // String Url = AccountConfig.getSpaceSaveUrl();
- // if (!StringUtils.isEmpty(Url)) {
- // ResponseWrap res = HttpUtil.doGet(Url + "/" + uid);
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // String resText = res.getContent();
- // JSONObject object = JSON.parseObject(resText);
- // String contentText = object.getString("content");
- // return JSON.parseArray(contentText, UserSpace.class);
- // }
- // return null;
- // }
- //
- // /**
- // * 新增一条合作关系记录
- // *
- // * @param record
- // * @return
- // * @throws Exception
- // */
- // public static String addNewRecord(PartnershipRecord record) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // String result = null;
- // if (!StringUtils.isEmpty(url)) {
- // JSONObject formData = JSON.parseObject(JSON.toJSONString(record));
- // formData.put("_operate", "addPartner");
- // ResponseWrap res = HttpUtil.doPost(url, formData);
- // result = res.getContent();
- // }
- // return result;
- // }
- //
- // /**
- // * 同步供应商关系为合作关系记录
- // *
- // * @param record
- // * @return
- // * @throws Exception
- // */
- // public static String synchronizeRecord(PartnershipRecord record) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // String result = null;
- // if (!StringUtils.isEmpty(url)) {
- // JSONObject formData = JSON.parseObject(JSON.toJSONString(record));
- // formData.put("_operate", "synchronizePartner");
- // ResponseWrap res = HttpUtil.doPost(url, formData);
- // result = res.getContent();
- // }
- // return result;
- // }
- //
- // /**
- // * 通过id和申请人的电话进行确认
- // *
- // * @param id
- // * @param vendUserTel
- // * @param appId
- // * @return
- // * @throws Exception
- // */
- // public static String acceptRequest(Long id, String vendUserTel, String appId) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // String result = null;
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(
- // url,
- // new ModelMap("_operate", "acceptRequest").addAttribute("id", id).addAttribute("vendUserTel", vendUserTel)
- // .addAttribute("appId", appId));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else {
- // result = res.getContent();
- // }
- // }
- // return result;
- // }
- //
- // /**
- // * 申请不通过,通过申请人的电话操作,并标出原因
- // *
- // * @param id
- // * @param reason
- // * @param vendUserTel
- // * @param appId
- // * @return
- // * @throws Exception
- // */
- // public static String rejectRequest(Long id, String reason, String vendUserTel, String appId) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // String result = null;
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(
- // url,
- // new ModelMap("_operate", "rejectRequest").addAttribute("id", id).addAttribute("reason", reason)
- // .addAttribute("vendUserTel", vendUserTel).addAttribute("appId", appId));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else {
- // result = res.getContent();
- // }
- // }
- // return result;
- // }
- //
- // /**
- // * 通过当前企业号和企业列表中的企业号查询申请状态
- // *
- // * @return
- // * @throws Exception
- // */
- // public static RequsetStatus getStatusByCustUidAndVendUid(String custUid, String vendUid) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // RequsetStatus request = new RequsetStatus();
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(url, new ModelMap("_operate", "getRequestStatus").addAttribute("custUid", custUid)
- // .addAttribute("vendUid", vendUid));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else {
- // request = JSON.parseObject(res.getContent(), RequsetStatus.class);
- // }
- // }
- // return request;
- // }
- //
- // /**
- // * 搜索词通过id返回数据
- // *
- // * @param ids
- // * @return
- // * @throws Exception
- // */
- // public static List<UserSpaceDetail> findAll(String ids) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // List<UserSpaceDetail> details = new ArrayList<UserSpaceDetail>();
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(url, new ModelMap("_operate", "findAll").addAttribute("ids", ids));
- // if(!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // details = JSONObject.parseArray(res.getContent(), UserSpaceDetail.class);
- // }
- // return details;
- // }
- //
- // /**
- // * 通过企业营业执照查询收到的待处理的请求
- // *
- // * @param businessCode
- // * @return
- // * @throws Exception
- // */
- // public static String getRequestTodo(String businessCode) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // String result = null;
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(url,
- // new ModelMap("_operate", "getRequestTodo").addAttribute("businessCode", businessCode));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // result = res.getContent();
- // }
- // return result;
- // }
- //
- // /**
- // * 其他应用发起邀请注册,同步数据
- // *
- // * @param jsonStr
- // * @throws Exception
- // */
- // public static void synchroInvitation(String jsonStr) throws Exception {
- // String url = AccountConfig.getEnPartnersUrl();
- // if (!StringUtils.isEmpty(url)) {
- // HttpUtil.doPost(url, new ModelMap("_operate", "invitation").addAttribute("jsonStr", jsonStr));
- // }
- // }
- //
- // /**
- // * ERP、SAAS新开账套名称校验
- // *
- // * @param name
- // * @return
- // * @throws Exception
- // */
- // public static String validName(String name) throws Exception {
- // String result = null;
- // String url = AccountConfig.getSpaceSaveUrl();
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(url, new ModelMap("_operate", "validName").addAttribute("name", name),
- // 50);
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // result = res.getContent();
- // }
- // return result;
- // }
- //
- // /**
- // * ERP、SAAS新开账套名称校验
- // *
- // * @param businessCode
- // * @return
- // * @throws Exception
- // */
- // public static String validBusinessCode(String businessCode) throws Exception {
- // String result = null;
- // String url = AccountConfig.getSpaceSaveUrl();
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(url,
- // new ModelMap("_operate", "validBusinessCode").addAttribute("businessCode", businessCode), 50);
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // result = res.getContent();
- // }
- // return result;
- // }
- //
- // /**
- // * 通过营业执照号查找 企业详细信息
- // *
- // * @param
- // * @return
- // * @throws Exception
- // */
- // public static UserSpaceDetail findByBusinessCode(String businessCode) throws Exception {
- // String result = null;
- // String url = AccountConfig.getSpaceSaveUrl();
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(url,
- // new ModelMap("_operate", "findByBusinessCode").addAttribute("businessCode", businessCode), 50);
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // result = res.getContent();
- // }
- // return JSON.parseObject(result,UserSpaceDetail.class);
- // }
- //
- // /**
- // * ERP、SAAS新开账套
- // *
- // * @param userSpaceDetail
- // * @param users
- // * @throws Exception
- // */
- // public static String applyApp(UserSpaceDetail userSpaceDetail, List<UserDetail> users) throws Exception {
- // String url = AccountConfig.getSpaceSaveUrl();
- // String result = null;
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doPost(url, new ModelMap("_operate", "registerBranchAccount")
- // .addAttribute("detail", JSON.toJSON(userSpaceDetail))
- // .addAttribute("userInfos", JSON.toJSON(users)));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // result = res.getContent();
- // }
- // return result;
- // }
- //
- // /**
- // * 商城个人账号增加企业注册
- // *
- // * @param userSpaceDetail
- // * @throws Exception
- // */
- // public static String applyAppForMall(UserSpaceDetail userSpaceDetail) throws Exception {
- // String url = AccountConfig.getSpaceSaveUrl();
- // String result = null;
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doPost(url,
- // new ModelMap("_operate", "registForMall")
- // .addAttribute("detail", JSON.toJSON(userSpaceDetail)));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // result = res.getContent();
- // }
- // return result;
- // }
- //
- // /**
- // * 设置hr账号
- // *
- // * @param user
- // * @param detail
- // * @return
- // * @throws Exception
- // */
- // public static String setHrAccount(User user, UuzcUserSpaceDetail detail) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // saveUrl = saveUrl + "/setHrAccount";
- // if (!StringUtils.isEmpty(saveUrl)) {
- // JSONObject formData = new JSONObject();
- // if (detail != null) {
- // formData = JSON.parseObject(JSON.toJSONString(detail));
- // }
- // if (null != user) {
- // formData.putAll(JSON.parseObject(JSON.toJSONString(user)));
- // }
- // ResponseWrap response = HttpUtil.doPost(saveUrl, formData);
- // if (!response.isSuccess())
- // throw new Exception(response.getContent());
- // else {
- // return response.getContent();
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 根据营业执照获取众创需要的企业资料
- // *
- // * @param businessCode
- // * @return
- // * @throws Exception
- // */
- // public static UuzcUserSpaceDetail getUuzcUserSpaceDetail(String businessCode) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap response = HttpUtil.doGet(saveUrl + "/uuzcSpace" , new ModelMap("businessCode", businessCode));
- // if (!response.isSuccess())
- // throw new Exception(response.getContent());
- // else {
- // return JSONObject.parseObject(response.getContent(), UuzcUserSpaceDetail.class);
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 判断当前企业是否设置了hr
- // *
- // * @param businessCode
- // * @return
- // * @throws Exception
- // */
- // public static String getHrAccount(String businessCode) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap response = HttpUtil.doGet(saveUrl + "/hrcount" , new ModelMap("businessCode", businessCode));
- // if (!response.isSuccess())
- // throw new Exception(response.getContent());
- // else {
- // return response.getContent();
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 获取当前企业的HR信息
- // *
- // * @param businessCode
- // * @return
- // * @throws Exception
- // */
- // public static User getHrInfo(String businessCode) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap response = HttpUtil.doGet(saveUrl + "/hrInfo" , new ModelMap("businessCode", businessCode));
- // if (!response.isSuccess())
- // throw new Exception(response.getContent());
- // else {
- // return JSONObject.parseObject(response.getContent(), User.class);
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 获取当前企业人员账号信息
- // *
- // * @param businessCode
- // * @return
- // * @throws Exception
- // */
- // public static List<User> getEmployees(String businessCode) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // saveUrl = saveUrl + "/employees";
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap response = HttpUtil.doPost(saveUrl, new ModelMap("businessCode", businessCode));
- // if (!response.isSuccess())
- // throw new Exception(response.getContent());
- // else {
- // return JSON.parseArray(response.getContent(), User.class);
- // }
- // }
- // return null;
- // }
- //
- // /**
- // * 保存用户密保问题
- // * @param questions
- // * @throws Exception
- // */
- // public static void saveUserQuestions(List<UserQuestion> questions) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // saveUrl = saveUrl + "/save/question";
- // if (!StringUtils.isEmpty(saveUrl)) {
- // ResponseWrap res = HttpUtil.doPost(saveUrl, new ModelMap("question", questions));
- // if (!res.isSuccess()) {
- // throw new Exception(res.getContent());
- // }
- // }
- // }
- //
- // /**
- // * 保存用户密保问题
- // * @param userQuestion
- // * @throws Exception
- // */
- // public static void saveUserQuestion(UserQuestion userQuestion) throws Exception {
- // String saveUrl = AccountConfig.getUserSaveUrl();
- // saveUrl = saveUrl + "/save/question";
- // if (!StringUtils.isEmpty(saveUrl)) {
- // JSONObject formData = JSON.parseObject(JSON.toJSONString(userQuestion));
- // formData.put("_count", "one");
- // ResponseWrap res = HttpUtil.doPost(saveUrl, formData);
- // if (!res.isSuccess()) {
- // throw new Exception(res.getContent());
- // }
- // }
- // }
- //
- // /**
- // * 根据imId获取用户userUU(没有则返回null)
- // */
- // public static User getUserByImId (Long imId) throws Exception {
- // String url = AccountConfig.getUserSaveUrl();
- // User result = null;
- // if (!StringUtils.isEmpty(url)) {
- // ResponseWrap res = HttpUtil.doGet(url,
- // new ModelMap("_operate", "getUserByImId")
- // .addAttribute("imId", imId));
- // if (!res.isSuccess())
- // throw new Exception(res.getContent());
- // else
- // result = JSON.parseObject(res.getContent(), User.class);
- // }
- // return result;
- // }
- //
- // /**
- // * 根据营业执照号分页查找该企业的用户
- // * @param businessCode
- // * @param pageNumber
- // * @param pageSize
- // * @return
- // * @throws Exception
- // */
- // public Page<User> findUsersByBusinessCode(String businessCode, int pageNumber, int pageSize) throws Exception {
- // String url = AccountConfig.getUserSaveUrl();
- // if (!StringUtils.isEmpty(url)) {
- // url = url + "/findByBusinessCode";
- // String appId = SSOHelper.getSSOService().getConfig().getAppName();
- // ModelMap data = new ModelMap();
- // data.put("businessCode", businessCode);
- // data.put("appId", appId);
- // data.put("pageNumber", pageNumber);
- // data.put("pageSize", pageSize);
- // ResponseWrap res = HttpUtil.doGet(url, data);
- // if (!res.isSuccess()) {
- // throw new Exception(res.getContent());
- // } else {
- // return JSON.parseObject(res.getContent(), new TypeReference<Page<User>>() {});
- // }
- // }
- // return null;
- // }
- }
|