|
@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* Created by Reece on 2017/5/6.
|
|
|
*/
|
|
@ -46,25 +44,25 @@ public class PatientFeedbackController extends BaseController {
|
|
|
@RequestParam(required = false) String images,
|
|
|
@RequestParam(required = false) String contact) {
|
|
|
try {
|
|
|
if (StringUtils.isNotEmpty(contact)) {
|
|
|
// 邮箱正则|QQ号正则|手机号正则
|
|
|
String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
|
|
|
String regexQQ = "^[1-9][0-9]{4,}$";
|
|
|
String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
|
|
|
Boolean emailFlag = Pattern.matches(regexEmail, contact);
|
|
|
Boolean qqFlag = Pattern.matches(regexQQ, contact);
|
|
|
Boolean phoneFlag = Pattern.matches(regexPhone, contact);
|
|
|
if (emailFlag || qqFlag || phoneFlag) {
|
|
|
return write(-1, "QQ/邮箱/手机号格式错误!");
|
|
|
}
|
|
|
}
|
|
|
//if (StringUtils.isNotEmpty(contact)) {
|
|
|
// // 邮箱正则|QQ号正则|手机号正则
|
|
|
// String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
|
|
|
// String regexQQ = "^[1-9][0-9]{4,}$";
|
|
|
// String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
|
|
|
// Boolean emailFlag = Pattern.matches(regexEmail, contact);
|
|
|
// Boolean qqFlag = Pattern.matches(regexQQ, contact);
|
|
|
// Boolean phoneFlag = Pattern.matches(regexPhone, contact);
|
|
|
// if (emailFlag || qqFlag || phoneFlag) {
|
|
|
// return write(-1, "QQ/邮箱/手机号格式错误!");
|
|
|
// }
|
|
|
//}
|
|
|
// 图片上传
|
|
|
if (StringUtils.isNotEmpty(images)) {
|
|
|
images = CommonUtil.copyTempImage(images);
|
|
|
|
|
|
}
|
|
|
// 保存到数据库
|
|
|
feedbackService.saveFeedback(getUID(),description,type,images,contact,1);
|
|
|
feedbackService.saveFeedback(getUID(),1,description,type,images,contact);
|
|
|
return write(200, "保存成功!");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
@ -91,8 +89,8 @@ public class PatientFeedbackController extends BaseController {
|
|
|
@RequestParam String phone) {
|
|
|
try {
|
|
|
// 手机号正则
|
|
|
String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
|
|
|
if (Pattern.matches(regex, phone)) {
|
|
|
// String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
|
|
|
// if (Pattern.matches(regex, phone)) {
|
|
|
// 图片上传
|
|
|
if (StringUtils.isNotEmpty(images)) {
|
|
|
images = CommonUtil.copyTempImage(images);
|
|
@ -100,9 +98,9 @@ public class PatientFeedbackController extends BaseController {
|
|
|
// 保存到数据库
|
|
|
appealService.saveAppeal(getUID(),description,type,images,phone,1);
|
|
|
return write(200, "保存成功!");
|
|
|
} else {
|
|
|
return write(-1, "手机号码有误!");
|
|
|
}
|
|
|
//} else {
|
|
|
// return write(-1, "手机号码有误!");
|
|
|
//}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "保存失败!");
|