| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376 |
- package com.uas.sso.util;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONObject;
- import com.alibaba.fastjson.TypeReference;
- import com.uas.sso.AccountConfig;
- import com.uas.sso.ResultWrap;
- import com.uas.sso.SSOHelper;
- import com.uas.sso.common.util.HttpUtil;
- import com.uas.sso.entity.*;
- import com.uas.sso.support.Page;
- import org.springframework.ui.ModelMap;
- import org.springframework.util.StringUtils;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- /**
- * 客户端使用,操作企业资料、用户资料
- *
- * @author wangmh
- *
- */
- 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 removeUser(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 userUU 用户uu号
- * @param spaceUU 企业uu号
- * @throws Exception
- */
- public static void addUser(Long userUU, Long spaceUU) throws Exception {
- String saveUrl = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- ModelMap formData = new ModelMap();
- formData.put("_operate", "bind");
- formData.put("appId", SSOHelper.getSSOService().getConfig().getAppName());
- 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 spaceUU
- * @param user
- * @throws Exception
- */
- public static UserView addUser(Long spaceUU, UserView user) throws Exception {
- String saveUrl = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- JSONObject formData = JSON.parseObject(JSON.toJSONString(user));
- formData.put("_operate", "add");
- formData.put("appId", SSOHelper.getSSOService().getConfig().getAppName());
- 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());
- } else if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), UserView.class);
- }
- }
- }
- return null;
- }
- /**
- * 修改用户信息
- *
- * @param user
- * @return
- * @throws Exception
- */
- public static List<UserView> saveUser(UserView user, Object spaceDialectUID) throws Exception {
- String saveUrl = AccountConfig.getUserSaveUrl();
- String appId = SSOHelper.getSSOService().getConfig().getAppName();
- if (!StringUtils.isEmpty(saveUrl)) {
- JSONObject formData = new JSONObject();
- if (user != null) {
- formData = JSON.parseObject(JSON.toJSONString(user));
- }
- // 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.isError()) {
- // throw new Exception(result.getErrMsg());
- // } else {
- // return JSON.parseArray(JSON.toJSONString(result.getContent()), UserView.class);
- // }
- // }
- }
- return null;
- }
- /**
- * 根据营业执照号获得企业信息
- * @param businessCode 营业执照号
- * @return
- */
- public static UserSpaceView findByBusinessCode(String businessCode) throws Exception {
- String saveUrl = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- ModelMap formData = new ModelMap();
- saveUrl = saveUrl + "/info/businessCode";
- formData.put("businessCode", businessCode);
- HttpUtil.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 if (result.getContent() != null){
- return JSON.parseObject(result.getContent().toString(), UserSpaceView.class);
- }
- }
- }
- return null;
- }
- /**
- * 根据企业名获得企业信息
- * @param spaceName 企业名
- * @return
- */
- public static UserSpaceView findBySpaceName(String spaceName) throws Exception {
- String saveUrl = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- ModelMap formData = new ModelMap();
- saveUrl = saveUrl + "/info/name";
- formData.put("name", spaceName);
- HttpUtil.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 if (result.getContent() != null){
- return JSON.parseObject(result.getContent().toString(), UserSpaceView.class);
- }
- }
- }
- return null;
- }
- /**
- * 用户申请绑定企业
- * @param userUU 用户uu号
- * @param spaceUU 企业uu号
- * @throws Exception
- */
- public static void applyUserSpace(Long userUU, Long spaceUU) throws Exception {
- String saveUrl = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- ModelMap formData = new ModelMap();
- saveUrl = saveUrl + "/apply/bind";
- 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());
- }
- }
- }
- }
- /**
- * 分页查找个人申请记录
- *
- * @author wangmh
- * @date 2018/2/1 15:47
- * @param userUU 用户uu号
- * @param page 页数(从0开始)
- * @param size 每页大小
- * @return
- * @throws Exception
- */
- public static Page<ApplyUserSpaceView> findApplyInfo(Long userUU, int page, int size) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/apply/info";
- ModelMap data = new ModelMap();
- data.put("userUU", userUU);
- data.put("page", page);
- data.put("size", size);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), new TypeReference<Page<ApplyUserSpaceView>>() {
- });
- }
- }
- }
- return null;
- }
- /**
- * 统计该企业申请记录数量
- * @param spaceUU 企业uu号
- * @return
- * @throws Exception
- */
- public static Map<String, Integer> applyCount(Long spaceUU) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/apply/count";
- ModelMap data = new ModelMap();
- data.put("spaceUU", spaceUU);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), Map.class);
- }
- }
- }
- return null;
- }
- /**
- * 校验企业名称
- * @param spaceName 企业名称
- */
- public static void checkSpaceName(String spaceName) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/checkSpaceName";
- ModelMap data = new ModelMap();
- data.put("spaceName", spaceName);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 businessCode 企业营业执照号
- */
- public static void checkBusinessCode(String businessCode) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/checkBusinessCode";
- ModelMap data = new ModelMap();
- data.put("businessCode", businessCode);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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());
- }
- }
- }
- }
- /**
- * 根据用户uu号获取用户信息
- * @param userUU 用户uu号
- * @return
- * @throws Exception
- */
- public static UserView findByUserUU(Long userUU) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/info";
- ModelMap data = new ModelMap();
- data.put("userUU", userUU);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), UserView.class);
- }
- }
- }
- return null;
- }
- /**
- * 根据企业uu号获取企业信息
- * @param spaceUU 企业uu号
- * @return
- * @throws Exception
- */
- public static UserSpaceView findBySpaceUU(Long spaceUU) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/info/spaceUU";
- ModelMap data = new ModelMap();
- data.put("spaceUU", spaceUU);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), UserSpaceView.class);
- }
- }
- }
- return null;
- }
- /**
- * 通过当前企业号和企业列表中的企业号查询申请状态
- *
- * @return
- * @throws Exception
- */
- public static RequestStatus getStatusByCustUidAndVendUid(String custBusinessCode, String vendBusinessCode) throws Exception {
- String url = AccountConfig.getEnPartnersUrl();
- RequestStatus request = new RequestStatus();
- if (!StringUtils.isEmpty(url)) {
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, new ModelMap("_operate", "getRequestStatus")
- .addAttribute("vendBusinessCode", vendBusinessCode)
- .addAttribute("custBusinessCode", custBusinessCode));
- if (!res.isSuccess()) {
- throw new Exception(res.getContent());
- } else {
- request = JSON.parseObject(res.getContent(), RequestStatus.class);
- }
- }
- return request;
- }
- /**
- * 校验密码
- *
- * <pre>
- * 全匹配模式
- * </pre>
- *
- * @param user
- * @throws Exception
- */
- public static boolean fuzzyCheckPassword(UserView user) throws Exception {
- String saveUrl = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- JSONObject formData = JSON.parseObject(JSON.toJSONString(user));
- formData.put("_operate", "fuzzyCheck");
- 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());
- } else {
- return true;
- }
- }
- }
- return false;
- }
- /// 之后方法会恢复并修改
- //
- // /**
- // * 获取校验码
- // *
- // * @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(UserView user) throws Exception {
- String saveUrl = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(saveUrl)) {
- JSONObject formData = JSON.parseObject(JSON.toJSONString(user));
- formData.put("_operate", "getToken");
- HttpUtil.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 页号(0开始)
- * @param pageSize 每页数量
- * @return
- * @throws Exception
- */
- public static Page<PartnershipRecordView> getAllRequest(String businessCode, Integer statusCode, String keyword, int pageNumber,
- int pageSize) throws Exception {
- String getUrl = AccountConfig.getEnPartnersUrl();
- if (!StringUtils.isEmpty(getUrl)) {
- HttpUtil.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());
- } else {
- ResultWrap result = JSON.parseObject(res.getContent(), ResultWrap.class);
- if (!result.isSuccess()) {
- throw new Exception(result.getErrMsg());
- } else if (result.getContent() != null) {
- return JSONObject.parseObject(result.getContent().toString(), new TypeReference<Page<PartnershipRecordView>>() {});
- }
- }
- }
- 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<UserSpaceView> getUserSpacesByKeyword(String keyword, int pageNumber, int pageSize) throws Exception {
- String Url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(Url)) {
- HttpUtil.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<UserSpaceView>>() {
- });
- }
- 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(PartnershipRecordView 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");
- HttpUtil.ResponseWrap res = HttpUtil.doPost(url, formData);
- result = res.getContent();
- }
- return result;
- }
- /**
- * 同步供应商关系为合作关系记录
- *
- * @param record
- * @return
- * @throws Exception
- */
- public static String synchronizeRecord(PartnershipRecordView 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");
- HttpUtil.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)) {
- HttpUtil.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)) {
- HttpUtil.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;
- }
- /**
- * 搜索词通过id返回数据
- *
- * @param ids
- * @return
- * @throws Exception
- */
- public static List<UserSpaceView> findAll(String ids) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- List<UserSpaceView> details = new ArrayList<UserSpaceView>();
- if (!StringUtils.isEmpty(url)) {
- HttpUtil.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(), UserSpaceView.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)) {
- HttpUtil.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)) {
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, new ModelMap("_operate", "validName").addAttribute("name", name),
- 60 * 1000);
- 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)) {
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url,
- new ModelMap("_operate", "validBusinessCode").addAttribute("businessCode", businessCode), 60 * 1000);
- if (!res.isSuccess()) {
- throw new Exception(res.getContent());
- } else {
- result = res.getContent();
- }
- }
- return result;
- }
- /**
- * ERP、SAAS新开账套
- *
- * @param userSpaceDetail
- * @param users
- * @throws Exception
- */
- public static String applyApp(UserSpaceView userSpaceDetail, List<UserView> users) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- String result = null;
- if (!StringUtils.isEmpty(url)) {
- HttpUtil.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 userSpaceView 企业信息
- * @throws Exception
- */
- public static UserSpaceView register(UserSpaceView userSpaceView, UserView admin) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/register/other";
- // 不把管理员设置成null会400
- userSpaceView.setAdmin(null);
- JSONObject data = JSON.parseObject(JSON.toJSONString(userSpaceView));
- data.putAll(JSON.parseObject(JSON.toJSONString(admin)));
- data.put("appId", SSOHelper.getSSOService().getConfig().getAppName());
- HttpUtil.ResponseWrap res = HttpUtil.doPost(url, data);
- 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(result.getContent().toString(), UserSpaceView.class);
- }
- }
- }
- return null;
- }
- /**
- * 商城个人账号增加企业注册
- *
- * @param userSpaceView 企业信息
- * @param admin 管理员信息
- * @param isSync 是否同步到来源应用
- * @throws Exception
- */
- public static UserSpaceView register(UserSpaceView userSpaceView, UserView admin, boolean isSync) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/register/other";
- // 不把管理员设置成null会400
- userSpaceView.setAdmin(null);
- JSONObject data = JSON.parseObject(JSON.toJSONString(userSpaceView));
- data.putAll(JSON.parseObject(JSON.toJSONString(admin)));
- data.put("appId", SSOHelper.getSSOService().getConfig().getAppName());
- data.put("isSyncSource", isSync);
- HttpUtil.ResponseWrap res = HttpUtil.doPost(url, data);
- 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(result.getContent().toString(), UserSpaceView.class);
- }
- }
- }
- return null;
- }
- /**
- * 根据token获得用户信息
- *
- * @param token tokenId
- * @throws Exception
- */
- public static UserView getUserByToken(String token) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/getUserByToken";
- ModelMap data = new ModelMap();
- data.put("token", token);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSONObject.parseObject(result.getContent().toString(), UserView.class);
- }
- }
- }
- return null;
- }
- //
- // /**
- // * 设置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 UserView getUserByImId (Long imId) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- UserView user = null;
- if (!StringUtils.isEmpty(url)) {
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url,
- new ModelMap("_operate", "getUserByImId")
- .addAttribute("imId", imId));
- 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 if (result.getContent() != null) {
- user = JSON.parseObject(result.getContent().toString(), UserView.class);
- }
- }
- }
- return user;
- }
- /**
- * 根据营业执照号分页查找该企业的用户
- * @param spaceUU
- * @param pageNumber
- * @param pageSize
- * @return
- * @throws Exception
- */
- public static Page<UserView> findUsersByBusinessCode(Long spaceUU, int pageNumber, int pageSize) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/find/member";
- String appId = SSOHelper.getSSOService().getConfig().getAppName();
- ModelMap data = new ModelMap();
- data.put("spaceUU", spaceUU);
- data.put("appId", appId);
- data.put("page", pageNumber);
- data.put("size", pageSize);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), new TypeReference<Page<UserView>>() {});
- }
- }
- }
- return null;
- }
- /**
- * 根据营业执照号分页查找该企业的用户
- * @param spaceUU
- * @param userUU
- * @return
- * @throws Exception
- */
- public static String getToken(Long spaceUU, Long userUU) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/getToken";
- String appId = SSOHelper.getSSOService().getConfig().getAppName();
- ModelMap data = new ModelMap();
- data.put("spaceUU", spaceUU);
- data.put("userUU", userUU);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return result.getContent().toString();
- }
- }
- }
- return null;
- }
- public static Page<ApplyUserSpaceView> findApplyAllToMall(Long speaceUU, int page, int size, Integer status, String keyword) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/apply/info/mall";
- String appId = SSOHelper.getSSOService().getConfig().getAppName();
- ModelMap data = new ModelMap();
- data.put("speaceUU", speaceUU);
- data.put("page", page);
- data.put("size", size);
- data.put("status", status);
- data.put("keyword", keyword);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), new TypeReference<Page<ApplyUserSpaceView>>() {});
- }
- }
- }
- return null;
- }
- public static String auditApply(Long userUU, Long id, Integer status) throws Exception {
- String url = AccountConfig.getSpaceSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/audit/apply";
- String appId = SSOHelper.getSSOService().getConfig().getAppName();
- ModelMap data = new ModelMap();
- data.put("userUU", userUU);
- data.put("id", id);
- data.put("status", status);
- HttpUtil.ResponseWrap res = HttpUtil.doPost(url, data);
- 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 if (result.getContent() != null) {
- return result.getContent().toString();
- }
- }
- }
- return null;
- }
- public static UserView findUserByMobile(String mobile) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/info/mobile";
- ModelMap data = new ModelMap();
- data.put("mobile", mobile);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString(), UserView.class);
- }
- }
- }
- return null;
- }
- public static Map<String, Object> getUserInfo(Long userUU, Long spaceUU) throws Exception {
- String url = AccountConfig.getUserSaveUrl();
- if (!StringUtils.isEmpty(url)) {
- url = url + "/info/userUU";
- ModelMap data = new ModelMap();
- data.put("userUU", userUU);
- data.put("spaceUU", spaceUU);
- HttpUtil.ResponseWrap res = HttpUtil.doGet(url, data);
- 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 if (result.getContent() != null) {
- return JSON.parseObject(result.getContent().toString());
- }
- }
- }
- return null;
- }
- }
|