|
|
@@ -2,12 +2,16 @@ package com.uas.platform.b2b.controller;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
@@ -17,6 +21,8 @@ import com.uas.platform.b2b.service.UserService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.b2b.support.UsageBufferedLogger;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
+import com.uas.platform.core.util.encry.Md5Utils;
|
|
|
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
|
|
|
/**
|
|
|
* 企业请求
|
|
|
@@ -86,5 +92,40 @@ public class UserController {
|
|
|
map.put("username", SystemSession.getUser().getUserName());
|
|
|
return new ResponseEntity<ModelMap>(map, headers, HttpStatus.OK);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户基本信息
|
|
|
+ * @param email
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/saveUser", method = RequestMethod.POST)
|
|
|
+ public ResponseEntity<String> saveUser(@RequestBody String json, HttpServletRequest request) {
|
|
|
+ User user = FlexJsonUtils.fromJson(json, User.class);
|
|
|
+ user = userService.updateUserInfo(user);
|
|
|
+ if(user != null) {
|
|
|
+ logger.log("用户信息", "修改用户信息,UU:" + user.getUserUU());
|
|
|
+ request.getSession().setAttribute("user", user);
|
|
|
+ }
|
|
|
+ return new ResponseEntity<String>(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户基本信息
|
|
|
+ * @param email
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/checkPassword", method = RequestMethod.GET)
|
|
|
+ public ResponseEntity<String> checkPassword(String password) {
|
|
|
+ User user = SystemSession.getUser();
|
|
|
+ System.out.println(user.getUserPwd());
|
|
|
+ if(!StringUtils.isEmpty(password)) {
|
|
|
+ boolean result = user.getUserPwd().equals(Md5Utils.encode(password, user.getUserUU()));
|
|
|
+ if(result) {
|
|
|
+ return new ResponseEntity<String>(HttpStatus.OK);
|
|
|
+ }
|
|
|
+ logger.log("用户信息", "验证用户密码,UU:" + user.getUserUU());
|
|
|
+ }
|
|
|
+ return new ResponseEntity<String>(HttpStatus.EXPECTATION_FAILED);
|
|
|
+ }
|
|
|
|
|
|
}
|