diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/TagScopeDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/TagScopeDTO.java index e5bf3d021a..8eacc3441e 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/TagScopeDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/TagScopeDTO.java @@ -1,7 +1,9 @@ package com.epmet.dto; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -11,6 +13,8 @@ import java.io.Serializable; */ @Data public class TagScopeDTO implements Serializable { + public interface AddUserShowGroup extends CustomerClientShowGroup { + } /** * 标签ID */ @@ -19,10 +23,12 @@ public class TagScopeDTO implements Serializable { /** * 应用范围,这里只能是社区id */ + @NotBlank(message = "agencyId不能为空",groups = AddUserShowGroup.class) private String agencyId; /** * agency_id全路径,包含自身 */ + @NotBlank(message = "orgIdPath不能为空",groups = AddUserShowGroup.class) private String orgIdPath; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java index d1964ece10..a23f93d4a0 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java @@ -6,11 +6,13 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.TagCustomerDTO; +import com.epmet.dto.TagScopeDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.CorrelationTagListResultDTO; import com.epmet.dto.result.TagInfoResultDTO; import com.epmet.service.TagCustomerService; import com.epmet.service.TagService; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -103,6 +105,9 @@ public class TagController { @PostMapping("save") public Result save(@LoginUser TokenDto tokenDto,@RequestBody TagCustomerFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); + if(CollectionUtils.isNotEmpty(formDTO.getAgencyList())){ + ValidatorUtils.validateEntity(formDTO.getAgencyList(), TagScopeDTO.AddUserShowGroup.class); + } ValidatorUtils.validateEntity(formDTO,TagCustomerFormDTO.AddUserShowGroup.class,TagCustomerFormDTO.AddUserInternalGroup.class); tagCustomerService.save(formDTO); return new Result(); @@ -117,6 +122,9 @@ public class TagController { @PostMapping("update") public Result update(@LoginUser TokenDto tokenDto,@RequestBody TagCustomerFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); + if(CollectionUtils.isNotEmpty(formDTO.getAgencyList())){ + ValidatorUtils.validateEntity(formDTO.getAgencyList(), TagScopeDTO.AddUserShowGroup.class); + } ValidatorUtils.validateEntity(formDTO,TagCustomerFormDTO.UpdateUserShowGroup.class,TagCustomerFormDTO.UpdateUserInternalGroup.class); tagCustomerService.update(formDTO); return new Result();