|
|
@@ -20,13 +20,14 @@ import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
|
|
|
/**
|
|
|
* 企业请求
|
|
|
+ *
|
|
|
* @author suntg
|
|
|
* @date 2015年3月10日17:37:37
|
|
|
*/
|
|
|
@Controller
|
|
|
-@RequestMapping(value = "/signin")
|
|
|
+@RequestMapping(value = "/signup")
|
|
|
public class RegisterController {
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private EnterpriseService enterpriseService;
|
|
|
@Autowired
|
|
|
@@ -34,8 +35,14 @@ public class RegisterController {
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @RequestMapping(method = RequestMethod.GET)
|
|
|
+ public String getSignupPage() {
|
|
|
+ return "register";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 执照号是否可用
|
|
|
+ *
|
|
|
* @param code
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -43,28 +50,26 @@ public class RegisterController {
|
|
|
public ResponseEntity<String> bussinessCodeEnable(String code) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/text; charset=utf-8");
|
|
|
- return new ResponseEntity<String>(enterpriseService.bussinessCodeEnable(code),
|
|
|
- headers, HttpStatus.OK);
|
|
|
+ return new ResponseEntity<String>(enterpriseService.bussinessCodeEnable(code), headers, HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 注册新企业用户
|
|
|
*/
|
|
|
- @RequestMapping("/register.action")
|
|
|
- public @ResponseBody
|
|
|
- ResponseEntity<ModelMap> register(String enterprise, FileUpload uploadItem) {
|
|
|
+ @RequestMapping(method = RequestMethod.POST)
|
|
|
+ public @ResponseBody ResponseEntity<ModelMap> register(String enterprise, FileUpload uploadItem) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/json; charset=utf-8");
|
|
|
ModelMap map = new ModelMap();
|
|
|
- Enterprise newEnterprise = FlexJsonUtils.fromJson(enterprise, Enterprise.class);//需要把字符串转成Object
|
|
|
- Attach attach = attachService.upload(uploadItem, "bussinessCodeImg", "客户营业执照复印件或照片");//先保存上传到文件
|
|
|
- if(attach == null){//文件过大
|
|
|
+ Enterprise newEnterprise = FlexJsonUtils.fromJson(enterprise, Enterprise.class);// 需要把字符串转成Object
|
|
|
+ Attach attach = attachService.upload(uploadItem, "bussinessCodeImg", "客户营业执照复印件或照片");// 先保存上传到文件
|
|
|
+ if (attach == null) {// 文件过大
|
|
|
map.put("error", "文件过大");
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.FORBIDDEN);
|
|
|
- } else {//上传成功
|
|
|
+ } else {// 上传成功
|
|
|
newEnterprise.setEnBussinessCodeAttach(attach);
|
|
|
Enterprise regEnterprise = enterpriseService.registerEnterprise(newEnterprise);
|
|
|
- if(regEnterprise == null) {//营业执照码验证
|
|
|
+ if (regEnterprise == null) {// 营业执照码验证
|
|
|
map.put("error", "操作失败");
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.EXPECTATION_FAILED);
|
|
|
}
|
|
|
@@ -72,84 +77,78 @@ public class RegisterController {
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.OK);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 处理审核结果
|
|
|
*/
|
|
|
@RequestMapping(value = "/audit", method = RequestMethod.POST)
|
|
|
- public @ResponseBody
|
|
|
- ResponseEntity<ModelMap> aduit(Long uu, String result, String reason) {
|
|
|
+ public @ResponseBody ResponseEntity<ModelMap> aduit(Long uu, String result, String reason) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/json; charset=utf-8");
|
|
|
ModelMap map = new ModelMap();
|
|
|
- System.out.println(uu);
|
|
|
- System.out.println(result);
|
|
|
- System.out.println(reason);
|
|
|
String aduitReslt = enterpriseService.audit(uu, result, reason);
|
|
|
map.put("aduit", aduitReslt);
|
|
|
- if(aduitReslt.equals("ALLOW") || aduitReslt.equals("NOTALLOW")) {
|
|
|
+ if (aduitReslt.equals("ALLOW") || aduitReslt.equals("NOTALLOW")) {
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.OK);
|
|
|
} else {
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.EXPECTATION_FAILED);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 激活码验证激活
|
|
|
*/
|
|
|
@RequestMapping(value = "/activate", method = RequestMethod.POST)
|
|
|
- public @ResponseBody
|
|
|
- ResponseEntity<ModelMap> activateCheck(Long uu, String checkcode) {
|
|
|
+ public @ResponseBody ResponseEntity<ModelMap> activateCheck(Long uu, String checkcode) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/json; charset=utf-8");
|
|
|
ModelMap map = new ModelMap();
|
|
|
String checkReslt = enterpriseService.activateCheck(uu, checkcode);
|
|
|
map.put("result", checkReslt);
|
|
|
- if(checkReslt.equals("SUCCESS")) {//验证通过
|
|
|
+ if (checkReslt.equals("SUCCESS")) {// 验证通过
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.OK);
|
|
|
- } else {//验证不通过
|
|
|
+ } else {// 验证不通过
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.EXPECTATION_FAILED);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 设置管理员账号密码
|
|
|
*/
|
|
|
@RequestMapping(value = "/setAdminPassword", method = RequestMethod.POST)
|
|
|
- public @ResponseBody
|
|
|
- ResponseEntity<ModelMap> setAdminPassword(Long enuu, String password) {
|
|
|
+ public @ResponseBody ResponseEntity<ModelMap> setAdminPassword(Long enuu, String password) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/json; charset=utf-8");
|
|
|
ModelMap map = new ModelMap();
|
|
|
String result = enterpriseService.setAdminPassword(enuu, password);
|
|
|
map.put("result", result);
|
|
|
- if(result.equals("SUCCESS")) {//验证通过
|
|
|
+ if (result.equals("SUCCESS")) {// 验证通过
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.OK);
|
|
|
- } else {//验证不通过
|
|
|
+ } else {// 验证不通过
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.EXPECTATION_FAILED);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 重新发送激活邮件
|
|
|
*/
|
|
|
@RequestMapping(value = "/setEmailAgain", method = RequestMethod.GET)
|
|
|
- public @ResponseBody
|
|
|
- ResponseEntity<ModelMap> setActivateEmailAgain(Long enuu) {
|
|
|
+ public @ResponseBody ResponseEntity<ModelMap> setActivateEmailAgain(Long enuu) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/json; charset=utf-8");
|
|
|
ModelMap map = new ModelMap();
|
|
|
String result = enterpriseService.sendActivateEmail(enuu);
|
|
|
map.put("result", result);
|
|
|
- if(result.equals("SUCCESS")) {//验证通过
|
|
|
+ if (result.equals("SUCCESS")) {// 验证通过
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.OK);
|
|
|
- } else {//验证不通过
|
|
|
+ } else {// 验证不通过
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.EXPECTATION_FAILED);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 手机号是否可用
|
|
|
+ *
|
|
|
* @param tel
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -157,12 +156,12 @@ public class RegisterController {
|
|
|
public ResponseEntity<Boolean> telEnable(String tel) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/text; charset=utf-8");
|
|
|
- return new ResponseEntity<Boolean>(userService.isTelUseable(tel),
|
|
|
- headers, HttpStatus.OK);
|
|
|
+ return new ResponseEntity<Boolean>(userService.isTelUseable(tel), headers, HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 邮箱地址是否可用
|
|
|
+ *
|
|
|
* @param email
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -170,8 +169,7 @@ public class RegisterController {
|
|
|
public ResponseEntity<Boolean> emailEnable(String email) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/text; charset=utf-8");
|
|
|
- return new ResponseEntity<Boolean>(userService.isEmailUseable(email),
|
|
|
- headers, HttpStatus.OK);
|
|
|
+ return new ResponseEntity<Boolean>(userService.isEmailUseable(email), headers, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
}
|