Browse Source

1.update 需求新增&&修改;
2.审核员--获取技术经纪人

Antiloveg 8 years ago
parent
commit
3be7cbf707

+ 3 - 0
schema/2017-05-22.sql

@@ -0,0 +1,3 @@
+alter TABLE `demand`
+add column `audit_status` int(1) null comment'审核状态(0--未提交审核草稿,1,--提交审核,2--审核中,3--审核通过,4--审核未通过)',
+add column `tech_broker_id` varchar(36) null comment'技术经纪人ID';

+ 2 - 1
schema/role_init.sql

@@ -4,4 +4,5 @@ VALUES ('2', '地区管理员', 99999),
 VALUES ('3', '审核员', 9999),
 VALUES ('4', '客户经理', 4),
 VALUES ('5', '营销经理', 5),
-VALUES ('6', '营销员', 6);
+VALUES ('6', '营销员', 6),
+VALUES ('7', '技术经纪人', 7);

+ 3 - 4
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -20,7 +20,6 @@ import com.goafanti.common.enums.AchievementReleaseStatus;
 import com.goafanti.common.enums.AchievementStatus;
 import com.goafanti.common.enums.DeleteStatus;
 import com.goafanti.common.enums.DemandReleaseStatus;
-import com.goafanti.common.enums.DemandStatus;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -78,9 +77,9 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			a.setStatus(AchievementStatus.ONGOING.getCode());
 		}
 
