|
|
@@ -0,0 +1,77 @@
|
|
|
+package com.uas.platform.b2b.controller;
|
|
|
+
|
|
|
+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.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
+
|
|
|
+import com.uas.platform.b2b.model.Enterprise;
|
|
|
+import com.uas.platform.b2b.model.User;
|
|
|
+import com.uas.platform.b2b.service.EnterpriseService;
|
|
|
+import com.uas.platform.b2b.service.UserService;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 对外公开的资料查询接口
|
|
|
+ * <p>
|
|
|
+ * 只提供有限资料
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author yingp
|
|
|
+ *
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/public/queriable")
|
|
|
+public class PublicQueryController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private EnterpriseService enterpriseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按UU号查找企业信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/members/{uu}", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ @ResponseStatus(value = HttpStatus.OK)
|
|
|
+ public ModelMap getEnterprise(@PathVariable("uu") Long 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;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按UU号查找用户信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/members/{enUU}/users/{userUU}", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ @ResponseStatus(value = HttpStatus.OK)
|
|
|
+ public ModelMap getUser(@PathVariable("enUU") Long enUU, @PathVariable("userUU") Long 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;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|