Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

master
jianjun 5 years ago
parent
commit
7d881f1a40
  1. 5
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/advice/controller/AdviceController.java
  2. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java
  3. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java

5
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/advice/controller/AdviceController.java

@ -1,6 +1,5 @@
package com.epmet.modules.advice.controller;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.MyAdviceListFormDTO;
@ -14,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @description: 用户建议controller
@ -27,9 +25,6 @@ public class AdviceController {
@Autowired
private AdviceService adviceService;
@Autowired
private LoginUserUtil loginUserUtil;
/**
* @Description 提交建议
* @param dto

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;
@ -36,6 +37,7 @@ public class SubmitAdviceFormDTO implements Serializable {
/**
* 电话号码可为空 *不为空需校验
*/
@Pattern(regexp = "^1[3456789]\\d{9}$", message = "请输入正确的手机号")
private String phone;
/**

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java

@ -25,8 +25,8 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.UserAdviceDTO;
import com.epmet.dto.form.AdviceListFormDTO;
import com.epmet.dto.form.MyAdviceListFormDTO;
@ -47,7 +47,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
@ -181,11 +180,7 @@ public class UserAdviceController {
@PostMapping("submitadvice")
public Result submitAdvice(@RequestBody SubmitAdviceFormDTO dto){
ValidatorUtils.validateEntity(dto);
if (StringUtils.isNotBlank(dto.getPhone())){
if (!Pattern.matches("^1[3456789]\\d{9}$",dto.getPhone())){
throw new RenException("手机号格式错误");
}
}else {
if (StringUtils.isBlank(dto.getPhone())) {
dto.setPhone("*");
}
userAdviceService.submitAdvice(dto,loginUserUtil.getLoginUserId());

Loading…
Cancel
Save