-		if (DemandReleaseStatus.UNRELEASE.getCode().equals(a.getReleaseStatus())
-				&& DemandReleaseStatus.RELEASED.getCode().equals(aa.getReleaseStatus())) {
-			a.setStatus(DemandStatus.CREATE.getCode());
+		if (AchievementReleaseStatus.UNRELEASE.getCode().equals(a.getReleaseStatus())
+				&& AchievementReleaseStatus.RELEASED.getCode().equals(aa.getReleaseStatus())) {
+			a.setStatus(AchievementStatus.CREATE.getCode());
 			achievementMapper.updateReleaseDate(aa.getId());
 		}
 		return achievementMapper.updateByPrimaryKeySelective(a);

+ 41 - 0
src/main/java/com/goafanti/admin/controller/AdminAuditApiController.java

@@ -0,0 +1,41 @@
+package com.goafanti.admin.controller;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.admin.service.AdminService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.demand.service.DemandService;
+
+@RestController
+@RequestMapping(value = "/api/admin/audit")
+public class AdminAuditApiController extends CertifyApiController {
+	@Resource
+	private AdminService adminService;
+	@Resource
+	private DemandService demandService;
+
+
+	/**
+	 * 审核员--获取技术经纪人
+	 */
+	@RequestMapping(value = "/techBroders", method = RequestMethod.GET)
+	public Result getTechBroders() {
+		Result res = new Result();
+		res.setData(adminService.selectTechBroder());
+		return res;
+	}
+
+	/**
+	 * 科技需求详情
+	 */
+	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
+	public Result demandDetail() {
+		Result res = new Result();
+		return res;
+	}
+}

+ 52 - 25
src/main/java/com/goafanti/admin/controller/AdminDemandApiController.java

@@ -18,6 +18,7 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.enums.AttachmentType;
+import com.goafanti.common.enums.DemandAuditStatus;
 import com.goafanti.common.enums.DemandDataCategory;
 import com.goafanti.common.enums.DemandFields;
 import com.goafanti.common.model.Demand;
@@ -33,15 +34,15 @@ public class AdminDemandApiController extends CertifyApiController {
 	private DemandService	demandService;
 	@Resource
 	private UserService		userService;
-	
+
 	/**
 	 * 个人用户--需求列表
 	 */
 	@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(Integer auditStatus, 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;
@@ -52,20 +53,20 @@ public class AdminDemandApiController extends CertifyApiController {
 		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(auditStatus, province, serialNumber, name, keyword,
+				infoSources, demandType, validityPeriodStartDate, validityPeriodEndDate, username, status,
+				releaseStatus, releaseDateStartDate, releaseDateEndDate, pNo, pSize));
 		return res;
 	}
-	
+
 	/**
 	 * 组织用户--需求列表
 	 */
 	@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(Integer auditStatus, 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;
@@ -76,12 +77,12 @@ public class AdminDemandApiController extends CertifyApiController {
 		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(auditStatus, province, serialNumber, name, keyword,
+				infoSources, demandType, validityPeriodStartDate, validityPeriodEndDate, username, status,
+				releaseStatus, releaseDateStartDate, releaseDateEndDate, pNo, pSize));
 		return res;
 	}
-	
+
 	/**
 	 * 新增需求
 	 */
@@ -94,6 +95,7 @@ public class AdminDemandApiController extends CertifyApiController {
 					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 		}
+
 		res = disposeDemand(res, demand);
 		if (!res.getError().isEmpty()) {
 			return res;
@@ -104,7 +106,7 @@ public class AdminDemandApiController extends CertifyApiController {
 		demandService.saveUserDemand(d, validityPeriodFormattedDate);
 		return res;
 	}
-	
+
 	/**
 	 * 个人需求详情
 	 */
@@ -120,7 +122,7 @@ public class AdminDemandApiController extends CertifyApiController {
 		res.setData(demandService.selectUserDemandDetail(id));
 		return res;
 	}
-	
+
 	/**
 	 * 组织用户详情
 	 */
@@ -136,7 +138,7 @@ public class AdminDemandApiController extends CertifyApiController {
 		res.setData(demandService.selectOrgDemandDetail(id));
 		return res;
 	}
-	
+
 	/**
 	 * 需求管理--获取个人用户下拉
 	 */
@@ -146,7 +148,7 @@ public class AdminDemandApiController extends CertifyApiController {
 		res.setData(userService.selectDemandUserNames());
 		return res;
 	}
-	
+
 	/**
 	 * 需求管理--获取组织用户下拉
 	 */
@@ -156,7 +158,7 @@ public class AdminDemandApiController extends CertifyApiController {
 		res.setData(userService.selectDemandUnitNames());
 		return res;
 	}
-	
+
 	/**
 	 * 需求资料--图片上传
 	 */
@@ -201,7 +203,6 @@ public class AdminDemandApiController extends CertifyApiController {
 		return res;
 	}
 
-	
 	/**
 	 * 修改需求
 	 */
@@ -220,6 +221,12 @@ public class AdminDemandApiController extends CertifyApiController {
 			return res;
 		}
 
+		if (!DemandAuditStatus.CREATE.getCode().equals(demand.getAuditStatus())
+				&& !DemandAuditStatus.UNAUDITED.getCode().equals(demand.getAuditStatus())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
+			return res;
+		}
+
 		res = disposeDemand(res, demand);
 		if (!res.getError().isEmpty()) {
 			return res;
@@ -230,10 +237,30 @@ public class AdminDemandApiController extends CertifyApiController {
 		res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate));
 		return res;
 	}
-
-	
 	
 	/**
+	 * 需求撤消发布(下架)
+	 */
+	@RequestMapping(value = "/offShelf", method = RequestMethod.POST)
+	public Result offShelf(String id){
+		Result res = new Result();
+		if (StringUtils.isBlank(id)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		
+		Demand d = demandService.selectByPrimaryKey(id);
+		
+		if (null == d){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+		
+		res.setData(demandService.updateReleaseStatus(d));
+		return res;
+	}
+
+	/**
 	 * 下载需求文件--文本文件
 	 */
 	@RequestMapping(value = "/download", method = RequestMethod.GET)

+ 2 - 0
src/main/java/com/goafanti/admin/service/AdminService.java

@@ -54,4 +54,6 @@ public interface AdminService {
 
 	Map<String, String> selectContractManager();
 
+	Map<String, String> selectTechBroder();
+
 }

+ 5 - 0
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -185,6 +185,11 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		return disposeAdminList(adminMapper.selectContractManager());
 	}
 	
+	@Override
+	public Map<String, String> selectTechBroder() {
+		return disposeAdminList(adminMapper.selectTechBroder());
+	}
+	
 	private Map<String, String> disposeAdminList(List<Admin> list){
 		Map<String, String> map = new TreeMap<String, String>();
 		for (Admin o : list) {

+ 2 - 0
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -17,6 +17,8 @@ public class AFTConstants {
 
 	public static final String	SALESMANADMIN		= "6";					// 营销员
 
+	public static final String	TECHBROKER			= "7";					// 技术经纪人
+
 	public static final String	PATENTINFO			= "专利申请管理";
 
 	public static final String	COGNIZANCE			= "高企认定管理";

+ 2 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -49,4 +49,6 @@ public interface AdminMapper {
 	List<Admin> selectSalesman();
 
 	List<Admin> selectContractManager();
+
+	List<Admin> selectTechBroder();
 }

+ 57 - 0
src/main/java/com/goafanti/common/enums/DemandAuditStatus.java

@@ -0,0 +1,57 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum DemandAuditStatus {
+	CREATE(0, "未提交审核草稿"),
+	SUBMIT(1, "提交审核"),
+	INAUDIT(2, "审核中"),
+	AUDITED(3,"审核通过"),
+	UNAUDITED(4,"审核未通过"),
+	OTHER(5, "其他");
+
+	private DemandAuditStatus(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, DemandAuditStatus> status = new HashMap<Integer, DemandAuditStatus>();
+
+	static {
+		for (DemandAuditStatus value : DemandAuditStatus.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static DemandAuditStatus getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static DemandAuditStatus 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;
+	}
+}

+ 4 - 5
src/main/java/com/goafanti/common/enums/DemandStatus.java

@@ -6,11 +6,10 @@ import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
 
 public enum DemandStatus {
-	CREATE(0, "草稿"),
-	ONGOING(1, "进行中"),
-	UNRESOLVED(2,"未解决"),
-	SOLVED(3,"已解决"),
-	OTHER(4, "其他");
+	
+	UNRESOLVED(0,"未解决"),
+	SOLVED(1,"已解决"),
+	OTHER(2, "其他");
 
 	private DemandStatus(Integer code, String desc) {
 		this.code = code;

+ 5 - 1
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -13,7 +13,11 @@ public enum NoticeStatus {
 	PERSONALCERTIFY(5, "个人用户认证审核"),
 	ORGANIZATIONCERTIFY(6, "团体组织用户认证审核"),
 	CONTRACT(7, "合同管理"),
-	OTHER(7, "其他");
+	PERSONALDEMAND(8, "个人用户科技需求管理"),
+	ORGANIZATIONDEMAND(9, "团体组织用户需求管理"),
+	PERSONALACHIEVEMENTT(10, "个人用户科技需求管理"),
+	ORGANIZATIONACHIEVEMENT(11, "组织用户科技成果管理"),
+	OTHER(12, "其他");
 
 	private NoticeStatus(Integer code, String desc) {
 		this.code = code;

+ 6 - 0
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -284,4 +284,10 @@
 	where ur.rid not in('1','2','3','4')
 	group by a.id
   </select>
+  
+   <select id="selectTechBroder" resultMap="BaseResultMap">
+   select a.id, a.name, a.position from admin a 
+		INNER JOIN user_role  ur on a.id = ur.uid
+	where ur.rid = 7 
+   </select>
 </mapper>

+ 62 - 14
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -37,6 +37,8 @@
     <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
     <result column="principal_id" property="principalId" jdbcType="VARCHAR" />
     <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
+    <result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
+    <result column="tech_broker_id" property="techBrokerId" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     id, serial_number, data_category, name, keyword, info_sources, industry_category_a, 
@@ -44,7 +46,8 @@
     picture_url, text_file_url, video_url, fixed_budget, fixed_cycle, people_number, 
     fixed_scheme, cost_escrow, budget_cost, validity_period, employer_id, employer_name, 
     employer_address, employer_contacts, employer_contacts_mobile, employer_contacts_mailbox, 
-    contacts, status, release_status, release_date, create_time, principal_id, deleted_sign
+    contacts, status, release_status, release_date, create_time, principal_id, deleted_sign,
+    audit_status, tech_broker_id
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
@@ -68,7 +71,7 @@
       employer_address, employer_contacts, employer_contacts_mobile, 
       employer_contacts_mailbox, contacts, status, 
       release_status, release_date, create_time, 
-      principal_id, deleted_sign)
+      principal_id, deleted_sign, audit_status, tech_broker_id)
     values (#{id,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, #{dataCategory,jdbcType=INTEGER}, 
       #{name,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR}, #{infoSources,jdbcType=INTEGER}, 
       #{industryCategoryA,jdbcType=INTEGER}, #{industryCategoryB,jdbcType=INTEGER}, #{industryCategoryC,jdbcType=INTEGER}, 
@@ -80,7 +83,8 @@
       #{employerAddress,jdbcType=VARCHAR}, #{employerContacts,jdbcType=VARCHAR}, #{employerContactsMobile,jdbcType=VARCHAR}, 
       #{employerContactsMailbox,jdbcType=VARCHAR}, #{contacts,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
       #{releaseStatus,jdbcType=INTEGER}, #{releaseDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{principalId,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER})
+      #{principalId,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, #{auditStatus,jdbcType=INTEGER},
+      #{techBrokerId,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Demand" >
     insert into demand
@@ -190,6 +194,12 @@
       <if test="deletedSign != null" >
         deleted_sign,
       </if>
+      <if test="auditStatus != null" >
+        audit_status,
+      </if>
+      <if test="techBrokerId != null" >
+        tech_broker_id,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="id != null" >
@@ -297,6 +307,12 @@
       <if test="deletedSign != null" >
         #{deletedSign,jdbcType=INTEGER},
       </if>
+      <if test="auditStatus != null" >
+        #{auditStatus,jdbcType=INTEGER},
+      </if>
+      <if test="techBrokerId != null" >
+        #{techBrokerId,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Demand" >
@@ -404,6 +420,12 @@
       <if test="deletedSign != null" >
         deleted_sign = #{deletedSign,jdbcType=INTEGER},
       </if>
+      <if test="auditStatus != null" >
+        audit_status = #{auditStatus,jdbcType=INTEGER},
+      </if>
+      <if test="techBrokerId != null" >
+        tech_broker_id = #{techBrokerId,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -442,7 +464,9 @@
       release_date = #{releaseDate,jdbcType=TIMESTAMP},
       create_time = #{createTime,jdbcType=TIMESTAMP},
       principal_id = #{principalId,jdbcType=VARCHAR},
-      deleted_sign = #{deletedSign,jdbcType=INTEGER}
+      deleted_sign = #{deletedSign,jdbcType=INTEGER},
+      audit_status = #{auditStatus,jdbcType=INTEGER},
+      tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   
@@ -452,11 +476,11 @@
 	  d.name, d.keyword, d.info_sources as infoSources, 
 	  ui.username, d.demand_type as demandType, d.validity_period as validityPeriod, 
 	  d.employer_name as employerName, ui.province, d.status, 
-	  d.release_status as releaseStatus, d.release_date as releaseDate, a.name as principalId,
-	  d.employer_id as employerId
+	  d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,
+	  d.employer_id as employerId, d.audit_status as auditStatus
 	from  demand d 
 	LEFT JOIN user_identity ui on d.employer_id = ui.uid
-	LEFT JOIN admin a on a.id = d.principal_id
+	LEFT JOIN admin a on a.id = d.tech_broker_id
 	<if test="mid != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
@@ -467,9 +491,15 @@
 	<if test="principal != null">
 		and  d.principal_id = #{principal,jdbcType=VARCHAR}
 	</if>
+	<if test="techBroker != null">
+		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	</if>
 	<if test="province != null">
 		and  ui.province = #{province,jdbcType=VARCHAR}
 	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
@@ -517,7 +547,7 @@
 	 count(1)
 	from  demand d 
 	LEFT JOIN user_identity ui on d.employer_id = ui.uid
-	LEFT JOIN admin a on a.id = d.principal_id
+	LEFT JOIN admin a on a.id = d.tech_broker_id
 	<if test="mid != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
@@ -528,12 +558,18 @@
 	<if test="principal != null">
 		and  d.principal_id = #{principal,jdbcType=VARCHAR}
 	</if>
+	<if test="techBroker != null">
+		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	</if>
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
 	<if test="province != null">
 		and  ui.province = #{province,jdbcType=VARCHAR}
 	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
 	<if test="name != null">
 		and  d.name = #{name,jdbcType=VARCHAR}
 	</if>
@@ -575,11 +611,11 @@
 	  d.name, d.keyword, d.info_sources as infoSources, 
 	  oi.unit_name as username, d.demand_type as demandType, d.validity_period as validityPeriod, 
 	  d.employer_name as employerName, oi.licence_province as province, d.status, 
-	  d.release_status as releaseStatus, d.release_date as releaseDate, a.name as principalId,
-	  d.employer_id as employerId
+	  d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,
+	  d.employer_id as employerId, d.audit_status as auditStatus
 	from  demand d 
 	LEFT JOIN organization_identity oi on d.employer_id = oi.uid
-	LEFT JOIN admin a on a.id = d.principal_id
+	LEFT JOIN admin a on a.id = d.tech_broker_id
 	<if test="mid != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
@@ -590,12 +626,18 @@
 	<if test="principal != null">
 		and  d.principal_id = #{principal,jdbcType=VARCHAR}
 	</if>
+	<if test="techBroker != null">
+		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	</if>
 	<if test="province != null">
 		and  oi.licence_province = #{province,jdbcType=VARCHAR}
 	</if>
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
 	<if test="name != null">
 		and  d.name = #{name,jdbcType=VARCHAR}
 	</if>
@@ -640,7 +682,7 @@
 	 count(1)
 	from  demand d 
 	LEFT JOIN organization_identity oi on d.employer_id = oi.uid
-	LEFT JOIN admin a on a.id = d.principal_id
+	LEFT JOIN admin a on a.id = d.tech_broker_id
 	<if test="mid != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
@@ -651,9 +693,15 @@
 	<if test="principal != null">
 		and  d.principal_id = #{principal,jdbcType=VARCHAR}
 	</if>
+	<if test="techBroker != null">
+		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	</if>
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
 	<if test="province != null">
 		and  oi.licence_province = #{province,jdbcType=VARCHAR}
 	</if>
@@ -703,7 +751,7 @@
   		d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
   		d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
   		d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
-  		info.postal_address as address, u.email as mailbox,  u.mobile as mobile
+  		info.postal_address as address, u.email as mailbox,  u.mobile as mobile, d.audit_status as auditStatus
   	from demand d 
   	left join user_identity ui on ui.uid = d.employer_id
   	left join user_info info on info.uid = d.employer_id
@@ -723,7 +771,7 @@
   		d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
   		d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
   		d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
-  		oi.postal_address as address, u.email as mailbox,  d.contacts 
+  		oi.postal_address as address, u.email as mailbox,  d.contacts, d.audit_status as auditStatus
   	from demand d 
   	left join organization_identity oi on oi.uid = d.employer_id
   	left join user u on u.id = d.employer_id

+ 28 - 1
src/main/java/com/goafanti/common/model/Demand.java

@@ -184,6 +184,16 @@ public class Demand {
     * 删除标记
     */
     private Integer deletedSign;
+    
+    /**
+     * 审核状态
+     */
+    private Integer auditStatus;
+    
+    /**
+     * 技术经纪人ID
+     */
+    private String techBrokerId;
 
     public String getId() {
         return id;
@@ -472,7 +482,24 @@ public class Demand {
         this.deletedSign = deletedSign;
     }
     
-    public String getValidityPeriodFormattedDate() {
+    @JsonFormat(shape = Shape.STRING)
+    public Integer getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(Integer auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
+	public String getTechBrokerId() {
+		return techBrokerId;
+	}
+
+	public void setTechBrokerId(String techBrokerId) {
+		this.techBrokerId = techBrokerId;
+	}
+
+	public String getValidityPeriodFormattedDate() {
 		if (this.validityPeriod == null) {
 			return null;
 		} else {

+ 15 - 0
src/main/java/com/goafanti/demand/bo/DemandListBo.java

@@ -45,6 +45,7 @@ public class DemandListBo {
 	private Date	validityPeriod;
 	
 	private Integer	status;
+	
 
 	/**
 	 * 是否发布(0-未发布,1-发布)
@@ -53,6 +54,20 @@ public class DemandListBo {
 	
 	private String employerId;
 	
+	/**
+	 * 审核状态
+	 */
+	private Integer auditStatus;
+	
+    @JsonFormat(shape = Shape.STRING)	
+	public Integer getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(Integer auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
 	public String getEmployerId() {
 		return employerId;
 	}

+ 13 - 0
src/main/java/com/goafanti/demand/bo/DemandManageListBo.java

@@ -22,6 +22,19 @@ public class DemandManageListBo extends DemandListBo{
 	 * 负责人(营销员)
 	 */
 	private String	principalId;
+	
+	/**
+	 * 技术经纪人
+	 */
+	private String techBrokerId;
+	
+	public String getTechBrokerId() {
+		return techBrokerId;
+	}
+
+	public void setTechBrokerId(String techBrokerId) {
+		this.techBrokerId = techBrokerId;
+	}
 
 	@JsonFormat(shape = Shape.STRING)
 	public Integer getInfoSources() {

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

@@ -121,6 +121,13 @@ public class InputDemand {
 
 	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
 	private String		principalId;
+	
+	@Max(value = 4, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer auditStatus;
+	
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String techBrokerId;
 
 	public String getId() {
 		return id;
@@ -378,6 +385,32 @@ public class InputDemand {
 	public void setPrincipalId(String principalId) {
 		this.principalId = principalId;
 	}
+
+	public Integer getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(Integer serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+
+	public Integer getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(Integer auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
+	public String getTechBrokerId() {
+		return techBrokerId;
+	}
+
+	public void setTechBrokerId(String techBrokerId) {
+		this.techBrokerId = techBrokerId;
+	}
+	
+	
 	
 	
 

+ 4 - 2
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -10,12 +10,12 @@ import com.goafanti.demand.bo.DemandManageListBo;
 
 public interface DemandService {
 
-	Pagination<DemandManageListBo> selectUserDemandManageList(String province, Integer serialNumber, String name, String keyword,
+	Pagination<DemandManageListBo> selectUserDemandManageList(Integer auditStatus, String province, Integer serialNumber, String name, String keyword,
 			Integer infoSources, Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate,
 			String employerName, Integer status, Integer releaseStatus, String releaseDateStartDate,
 			String releaseDateEndDate, Integer pNo, Integer pSize);
 
-	Pagination<DemandManageListBo> selectOrgDemandManageList(String province, Integer serialNumber, String name,
+	Pagination<DemandManageListBo> selectOrgDemandManageList(Integer auditStatus, 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, Integer pNo, Integer pSize);
@@ -37,4 +37,6 @@ public interface DemandService {
 			String validityPeriodStartDate, String validityPeriodEndDate, Integer status,
 			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize);
 
+	int updateReleaseStatus(Demand d);
+
 }

+ 83 - 26
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -14,11 +14,18 @@ import org.springframework.stereotype.Service;
 
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.DemandMapper;
+import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.dao.UserMapper;
+import com.goafanti.common.dao.UserRoleMapper;
 import com.goafanti.common.enums.DeleteStatus;
+import com.goafanti.common.enums.DemandAuditStatus;
 import com.goafanti.common.enums.DemandReleaseStatus;
 import com.goafanti.common.enums.DemandStatus;
+import com.goafanti.common.enums.NoticeReadStatus;
+import com.goafanti.common.enums.NoticeStatus;
+import com.goafanti.common.enums.UserType;
 import com.goafanti.common.model.Demand;
+import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -35,10 +42,14 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	private DemandMapper	demandMapper;
 	@Autowired
 	private UserMapper		userMapper;
+	@Autowired
+	private UserRoleMapper	userRoleMapper;
+	@Autowired
+	private NoticeMapper	noticeMapper;
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<DemandManageListBo> selectUserDemandManageList(String province, Integer serialNumber, String name,
+	public Pagination<DemandManageListBo> selectUserDemandManageList(Integer auditStatus, 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, Integer pNo, Integer pSize) {
@@ -91,6 +102,10 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		if (null != rEnd) {
 			params.put("rEnd", rEnd);
 		}
+		
+		if (null != auditStatus){
+			params.put("auditStatus", auditStatus);
+		}
 
 		if (!StringUtils.isBlank(province)) {
 			params.put("province", province);
@@ -143,6 +158,10 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
 			params.put("mid", TokenManager.getAdminId());
 		}
+		
+		if (TokenManager.hasRole(AFTConstants.TECHBROKER)){
+			params.put("techBroker", TokenManager.getAdminId());
+		}
 
 		return (Pagination<DemandManageListBo>) findPage("findManageUserDemandListByPage", "findManageUserDemandCount",
 				params, pNo, pSize);
@@ -151,7 +170,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<DemandManageListBo> selectOrgDemandManageList(String province, Integer serialNumber, String name,
+	public Pagination<DemandManageListBo> selectOrgDemandManageList(Integer auditStatus, 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, Integer pNo, Integer pSize) {
@@ -204,6 +223,10 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		if (null != rEnd) {
 			params.put("rEnd", rEnd);
 		}
+		
+		if (null != auditStatus){
+			params.put("auditStatus", auditStatus);
+		}
 
 		if (!StringUtils.isBlank(province)) {
 			params.put("province", province);
@@ -256,6 +279,10 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
 			params.put("mid", TokenManager.getAdminId());
 		}
+		
+		if (TokenManager.hasRole(AFTConstants.TECHBROKER)){
+			params.put("techBroker", TokenManager.getAdminId());
+		}
 
 		return (Pagination<DemandManageListBo>) findPage("findManageOrgDemandListByPage", "findManageOrgDemandCount",
 				params, pNo, pSize);
@@ -278,24 +305,23 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 		Calendar now = Calendar.getInstance();
 		now.set(Calendar.MILLISECOND, 0);
-		d.setStatus(DemandStatus.CREATE.getCode());
-		if (DemandReleaseStatus.RELEASED.getCode().equals(d.getReleaseStatus())) {
-			d.setReleaseDate(now.getTime());
-			d.setStatus(DemandStatus.ONGOING.getCode());
-		}
-		
-		if (TokenManager.getToken() instanceof User){
-			User u = userMapper.selectByPrimaryKey(TokenManager.getUserId());
-			d.setPrincipalId(u.getAid());
+		d.setStatus(DemandStatus.UNRESOLVED.getCode());
+		d.setAuditStatus(DemandAuditStatus.CREATE.getCode());
+		d.setReleaseStatus(DemandReleaseStatus.UNRELEASE.getCode());
+
+		d.setPrincipalId(TokenManager.getAdminId());
+		if (DemandAuditStatus.SUBMIT.getCode().equals(d.getAuditStatus())) {
+			d.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
+			d.setReleaseStatus(DemandReleaseStatus.RELEASED.getCode());
+			createAuditorNotice(d);
 		}
-		
+
 		d.setCreateTime(now.getTime());
 		demandMapper.insert(d);
 	}
 
 	@Override
 	public int updateUserDemand(Demand d, String validityPeriodFormattedDate) {
-
 		Date validityPeriod = null;
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
 			try {
@@ -305,19 +331,11 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		}
 		d.setValidityPeriod(validityPeriod);
 
-		Demand demand = demandMapper.selectByPrimaryKey(d.getId());
-		if (DemandReleaseStatus.RELEASED.getCode().equals(d.getReleaseStatus())
-				&& DemandReleaseStatus.UNRELEASE.getCode().equals(demand.getReleaseStatus())) {
-			Calendar now = Calendar.getInstance();
-			now.set(Calendar.MILLISECOND, 0);
-			d.setReleaseDate(now.getTime());
-			d.setStatus(DemandStatus.ONGOING.getCode());
-		}
-
-		if (DemandReleaseStatus.UNRELEASE.getCode().equals(d.getReleaseStatus())
-				&& DemandReleaseStatus.RELEASED.getCode().equals(demand.getReleaseStatus())) {
-			d.setStatus(DemandStatus.CREATE.getCode());
-			demandMapper.updateReleaseDate(demand.getId());
+		
+		if (DemandAuditStatus.SUBMIT.getCode().equals(d.getAuditStatus())) {
+			d.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
+			d.setReleaseStatus(DemandReleaseStatus.RELEASED.getCode());
+			createAuditorNotice(d);
 		}
 
 		return demandMapper.updateByPrimaryKeySelective(d);
@@ -433,4 +451,43 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		}
 		return (Pagination<DemandListBo>) findPage("findDemandListByPage", "findDemandCount", params, pNo, pSize);
 	}
+
+	// 给所有审核员发送审核通知
+	private void createAuditorNotice(Demand d) {
+		List<String> ids = userRoleMapper.listAuditor();
+		if (null != ids && ids.size() > 0) {
+			for (String s : ids) {
+				Notice n = new Notice();
+				Calendar now = Calendar.getInstance();
+				now.set(Calendar.MILLISECOND, 0);
+				n.setId(UUID.randomUUID().toString());
+				n.setCreateTime(now.getTime());
+				n.setReaded(NoticeReadStatus.UNREAD.getCode());
+				User u = userMapper.selectByPrimaryKey(d.getEmployerId());
+				n.setRid(d.getId());
+				n.setUid(d.getEmployerId());
+				n.setAid(s);
+				if (null != u) {
+					n.setPid(u.getAid());
+				}
+				if (UserType.PERSONAL.getCode().equals(d.getDataCategory())) {
+					n.setContent(NoticeStatus.PERSONALDEMAND.getDesc() + " " + DemandAuditStatus.SUBMIT.getDesc());
+					n.setNoticeType(NoticeStatus.PERSONALDEMAND.getCode());
+				} else if (UserType.ORGANIZATION.getCode().equals(d.getDataCategory())) {
+					n.setContent(NoticeStatus.ORGANIZATIONDEMAND.getDesc() + " " + DemandAuditStatus.SUBMIT.getDesc());
+					n.setNoticeType(NoticeStatus.ORGANIZATIONDEMAND.getCode());
+				}
+				noticeMapper.insert(n);
+			}
+		}
+	}
+
+	@Override
+	public int updateReleaseStatus(Demand d) {
+		d.setAuditStatus(DemandAuditStatus.CREATE.getCode());
+		d.setReleaseStatus(DemandReleaseStatus.UNRELEASE.getCode());
+		d.setStatus(DemandStatus.UNRESOLVED.getCode());
+		demandMapper.updateReleaseDate(d.getId());
+		return demandMapper.updateByPrimaryKeySelective(d);
+	}
 }

+ 1 - 1
src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java

@@ -158,7 +158,7 @@ public class UserIdentityServiceImpl implements UserIdentityService {
 	// 给所有审核员发送审核通知
 	private void createAuditorNotice(User u) {
 		List<String> ids = userRoleMapper.listAuditor();
-		if (ids.size() > 0 && null != ids) {
+		if (null != ids && ids.size() > 0) {
 			for (String s : ids) {
 				Notice n = new Notice();
 				Calendar now = Calendar.getInstance();