|
@@ -1,12 +1,15 @@
|
|
|
package com.mooctest.crowd.site.command;
|
|
|
|
|
|
import com.mooctest.crowd.domain.domainobject.EvaluationAgency;
|
|
|
+import com.mooctest.crowd.domain.domainobject.EvaluationAgencyAbility;
|
|
|
import com.mooctest.crowd.domain.factory.UserFactory;
|
|
|
import lombok.Data;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import javax.validation.constraints.Pattern;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author: Diors.Po
|
|
@@ -15,15 +18,6 @@ import javax.validation.constraints.Pattern;
|
|
|
*/
|
|
|
@Data
|
|
|
public class ApplyAgencyAuthCommand {
|
|
|
-
|
|
|
- @NotNull(message = "邮箱不可为空")
|
|
|
- @Pattern(regexp = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$", message = "邮箱非法")
|
|
|
- private String email;
|
|
|
-
|
|
|
- @NotNull(message = "手机号不可为空")
|
|
|
- @Pattern(regexp = "^1[3|4|5|7|8][0-9]\\d{4,8}$", message = "手机号非法")
|
|
|
- private String mobile;
|
|
|
-
|
|
|
@NotNull(message = "机构名称不可为空")
|
|
|
private String evaluationAgencyName;
|
|
|
@NotNull(message = "银行卡号不可为空")
|
|
@@ -31,15 +25,17 @@ public class ApplyAgencyAuthCommand {
|
|
|
@NotNull(message = "机构地址不可为空")
|
|
|
private String address;
|
|
|
@NotNull(message = "评测能力不可为空")
|
|
|
- private String abilities;
|
|
|
+ private List<String> evaluationAgencyAbilityList;
|
|
|
@NotNull(message = "机构资源不可为空")
|
|
|
- private String resources;
|
|
|
+ private List<AgencyResourceCommand> evaluationAgencyResourceList;
|
|
|
@NotNull(message = "LOGO不可为空")
|
|
|
private String agencyPhoto;
|
|
|
|
|
|
public EvaluationAgency toAgency(){
|
|
|
EvaluationAgency agency = UserFactory.defaultAgency();
|
|
|
- BeanUtils.copyProperties(this, agency);
|
|
|
+ BeanUtils.copyProperties(this, agency, "evaluationAgencyAbilityList", "evaluationAgencyResourceList");
|
|
|
+ agency.setEvaluationAgencyAbilityList(this.evaluationAgencyAbilityList.stream().map(EvaluationAgencyAbility::new).collect(Collectors.toList()));
|
|
|
+ agency.setEvaluationAgencyResourceList(this.evaluationAgencyResourceList.stream().map(AgencyResourceCommand::toAgencyResource).collect(Collectors.toList()));
|
|
|
agency.setIsDeleted(0);
|
|
|
agency.setIsAuthentication(0);
|
|
|
return agency;
|