|
@@ -2,7 +2,6 @@ package com.uas.platform.b2b.controller;
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
@@ -17,10 +16,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
|
|
|
|
|
import com.uas.platform.b2b.model.Enterprise;
|
|
import com.uas.platform.b2b.model.Enterprise;
|
|
|
|
|
+import com.uas.platform.b2b.model.QueriableMember;
|
|
|
|
|
+import com.uas.platform.b2b.model.QueriableUser;
|
|
|
import com.uas.platform.b2b.model.User;
|
|
import com.uas.platform.b2b.model.User;
|
|
|
import com.uas.platform.b2b.service.EnterpriseService;
|
|
import com.uas.platform.b2b.service.EnterpriseService;
|
|
|
import com.uas.platform.b2b.service.UserService;
|
|
import com.uas.platform.b2b.service.UserService;
|
|
|
-import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 对外公开的资料查询接口
|
|
* 对外公开的资料查询接口
|
|
@@ -29,7 +29,7 @@ import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
* </p>
|
|
* </p>
|
|
|
*
|
|
*
|
|
|
* @author yingp
|
|
* @author yingp
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
*/
|
|
*/
|
|
|
@Controller
|
|
@Controller
|
|
|
@RequestMapping("/public/queriable")
|
|
@RequestMapping("/public/queriable")
|
|
@@ -50,21 +50,19 @@ public class PublicQueryController {
|
|
|
@RequestMapping(value = "/members", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/members", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
@ResponseStatus(value = HttpStatus.OK)
|
|
@ResponseStatus(value = HttpStatus.OK)
|
|
|
- public ModelMap queryEnterprise(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
|
|
- String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
|
|
- Map<String, String> map = FlexJsonUtils.fromJson(jsonStr);
|
|
|
|
|
|
|
+ public ModelMap queryEnterprise(@RequestParam("name") String name, @RequestParam("shortName") String shortName,
|
|
|
|
|
+ @RequestParam("uu") Long uu) throws UnsupportedEncodingException {
|
|
|
ModelMap returnMap = new ModelMap();
|
|
ModelMap returnMap = new ModelMap();
|
|
|
- String name = map.get("name");
|
|
|
|
|
if (!StringUtils.isEmpty(name)) {
|
|
if (!StringUtils.isEmpty(name)) {
|
|
|
- returnMap.put("name", enterpriseService.findByName(name));
|
|
|
|
|
|
|
+ returnMap.put("name",
|
|
|
|
|
+ QueriableMember.getMembers(enterpriseService.findByName(URLDecoder.decode(name, "UTF-8"))));
|
|
|
}
|
|
}
|
|
|
- String shortName = map.get("shortname");
|
|
|
|
|
if (!StringUtils.isEmpty(shortName)) {
|
|
if (!StringUtils.isEmpty(shortName)) {
|
|
|
- returnMap.put("shortname", enterpriseService.findByShortName(shortName));
|
|
|
|
|
|
|
+ returnMap.put("shortname", QueriableMember.getMembers(enterpriseService.findByShortName(URLDecoder.decode(
|
|
|
|
|
+ shortName, "UTF-8"))));
|
|
|
}
|
|
}
|
|
|
- String uu = map.get("uu");
|
|
|
|
|
- if (!StringUtils.isEmpty(uu)) {
|
|
|
|
|
- returnMap.put("uu", enterpriseService.findById(Long.parseLong(uu)));
|
|
|
|
|
|
|
+ if (uu != null) {
|
|
|
|
|
+ returnMap.put("uu", enterpriseService.findById(uu));
|
|
|
}
|
|
}
|
|
|
return returnMap;
|
|
return returnMap;
|
|
|
}
|
|
}
|
|
@@ -77,15 +75,10 @@ public class PublicQueryController {
|
|
|
@RequestMapping(value = "/members/{uu}", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/members/{uu}", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
@ResponseStatus(value = HttpStatus.OK)
|
|
@ResponseStatus(value = HttpStatus.OK)
|
|
|
- public ModelMap getEnterprise(@PathVariable("uu") Long uu) {
|
|
|
|
|
|
|
+ public QueriableMember getEnterprise(@PathVariable("uu") Long uu) {
|
|
|
Enterprise enterprise = enterpriseService.findById(uu);
|
|
Enterprise enterprise = enterpriseService.findById(uu);
|
|
|
- if (enterprise != null) {
|
|
|
|
|
- ModelMap map = new ModelMap();
|
|
|
|
|
- map.put("name", enterprise.getEnName());
|
|
|
|
|
- map.put("shortname", enterprise.getEnShortname());
|
|
|
|
|
- map.put("address", enterprise.getEnAddress());
|
|
|
|
|
- return map;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (enterprise != null)
|
|
|
|
|
+ return new QueriableMember(enterprise);
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -97,15 +90,10 @@ public class PublicQueryController {
|
|
|
@RequestMapping(value = "/members/{enUU}/users/{userUU}", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/members/{enUU}/users/{userUU}", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
@ResponseStatus(value = HttpStatus.OK)
|
|
@ResponseStatus(value = HttpStatus.OK)
|
|
|
- public ModelMap getUser(@PathVariable("enUU") Long enUU, @PathVariable("userUU") Long userUU) {
|
|
|
|
|
|
|
+ public QueriableUser getUser(@PathVariable("enUU") Long enUU, @PathVariable("userUU") Long userUU) {
|
|
|
User user = userService.findUserByEnUUAndUserUU(enUU, userUU);
|
|
User user = userService.findUserByEnUUAndUserUU(enUU, userUU);
|
|
|
- if (user != null) {
|
|
|
|
|
- ModelMap map = new ModelMap();
|
|
|
|
|
- map.put("name", user.getUserName());
|
|
|
|
|
- map.put("tel", user.getUserTel());
|
|
|
|
|
- map.put("email", user.getUserEmail());
|
|
|
|
|
- return map;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (user != null)
|
|
|
|
|
+ return new QueriableUser(user);
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|