|
|
@@ -2,11 +2,13 @@ package com.uas.platform.b2b.controller;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -54,15 +56,19 @@ public class PublicQueryController {
|
|
|
@RequestParam("uu") Long uu) throws UnsupportedEncodingException {
|
|
|
ModelMap returnMap = new ModelMap();
|
|
|
if (!StringUtils.isEmpty(name)) {
|
|
|
- returnMap.put("name",
|
|
|
- QueriableMember.getMembers(enterpriseService.findByName(URLDecoder.decode(name, "UTF-8"))));
|
|
|
+ List<Enterprise> enterprises = enterpriseService.findByName(URLDecoder.decode(name, "UTF-8"));
|
|
|
+ if (!CollectionUtils.isEmpty(enterprises))
|
|
|
+ returnMap.put("name", QueriableMember.getMembers(enterprises));
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(shortName)) {
|
|
|
- returnMap.put("shortName", QueriableMember.getMembers(enterpriseService.findByShortName(URLDecoder.decode(
|
|
|
- shortName, "UTF-8"))));
|
|
|
+ List<Enterprise> enterprises = enterpriseService.findByShortName(URLDecoder.decode(shortName, "UTF-8"));
|
|
|
+ if (!CollectionUtils.isEmpty(enterprises))
|
|
|
+ returnMap.put("shortName", QueriableMember.getMembers(enterprises));
|
|
|
}
|
|
|
if (uu != null) {
|
|
|
- returnMap.put("uu", enterpriseService.findById(uu));
|
|
|
+ Enterprise enterprise = enterpriseService.findById(uu);
|
|
|
+ if (enterprise != null)
|
|
|
+ returnMap.put("uu", new QueriableMember(enterprise));
|
|
|
}
|
|
|
return returnMap;
|
|
|
}
|