ソースを参照

需求管理--个人用户新增需求(管理端)

Antiloveg 8 年 前
コミット
75cf07103c

+ 2 - 0
schema/2017-05-15.sql

@@ -0,0 +1,2 @@
+alter table `demand` 
+change column `release` `release_status` int(1) comment '是否发布(0-未发布,1-发布)';

+ 91 - 14
src/main/java/com/goafanti/admin/controller/AdminDemandApiController.java

@@ -1,18 +1,28 @@
 package com.goafanti.admin.controller;
 
+
 import javax.annotation.Resource;
+import javax.validation.Valid;
 
+import org.springframework.beans.BeanUtils;
+import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.DemandFields;
+import com.goafanti.common.enums.DemandReleaseStatus;
+import com.goafanti.common.model.Demand;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.demand.bo.InputDemand;
 import com.goafanti.demand.service.DemandService;
 
 @RestController
 @RequestMapping(value = "/api/admin/demand")
-public class AdminDemandApiController {
+public class AdminDemandApiController extends CertifyApiController {
 	@Resource
 	private DemandService demandService;
 
@@ -20,22 +30,87 @@ public class AdminDemandApiController {
 	 * 个人用户--需求列表
 	 */
 	@RequestMapping(value = "/userList", method = RequestMethod.GET)
-	public Result userList(String province, Integer serialNumber, String name, String keyword, Integer infoSources, Integer demandType,
-			String validityPeriodStartDate, String validityPeriodEndDate, String username, 
-			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, String pageNo,
-			String pageSize) {
+	public Result userList(String province, Integer serialNumber, String name, String keyword, Integer infoSources,
+			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, String username,
+			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate,
+			String pageNo, String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
-		
+
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		res.setData(demandService.selectUserDemandManageList(province, serialNumber, name, keyword, infoSources, demandType, validityPeriodStartDate, validityPeriodEndDate,
-				username, status, releaseStatus, releaseDateStartDate, releaseDateEndDate, pNo, pSize));
+		res.setData(demandService.selectUserDemandManageList(province, serialNumber, name, keyword, infoSources,
+				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
+				releaseDateStartDate, releaseDateEndDate, pNo, pSize));
+		return res;
+	}
+
+	/**
+	 * 个人用户新增需求
+	 */
+	@RequestMapping(value = "/userApply", method = RequestMethod.POST)
+	public Result userApply(@Valid InputDemand demand, BindingResult bindingResult, String validityPeriodFormattedDate) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+
+		if (StringUtils.isBlank(demand.getName())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(demand.getEmployerId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到雇主ID", "雇主ID"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(demand.getKeyword())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
+			return res;
+		}
+
+		if (null == demand.getInfoSources()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到信息来源", "信息来源"));
+			return res;
+		}
+
+		if (null == demand.getIndustryCategoryA()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到行业类别", "行业类别"));
+			return res;
+		}
+
+		if (null == demand.getDemandType()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求类型", "需求类型"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(demand.getProblemDes())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到问题说明", "问题说明"));
+			return res;
+		}
+
+		if (null == demand.getReleaseStatus()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到是否发布", "是否发布"));
+			return res;
+		}
+
+		if (!DemandReleaseStatus.RELEASED.getCode().equals(demand.getReleaseStatus())
+				&& !DemandReleaseStatus.UNRELEASE.getCode().equals(demand.getReleaseStatus())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "是否发布"));
+			return res;
+		}
+		
+		Demand d = new Demand();
+		BeanUtils.copyProperties(demand, d);
+		demandService.saveUserDemandByManager(d, validityPeriodFormattedDate);
 		return res;
 	}
 
