|
|
@@ -5,6 +5,9 @@ import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
|
@@ -113,9 +116,19 @@ public class AppUserController extends CertifyApiController {
|
|
|
@RequestMapping(value = "/updateUser",method = RequestMethod.POST)
|
|
|
public Result updateUser(User u){
|
|
|
Result res = new Result();
|
|
|
- if(StringUtils.isBlank(u.getNickname())){
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"用户昵称不能为空"));
|
|
|
- return res;
|
|
|
+ if(u!=null&&StringUtils.isNotEmpty(u.getMobile())){
|
|
|
+ //验证手机号码格式是否正确
|
|
|
+ Pattern p = Pattern.compile("^(1[1-9][0-9])\\d{8}$"); // 验证手机号
|
|
|
+ Matcher m = p.matcher(u.getMobile());
|
|
|
+ if(!m.matches()){
|
|
|
+ res.getError().add(buildError("电话号码格式不对","电话号码格式不对"));
|
|
|
+ }else{
|
|
|
+ //验证手机是否存在
|
|
|
+ int i = userService.getCountByMobile(u.getId(),u.getMobile(),u.getType());
|
|
|
+ if(i>0){
|
|
|
+ res.getError().add(buildError("电话号码重复","电话号码重复"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
u.setId(TokenManager.getUserId());
|
|
|
userServiceImpl.updateByPrimaryKeySelective(u);
|
|
|
@@ -862,4 +875,13 @@ public class AppUserController extends CertifyApiController {
|
|
|
result.setData(messageService.updateAppReadMessage(id));
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /** 图片上传 **/
|
|
|
+ @RequestMapping(value = "/uploadHeadPortrait", method = RequestMethod.POST)
|
|
|
+ public Result uploadCustomerImg(HttpServletRequest req,String sign){
|
|
|
+ Result res = new Result();
|
|
|
+ res.setData(handleFile(res, "/customer_head_portrait/", false, req, sign));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
}
|