|
|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.sso.erp.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
|
|
|
import com.uas.sso.entity.User;
|
|
|
import com.uas.sso.entity.Userspace;
|
|
|
import com.uas.sso.service.UserService;
|
|
|
@@ -8,6 +9,7 @@ import com.uas.sso.service.UserspaceService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
@@ -118,4 +120,29 @@ public class ErpUserSpaceManageController extends ErpBaseController {
|
|
|
returnData.put("adminUU", newSpace.getAdminUU());
|
|
|
return success(returnData);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据用户手机号获取企业信息
|
|
|
+ * @param mobile 用户手机号
|
|
|
+ * @return 企业信息(企业名称,企业uu号,企业营业执照,注册地址)集合
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/info", params = "_by=mobile")
|
|
|
+ public ModelMap findSpaceInfoByMobile(String mobile) {
|
|
|
+ // 固定秘钥
|
|
|
+ String accessSecret = "b4uzn6vf1db06qmn";
|
|
|
+ checkRequest(accessSecret);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(mobile)) {
|
|
|
+ return error("手机号不能为空");
|
|
|
+ }
|
|
|
+ // 获取用户信息
|
|
|
+ User user = userService.findByMobile(mobile);
|
|
|
+ if (user == null) {
|
|
|
+ return error("手机号未注册");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取出企业信息相关字段
|
|
|
+ SimplePropertyPreFilter filter = new SimplePropertyPreFilter(Userspace.class, "spaceUU", "spaceName", "businessCode", "regAddress");
|
|
|
+ return success(JSON.toJSONString(user.getUserSpaces(), filter));
|
|
|
+ }
|
|
|
}
|