@@ -43,21 +118,23 @@ public class AdminDemandApiController {
 	 * 组织用户--需求列表
 	 */
 	@RequestMapping(value = "/orgList", method = RequestMethod.GET)
-	public Result orgList(String province, Integer serialNumber, String name, String keyword, Integer infoSources, Integer demandType,
-			String validityPeriodStartDate, String validityPeriodEndDate, String username, 
-			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, String pageNo,
-			String pageSize) {
+	public Result orgList(String province, Integer serialNumber, String name, String keyword, Integer infoSources,
+			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, String username,
+			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate,
+			String pageNo, String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
-		
+
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		res.setData(demandService.selectOrgDemandManageList(province, serialNumber, name, keyword, infoSources, demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus, releaseDateStartDate, releaseDateEndDate, pNo, pSize));
+		res.setData(demandService.selectOrgDemandManageList(province, serialNumber, name, keyword, infoSources,
+				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
+				releaseDateStartDate, releaseDateEndDate, pNo, pSize));
 		return res;
 	}
 }

+ 17 - 0
src/main/java/com/goafanti/common/dao/DemandLogMapper.java

@@ -0,0 +1,17 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.DemandLog;
+
+public interface DemandLogMapper {
+    int deleteByPrimaryKey(String id);
+
+    int insert(DemandLog record);
+
+    int insertSelective(DemandLog record);
+
+    DemandLog selectByPrimaryKey(String id);
+
+    int updateByPrimaryKeySelective(DemandLog record);
+
+    int updateByPrimaryKey(DemandLog record);
+}

+ 56 - 0
src/main/java/com/goafanti/common/enums/DemandDataCategory.java

@@ -0,0 +1,56 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum DemandDataCategory {
+	
+	USERDEMAND(0, "个人用户需求"),
+	ORGDEMAND(1, "团体组织用户需求"),
+	OTHER(2, "其他");
+
+	private DemandDataCategory(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, DemandDataCategory> status = new HashMap<Integer, DemandDataCategory>();
+
+	static {
+		for (DemandDataCategory value : DemandDataCategory.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static DemandDataCategory getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static DemandDataCategory getStatus(String code) {
+		if (StringUtils.isNumeric(code)) {
+			return getStatus(Integer.parseInt(code));
+		}
+		return OTHER;
+	}
+
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+
+	private Integer	code;
+	private String	desc;
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

+ 84 - 0
src/main/java/com/goafanti/common/enums/DemandFields.java

@@ -0,0 +1,84 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum DemandFields {
+	
+	DATACATEGORY("dataCategory", "数据类别"),
+	NAME("name", "需求名称"),
+	KEYWORD("keyword", "关键词"),
+	INFOSOURCES("infoSources", "信息来源"),
+	
+	INDUSTRYCATEGORYA("industryCategoryA", "行业类别下拉A"),
+	INDUSTRYCATEGORYB("industryCategoryB", "行业类别下拉B"),
+	INDUSTRYCATEGORYC("industryCategoryC", "行业类别下拉C"),
+	DEMANDTYPE("demandType", "需求类型"),
+	PROBLEMDES("problemDes", "问题说明"),
+	
+	TECHNICALREQUIREMENTS("technicalRequirements", "技术指标要求"),
+	PICTUREURL("pictureUrl", "需求文件--图片URL"),
+	TEXTFILEURL("textFileUrl", "需求文件--文本文件"),
+	VIDEOURL("videoUrl", "需求文件--视屏文件URL"),
+	FIXEDBUDGET("fixedBudget", "固定预算"),
+	
+	FIXEDCYCLE("fixedCycle", "固定周期"),
+	PEOPLENUMBER("peopleNumber", "固定人数"),
+	FIXEDSCHEME("fixedScheme", "固定方案"),
+	COSTESCROW("costEscrow", "费用托管"),
+	BUDGETCOST("budgetCost", "预算费用"),
+	
+	EMPLOYERID("employerId", "雇主ID"),
+	EMPLOYERNAME("employerName", "雇主名称"),
+	EMPLOYERADDRESS("employerAddress", "雇主地址"),
+	EMPLOYERCONTACTS("employerContacts", "雇主联系人名称"),
+	EMPLOYERCONTACTSMOBILE("employerContactsMobile", "雇主联系人电话"),
+	
+	EMPLOYERCONTACTSMAILBOX("employerContactsMailbox", "雇主联系人邮箱"),
+	CONTACTS("contacts", "联系人&联系方式"),
+	STATUS("status", "需求状态"),
+	RELEASESTATUS("releaseStatus", "是否发布"),
+	PRINCIPALID("principalId", "营销人员ID"),
+	
+	OTHER("", "未知参数");
+	
+	private String	code;
+	private String	desc;
+	
+	private static Map<String, DemandFields> status = new HashMap<String, DemandFields>();
+	
+	private DemandFields(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+	
+	static {
+		for (DemandFields value : DemandFields.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+	
+	public static DemandFields getField(String code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+	
+	public static String getFieldDesc(String code) {
+		return getField(code).getDesc();
+	}
+
+	public static boolean containsType(String code) {
+		return status.containsKey(code);
+	}
+	
+	public String getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

+ 56 - 0
src/main/java/com/goafanti/common/enums/DemandReleaseStatus.java

@@ -0,0 +1,56 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum DemandReleaseStatus {
+	
+	UNRELEASE(0, "需求未发布"),
+	RELEASED(1, "需求已发布"),
+	OTHER(2, "其他");
+
+	private DemandReleaseStatus(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, DemandReleaseStatus> status = new HashMap<Integer, DemandReleaseStatus>();
+
+	static {
+		for (DemandReleaseStatus value : DemandReleaseStatus.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static DemandReleaseStatus getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static DemandReleaseStatus getStatus(String code) {
+		if (StringUtils.isNumeric(code)) {
+			return getStatus(Integer.parseInt(code));
+		}
+		return OTHER;
+	}
+
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+
+	private Integer	code;
+	private String	desc;
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

+ 117 - 0
src/main/java/com/goafanti/common/mapper/DemandLogMapper.xml

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.goafanti.common.dao.DemandLogMapper" >
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.DemandLog" >
+    <id column="id" property="id" jdbcType="VARCHAR" />
+    <result column="demand_id" property="demandId" jdbcType="VARCHAR" />
+    <result column="status" property="status" jdbcType="INTEGER" />
+    <result column="operator" property="operator" jdbcType="VARCHAR" />
+    <result column="principal" property="principal" jdbcType="VARCHAR" />
+    <result column="recored_time" property="recoredTime" jdbcType="TIMESTAMP" />
+    <result column="comment" property="comment" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, demand_id, status, operator, principal, recored_time, comment
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from demand_log
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from demand_log
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.DemandLog" >
+    insert into demand_log (id, demand_id, status, 
+      operator, principal, recored_time, 
+      comment)
+    values (#{id,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
+      #{operator,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{recoredTime,jdbcType=TIMESTAMP}, 
+      #{comment,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.DemandLog" >
+    insert into demand_log
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="demandId != null" >
+        demand_id,
+      </if>
+      <if test="status != null" >
+        status,
+      </if>
+      <if test="operator != null" >
+        operator,
+      </if>
+      <if test="principal != null" >
+        principal,
+      </if>
+      <if test="recoredTime != null" >
+        recored_time,
+      </if>
+      <if test="comment != null" >
+        comment,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="demandId != null" >
+        #{demandId,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null" >
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="operator != null" >
+        #{operator,jdbcType=VARCHAR},
+      </if>
+      <if test="principal != null" >
+        #{principal,jdbcType=VARCHAR},
+      </if>
+      <if test="recoredTime != null" >
+        #{recoredTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="comment != null" >
+        #{comment,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.DemandLog" >
+    update demand_log
+    <set >
+      <if test="demandId != null" >
+        demand_id = #{demandId,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null" >
+        status = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="operator != null" >
+        operator = #{operator,jdbcType=VARCHAR},
+      </if>
+      <if test="principal != null" >
+        principal = #{principal,jdbcType=VARCHAR},
+      </if>
+      <if test="recoredTime != null" >
+        recored_time = #{recoredTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="comment != null" >
+        comment = #{comment,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.DemandLog" >
+    update demand_log
+    set demand_id = #{demandId,jdbcType=VARCHAR},
+      status = #{status,jdbcType=INTEGER},
+      operator = #{operator,jdbcType=VARCHAR},
+      principal = #{principal,jdbcType=VARCHAR},
+      recored_time = #{recoredTime,jdbcType=TIMESTAMP},
+      comment = #{comment,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+</mapper>

+ 90 - 0
src/main/java/com/goafanti/common/model/DemandLog.java

@@ -0,0 +1,90 @@
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+public class DemandLog {
+    private String id;
+
+    /**
+    * 需求表主键
+    */
+    private String demandId;
+
+    /**
+    * 状态
+    */
+    private Integer status;
+
+    /**
+    * 操作人
+    */
+    private String operator;
+
+    private String principal;
+
+    /**
+    * 记录时间
+    */
+    private Date recoredTime;
+
+    /**
+    * 备注
+    */
+    private String comment;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getDemandId() {
+        return demandId;
+    }
+
+    public void setDemandId(String demandId) {
+        this.demandId = demandId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getPrincipal() {
+        return principal;
+    }
+
+    public void setPrincipal(String principal) {
+        this.principal = principal;
+    }
+
+    public Date getRecoredTime() {
+        return recoredTime;
+    }
+
+    public void setRecoredTime(Date recoredTime) {
+        this.recoredTime = recoredTime;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+}

+ 380 - 0
src/main/java/com/goafanti/demand/bo/InputDemand.java

@@ -0,0 +1,380 @@
+package com.goafanti.demand.bo;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Size;
+
+import com.goafanti.common.constant.ErrorConstants;
+
+public class InputDemand {
+    
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		id;
+	
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		dataCategory;
+	
+	@Size(min = 0, max = 32, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		name;
+	
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		keyword;
+	
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		infoSources;
+	
+	@Max(value = 99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		industryCategoryA;
+	
+	@Max(value = 99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		industryCategoryB;
+	
+	@Max(value = 99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		industryCategoryC;
+	
+	@Max(value = 9, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		demandType;
+	
+	@Size(min = 0, max = 256, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		problemDes;
+	
+	@Size(min = 0, max = 256, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		technicalRequirements;
+	
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		pictureUrl;
+	
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		textFileUrl;
+	
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		videoUrl;
+	
+	@Max(value = (long)999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private BigDecimal	fixedBudget;
+	
+	@Size(min = 0, max = 12, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		fixedCycle;
+	
+	@Max(value = 99999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		peopleNumber;
+	
+	@Size(min = 0, max = 200, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		fixedScheme;
+	
+	@Max(value = (long)999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private BigDecimal	costEscrow;
+	
+	@Max(value = (long)999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private BigDecimal	budgetCost;
+
+	private Date		validityPeriod;
+	
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		employerId;
+	
+	@Size(min = 0, max = 16, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		employerName;
+	
+	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		employerAddress;
+	
+	@Size(min = 0, max = 16, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		employerContacts;
+	
+	@Size(min = 0, max = 11, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		employerContactsMobile;
+	
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		employerContactsMailbox;
+	
+	@Max(value = 3, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		contacts;
+	
+	@Max(value = 2, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		status;
+	
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		releaseStatus;
+
+	private Date		releaseDate;
+
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		principalId;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+
+	public Integer getDataCategory() {
+		return dataCategory;
+	}
+
+	public void setDataCategory(Integer dataCategory) {
+		this.dataCategory = dataCategory;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getKeyword() {
+		return keyword;
+	}
+
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
+
+	public Integer getInfoSources() {
+		return infoSources;
+	}
+
+	public void setInfoSources(Integer infoSources) {
+		this.infoSources = infoSources;
+	}
+
+	public Integer getIndustryCategoryA() {
+		return industryCategoryA;
+	}
+
+	public void setIndustryCategoryA(Integer industryCategoryA) {
+		this.industryCategoryA = industryCategoryA;
+	}
+
+	public Integer getIndustryCategoryB() {
+		return industryCategoryB;
+	}
+
+	public void setIndustryCategoryB(Integer industryCategoryB) {
+		this.industryCategoryB = industryCategoryB;
+	}
+
+	public Integer getIndustryCategoryC() {
+		return industryCategoryC;
+	}
+
+	public void setIndustryCategoryC(Integer industryCategoryC) {
+		this.industryCategoryC = industryCategoryC;
+	}
+
+	public Integer getDemandType() {
+		return demandType;
+	}
+
+	public void setDemandType(Integer demandType) {
+		this.demandType = demandType;
+	}
+
+	public String getProblemDes() {
+		return problemDes;
+	}
+
+	public void setProblemDes(String problemDes) {
+		this.problemDes = problemDes;
+	}
+
+	public String getTechnicalRequirements() {
+		return technicalRequirements;
+	}
+
+	public void setTechnicalRequirements(String technicalRequirements) {
+		this.technicalRequirements = technicalRequirements;
+	}
+
+	public String getPictureUrl() {
+		return pictureUrl;
+	}
+
+	public void setPictureUrl(String pictureUrl) {
+		this.pictureUrl = pictureUrl;
+	}
+
+	public String getTextFileUrl() {
+		return textFileUrl;
+	}
+
+	public void setTextFileUrl(String textFileUrl) {
+		this.textFileUrl = textFileUrl;
+	}
+
+	public String getVideoUrl() {
+		return videoUrl;
+	}
+
+	public void setVideoUrl(String videoUrl) {
+		this.videoUrl = videoUrl;
+	}
+
+	public BigDecimal getFixedBudget() {
+		return fixedBudget;
+	}
+
+	public void setFixedBudget(BigDecimal fixedBudget) {
+		this.fixedBudget = fixedBudget;
+	}
+
+	public String getFixedCycle() {
+		return fixedCycle;
+	}
+
+	public void setFixedCycle(String fixedCycle) {
+		this.fixedCycle = fixedCycle;
+	}
+
+	public Integer getPeopleNumber() {
+		return peopleNumber;
+	}
+
+	public void setPeopleNumber(Integer peopleNumber) {
+		this.peopleNumber = peopleNumber;
+	}
+
+	public String getFixedScheme() {
+		return fixedScheme;
+	}
+
+	public void setFixedScheme(String fixedScheme) {
+		this.fixedScheme = fixedScheme;
+	}
+
+	public BigDecimal getCostEscrow() {
+		return costEscrow;
+	}
+
+	public void setCostEscrow(BigDecimal costEscrow) {
+		this.costEscrow = costEscrow;
+	}
+
+	public BigDecimal getBudgetCost() {
+		return budgetCost;
+	}
+
+	public void setBudgetCost(BigDecimal budgetCost) {
+		this.budgetCost = budgetCost;
+	}
+
+	public Date getValidityPeriod() {
+		return validityPeriod;
+	}
+
+	public void setValidityPeriod(Date validityPeriod) {
+		this.validityPeriod = validityPeriod;
+	}
+
+	public String getEmployerId() {
+		return employerId;
+	}
+
+	public void setEmployerId(String employerId) {
+		this.employerId = employerId;
+	}
+
+	public String getEmployerName() {
+		return employerName;
+	}
+
+	public void setEmployerName(String employerName) {
+		this.employerName = employerName;
+	}
+
+	public String getEmployerAddress() {
+		return employerAddress;
+	}
+
+	public void setEmployerAddress(String employerAddress) {
+		this.employerAddress = employerAddress;
+	}
+
+	public String getEmployerContacts() {
+		return employerContacts;
+	}
+
+	public void setEmployerContacts(String employerContacts) {
+		this.employerContacts = employerContacts;
+	}
+
+	public String getEmployerContactsMobile() {
+		return employerContactsMobile;
+	}
+
+	public void setEmployerContactsMobile(String employerContactsMobile) {
+		this.employerContactsMobile = employerContactsMobile;
+	}
+
+	public String getEmployerContactsMailbox() {
+		return employerContactsMailbox;
+	}
+
+	public void setEmployerContactsMailbox(String employerContactsMailbox) {
+		this.employerContactsMailbox = employerContactsMailbox;
+	}
+
+	public Integer getContacts() {
+		return contacts;
+	}
+
+	public void setContacts(Integer contacts) {
+		this.contacts = contacts;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Integer getReleaseStatus() {
+		return releaseStatus;
+	}
+
+	public void setReleaseStatus(Integer releaseStatus) {
+		this.releaseStatus = releaseStatus;
+	}
+
+	public Date getReleaseDate() {
+		return releaseDate;
+	}
+
+	public void setReleaseDate(Date releaseDate) {
+		this.releaseDate = releaseDate;
+	}
+
+	public String getPrincipalId() {
+		return principalId;
+	}
+
+	public void setPrincipalId(String principalId) {
+		this.principalId = principalId;
+	}
+	
+	
+
+}

+ 5 - 0
src/main/java/com/goafanti/demand/service/DemandLogService.java

@@ -0,0 +1,5 @@
+package com.goafanti.demand.service;
+
+public interface DemandLogService {
+
+}

+ 3 - 0
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -1,5 +1,6 @@
 package com.goafanti.demand.service;
 
+import com.goafanti.common.model.Demand;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.demand.bo.DemandManageListBo;
 
@@ -15,4 +16,6 @@ public interface DemandService {
 			String validityPeriodEndDate, String username, Integer status, Integer releaseStatus, String releaseDateStartDate,
 			String releaseDateEndDate, Integer pNo, Integer pSize);
 
+	void saveUserDemandByManager(Demand d, String validityPeriodFormattedDate);
+
 }

+ 12 - 0
src/main/java/com/goafanti/demand/service/impl/DemandLogServiceImpl.java

@@ -0,0 +1,12 @@
+package com.goafanti.demand.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.common.dao.DemandLogMapper;
+import com.goafanti.demand.service.DemandLogService;
+@Service
+public class DemandLogServiceImpl implements DemandLogService {
+	@Autowired
+	private DemandLogMapper demandLogMapper;
+}

+ 45 - 1
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -1,18 +1,25 @@
 package com.goafanti.demand.service.impl;
 
 import java.text.ParseException;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.DemandLogMapper;
 import com.goafanti.common.dao.DemandMapper;
+import com.goafanti.common.enums.DeleteStatus;
+import com.goafanti.common.enums.DemandDataCategory;
+import com.goafanti.common.enums.DemandReleaseStatus;
+import com.goafanti.common.model.Demand;
+import com.goafanti.common.model.DemandLog;
 import com.goafanti.common.utils.DateUtils;
-import com.goafanti.contract.bo.ContractManageListBo;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -23,6 +30,8 @@ import com.goafanti.demand.service.DemandService;
 public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements DemandService {
 	@Autowired
 	private DemandMapper demandMapper;
+	@Autowired
+	private DemandLogMapper demandLogMapper;
 
 	@SuppressWarnings("unchecked")
 	@Override
@@ -248,4 +257,39 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		return (Pagination<DemandManageListBo>) findPage("findManageOrgDemandListByPage", "findManageOrgDemandCount",
 				params, pNo, pSize);
 	}
+
+	@Override
+	public void saveUserDemandByManager(Demand d, String validityPeriodFormattedDate) {
+		Date validityPeriod = null;
+		if (!StringUtils.isBlank(validityPeriodFormattedDate)){
+			try {
+				validityPeriod = DateUtils.parseDate(validityPeriodFormattedDate, AFTConstants.YYYYMMDD);
+			} catch (ParseException e) {
+			}
+		}
+		
+		d.setValidityPeriod(validityPeriod);
+		d.setId(UUID.randomUUID().toString());
+		
+		d.setDataCategory(DemandDataCategory.USERDEMAND.getCode());
+		d.setDeletedSign(DeleteStatus.UNDELETE.getCode());
+		
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		
+		
+		if (DemandReleaseStatus.RELEASED.getCode().equals(d.getReleaseStatus())){
+			d.setReleaseDate(now.getTime());
+			DemandLog log = new DemandLog();
+			log.setId(UUID.randomUUID().toString());
+			log.setDemandId(d.getId());
+			log.setStatus(d.getStatus());
+			log.setRecoredTime(now.getTime());
+			log.setOperator(TokenManager.getAdminId());
+			demandLogMapper.insert(log);
+		}
+		
+		d.setCreateTime(now.getTime());
+		demandMapper.insert(d);
+	}
 }