|
|
@@ -1,24 +1,93 @@
|
|
|
package com.mooctest.crowd.site.command;
|
|
|
|
|
|
+import com.mooctest.crowd.domain.domainobject.CrowdTestProject;
|
|
|
+
|
|
|
+import com.mooctest.crowd.domain.factory.CrowdTestProjectFactory;
|
|
|
import lombok.Data;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
-import java.io.File;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+import javax.validation.constraints.Pattern;
|
|
|
+import java.sql.Date;
|
|
|
+import java.sql.Timestamp;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
- * @author guochao
|
|
|
- * @date 2019/7/6 18:50
|
|
|
+ * @author: Diors.Po
|
|
|
+ * @Email: 171256175@qq.com
|
|
|
+ * @date 2019-07-25 14:37
|
|
|
*/
|
|
|
@Data
|
|
|
public class CrowdTestProjectCommand {
|
|
|
- private Long id;
|
|
|
+ @NotNull(message = "UserId不可为空")
|
|
|
+ private Long userId;
|
|
|
+
|
|
|
+ @NotNull(message = "项目名称不可为空")
|
|
|
private String name;
|
|
|
- private Long ownerId;
|
|
|
- private Long managerId;
|
|
|
- private Long distributeId;
|
|
|
- private String description;
|
|
|
- private File projectFile;
|
|
|
- private File requirement;
|
|
|
- private Double quotedPrice;
|
|
|
- private Double fixedPrice;
|
|
|
- private String status;
|
|
|
+
|
|
|
+ @NotNull(message = "项目服务类型不可为空")
|
|
|
+ private String type;
|
|
|
+
|
|
|
+ private String platform;
|
|
|
+
|
|
|
+ @NotNull(message = "项目描述不可为空")
|
|
|
+ private String desc;
|
|
|
+
|
|
|
+ @NotNull(message = "可见性选择不可为空")
|
|
|
+ private Long resource;
|
|
|
+
|
|
|
+ private Map<String, String> location;
|
|
|
+
|
|
|
+ private Long institution;
|
|
|
+
|
|
|
+ @NotNull(message = "项目联系人不可为空")
|
|
|
+ private String contactName;
|
|
|
+
|
|
|
+ @NotNull(message = "项目联系人电话不可为空")
|
|
|
+ @Pattern(regexp = "^[0-9]{11}$", message = "Mobile number is illegal")
|
|
|
+ private String contactPhone;
|
|
|
+
|
|
|
+ @NotNull(message = "请上传需求文档")
|
|
|
+ private String doc;
|
|
|
+
|
|
|
+ @NotNull(message = "请上传应用apk")
|
|
|
+ private String file;
|
|
|
+
|
|
|
+ @NotNull(message = "请填写预算价格")
|
|
|
+ private Double budget;
|
|
|
+
|
|
|
+ private Timestamp datetime;
|
|
|
+
|
|
|
+ private String usage;
|
|
|
+
|
|
|
+ private Double price;
|
|
|
+
|
|
|
+ public CrowdTestProject toCrowdProject(){
|
|
|
+ CrowdTestProject crowdTestProject = CrowdTestProjectFactory.createCrowdTestProject();
|
|
|
+ crowdTestProject.setUserId(this.userId);
|
|
|
+ crowdTestProject.setName(this.name);
|
|
|
+ crowdTestProject.setLinkMan(this.contactName);
|
|
|
+ crowdTestProject.setLinkManMobile(this.contactPhone);
|
|
|
+ crowdTestProject.setType(this.type);
|
|
|
+ crowdTestProject.setPlatform(this.platform);
|
|
|
+ crowdTestProject.setDescription(this.desc);
|
|
|
+ crowdTestProject.setRequirementFile(this.doc);
|
|
|
+ crowdTestProject.setProjectFile(this.file);
|
|
|
+ crowdTestProject.setProjectDistributionTypeId(this.resource);
|
|
|
+ crowdTestProject.setDistributionProvince(this.location.get("provinceCode"));
|
|
|
+ crowdTestProject.setDistributionCity(this.location.get("cityCode"));
|
|
|
+ crowdTestProject.setRegionalManagerId(this.getInstitution());
|
|
|
+ crowdTestProject.setDeadTime(this.datetime);
|
|
|
+ crowdTestProject.setQuotedPrice(this.budget);
|
|
|
+ crowdTestProject.setFixedPrice(this.price);
|
|
|
+ return crowdTestProject;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isLegal(){
|
|
|
+ if (this.resource == 1 && this.location == null)
|
|
|
+ return false;
|
|
|
+ else if (this.resource == 0 && this.institution == null)
|
|
|
+ return false;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|