浏览代码

增加同步创建人员接口

lixing 4 年之前
父节点
当前提交
5ff872dea5

+ 9 - 1
fm-person/src/main/java/com/persagy/fm/person/controller/PersonController.java

@@ -47,7 +47,15 @@ public class PersonController {
     @ApiOperation(value = "创建人员")
     @PostMapping("/create")
     public CommonResult<FmResponseUpsertVO> createPerson(
-            @Valid @RequestBody AddPersonDTO addPersonDTO) {
+            @Validated({AddPersonValidationGroup.class}) @RequestBody AddPersonDTO addPersonDTO) {
+        String id = personService.createPerson(addPersonDTO);
+        return ResultHelper.single(new FmResponseUpsertVO(id));
+    }
+
+    @ApiOperation(value = "同步创建人员")
+    @PostMapping("/sync_create")
+    public CommonResult<FmResponseUpsertVO> syncCreatePerson(
+            @Validated({SyncAddPersonValidationGroup.class}) @RequestBody AddPersonDTO addPersonDTO) {
         String id = personService.createPerson(addPersonDTO);
         return ResultHelper.single(new FmResponseUpsertVO(id));
     }

+ 4 - 3
fm-person/src/main/java/com/persagy/fm/person/model/dto/UpsertPersonDTO.java

@@ -24,7 +24,7 @@ import java.util.List;
 @Data
 public class UpsertPersonDTO {
     @ApiModelProperty(value = "姓名", required = true)
-    @NotNull(message = "姓名不能为空")
+    @NotEmpty(message = "姓名不能为空")
     @Length(max = 20, message = "姓名长度不能大于20")
     @Pattern(regexp = RegexConstants.ALL_REGEX, message = "姓名" + RegexConstants.ALL_REGEX_WARNING)
     private String name;
@@ -68,7 +68,8 @@ public class UpsertPersonDTO {
     @ApiModelProperty(value = "所属部门id", required = true)
     private List<String> depIds;
 
-    @ApiModelProperty(value = "关联的项目", required = true)
+    @ApiModelProperty(value = "项目权限", required = true)
+    @NotEmpty(message = "项目权限不能为空", groups = {AddPersonValidationGroup.class})
     private List<UpsertSaasProjectDTO> projects;
 
     @ApiModelProperty(value = "主岗")
@@ -89,7 +90,7 @@ public class UpsertPersonDTO {
     @Pattern(regexp = RegexConstants.EN_NUM_CHAR_REGEX, message = "账号" + RegexConstants.EN_NUM_CHAR_REGEX_WARNING)
     @Length(max = 30, message = "账号长度不能大于30")
     @ApiModelProperty(value = "账号", required = true)
-    @NotNull(message = "账号不能为空")
+    @NotEmpty(message = "账号不能为空")
     private String username;
 
     @ApiModelProperty("登录权限(年.月.日)")