Browse Source

科技需求 搜索列表

Antiloveg 8 years ago
parent
commit
4fb52d092e

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

@@ -358,7 +358,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			pNo = 1;
 		}
 
-		if (pSize == null || pSize < 0) {
+		if (pSize == null || pSize < 0 || pSize > 10) {
 			pSize = 10;
 		}
 		return (Pagination<AchievementSearchListBo>) findPage("findSearchAchievementListByPage",

+ 66 - 0
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -897,4 +897,70 @@
     </foreach>
   </insert>
   
+  <select id="findSearchDemandListByPage" parameterType="String" resultType="com.goafanti.portal.bo.DemandSearchListBo">
+  	select 
+	  		d.id, d.name, d.keyword,
+	  		d.serial_number as serialNumber, d.data_category as dataCategory, d.industry_category_a as industryCategoryA,
+	  		d.industry_category_b as industryCategoryB, d.demand_type as demandType, d.budget_cost as budgetCost,
+	  		d.problem_des as problemDes, d.release_date as releaseDate, ui.username,
+	  		oi.unit_name as unitName
+  		from demand d
+  		left join user_identity ui on d.employer_id = ui.uid
+  		left join organization_identity oi on d.employer_id = oi.uid
+  		where d.deleted_sign = 0 and d.status = 0
+  		<if test="keyword != null">
+  			and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+  		</if>
+  		<if test="industryCategoryA != null">
+  			and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
+  		</if>
+  		<if test="industryCategoryB != null">
+  			and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
+  		</if>
+  		<if test="budgetCostLower != null">
+  			and d.budget_cost <![CDATA[ > ]]>= #{budgetCostLower,jdbcType=DECIMAL}
+  		</if>
+  		<if test="budgetCostUpper != null">
+  			and d.budget_cost <![CDATA[ < ]]>= #{budgetCostUpper,jdbcType=DECIMAL}}
+  		</if>
+  		<if test="demandType != null">
+  			and d.demand_type = #{demandType,jdbcType=INTEGER}
+  		</if>
+  		and d.deleted_sign = 0 
+  		and d.release_status = 1
+  		and d.audit_status = 4
+  		order by d.release_date desc
+  	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findSearchDemandCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from demand d
+  	where d.deleted_sign = 0 and d.status = 0
+  	<if test="keyword != null">
+  			and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+  		</if>
+  		<if test="industryCategoryA != null">
+  			and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
+  		</if>
+  		<if test="industryCategoryB != null">
+  			and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
+  		</if>
+  		<if test="budgetCostLower != null">
+  			and d.budget_cost <![CDATA[ > ]]>= #{budgetCostLower,jdbcType=DECIMAL}
+  		</if>
+  		<if test="budgetCostUpper != null">
+  			and d.budget_cost <![CDATA[ < ]]>= #{budgetCostUpper,jdbcType=DECIMAL}}
+  		</if>
+  		<if test="demandType != null">
+  			and d.demand_type = #{demandType,jdbcType=INTEGER}
+  		</if>
+  		and d.deleted_sign = 0 
+  		and d.release_status = 1
+  		and d.audit_status = 4
+  </select>
+  
 </mapper>

+ 16 - 11
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -1,5 +1,6 @@
 package com.goafanti.demand.service;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 import com.goafanti.achievement.bo.AchievementDemandListBo;
@@ -9,18 +10,19 @@ import com.goafanti.demand.bo.DemandImportBo;
 import com.goafanti.demand.bo.DemandListBo;
 import com.goafanti.demand.bo.DemandManageDetailBo;
 import com.goafanti.demand.bo.DemandManageListBo;
+import com.goafanti.portal.bo.DemandSearchListBo;
 
 public interface DemandService {
 
-	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> 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(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);
+	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);
 
 	void saveUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords);
 
@@ -34,9 +36,8 @@ public interface DemandService {
 
 	Demand selectByPrimaryKey(String id);
 
-
-	Pagination<DemandListBo> listDemand(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer demandType,
-			String validityPeriodStartDate, String validityPeriodEndDate, Integer status,
+	Pagination<DemandListBo> listDemand(Integer auditStatus, Integer serialNumber, String name, String keyword,
+			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, Integer status,
 			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize);
 
 	int updateReleaseStatus(Demand d);
@@ -49,4 +50,8 @@ public interface DemandService {
 
 	void insertImport(List<DemandImportBo> data);
 
+	Pagination<DemandSearchListBo> listDemandSearchList(String keyword, Integer industryCategoryA,
+			Integer industryCategoryB, Integer demandType, BigDecimal budgetCostLower, BigDecimal budgetCostUpper,
+			Integer pNo, Integer pSize);
+
 }

+ 49 - 0
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.demand.service.impl;
 
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -45,6 +46,7 @@ import com.goafanti.demand.bo.DemandListBo;
 import com.goafanti.demand.bo.DemandManageDetailBo;
 import com.goafanti.demand.bo.DemandManageListBo;
 import com.goafanti.demand.service.DemandService;
+import com.goafanti.portal.bo.DemandSearchListBo;
 
 @Service
 public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements DemandService {
@@ -339,6 +341,51 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		demandMapper.insertBatch(demandList);
 		demandKeywordMapper.insertBatch(demandKeywordList);
 	}
+	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<DemandSearchListBo> listDemandSearchList(String keyword, Integer industryCategoryA,
+			Integer industryCategoryB, Integer demandType, BigDecimal budgetCostLower, BigDecimal budgetCostUpper,
+			Integer pNo, Integer pSize) {
+		if (StringUtils.isBlank(keyword)) {
+			return null;
+		}
+		
+		Map<String, Object> params = new HashMap<>();
+		params.put("keyword", keyword);
+		
+		if (null != industryCategoryA){
+			params.put("industryCategoryA", industryCategoryA);
+		}
+		
+		if (null != industryCategoryB){
+			params.put("industryCategoryB", industryCategoryB);
+		}
+		
+		if (null != demandType){
+			params.put("demandType", demandType);
+		}
+		
+		if (null != budgetCostLower){
+			params.put("budgetCostLower", budgetCostLower);
+		}
+		
+		if (null != budgetCostUpper){
+			params.put("budgetCostUpper", budgetCostUpper);
+		}
+		
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		return (Pagination<DemandSearchListBo>) findPage("findSearchDemandListByPage",
+				"findSearchDemandCount", params, pNo, pSize);
+	}
+	
+	
 
 	private Map<String, Object> disposeParams(Integer auditStatus, String province, Integer serialNumber, String name,
 			String keyword, Integer infoSources, Integer demandType, String validityPeriodStartDate,
@@ -513,4 +560,6 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 	
 
+	
+
 }

+ 198 - 0
src/main/java/com/goafanti/portal/bo/DemandSearchListBo.java

@@ -0,0 +1,198 @@
+package com.goafanti.portal.bo;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonFormat.Shape;
+import com.goafanti.common.constant.AFTConstants;
+
+public class DemandSearchListBo {
+	private String id;
+	
+	/**
+	 * 编号
+	 */
+	private Integer serialNumber;
+	
+	
+	/**
+	 * 关键词
+	 */
+	private String keyword;
+	
+	/**
+	 * 数据类别(0-个人需求,1-单位需求)
+	 */
+	private Integer dataCategory;
+	
+	/**
+	 * 名称
+	 */
+	private String name;
+	
+	/**
+	 * 行业类别下拉A
+	 */
+	private Integer industryCategoryA;
+	
+
+	/**
+	 * 行业类别下拉B
+	 */
+	private Integer industryCategoryB;
+	
+	/**
+	 * 需求类型
+	 */
+	private Integer demandType;
+	
+	/**
+	 * 预算价格
+	 */
+	private BigDecimal budgetCost;
+	
+	/**
+	 * 问题说明
+	 */
+	private String problemDes;
+	
+	/**
+	 * 发布时间
+	 */
+	private Date releaseDate;
+	
+	/**
+	 * 个人雇主名称
+	 */
+	private String username;
+	
+	/**
+	 * 组织雇主名称
+	 */
+	private String unitName;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+	
+	public String getKeyword() {
+		return keyword;
+	}
+
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
+
+	public Integer getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(Integer serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	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;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getIndustryCategoryA() {
+		return industryCategoryA;
+	}
+
+	public void setIndustryCategoryA(Integer industryCategoryA) {
+		this.industryCategoryA = industryCategoryA;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getIndustryCategoryB() {
+		return industryCategoryB;
+	}
+
+	public void setIndustryCategoryB(Integer industryCategoryB) {
+		this.industryCategoryB = industryCategoryB;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getDemandType() {
+		return demandType;
+	}
+
+	public void setDemandType(Integer demandType) {
+		this.demandType = demandType;
+	}
+
+	public BigDecimal getBudgetCost() {
+		return budgetCost;
+	}
+
+	public void setBudgetCost(BigDecimal budgetCost) {
+		this.budgetCost = budgetCost;
+	}
+
+	public String getProblemDes() {
+		return problemDes;
+	}
+
+	public void setProblemDes(String problemDes) {
+		this.problemDes = problemDes;
+	}
+
+	public Date getReleaseDate() {
+		return releaseDate;
+	}
+
+	public void setReleaseDate(Date releaseDate) {
+		this.releaseDate = releaseDate;
+	}
+	
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getUnitName() {
+		return unitName;
+	}
+
+	public void setUnitName(String unitName) {
+		this.unitName = unitName;
+	}
+
+	public String getReleaseDateFormattedDate() {
+		if (this.releaseDate == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getReleaseDate(), AFTConstants.YYYYMMDD);
+		}
+	}
+
+	public void setReleaseDateFormattedDate(String releaseDateFormattedDate) {
+
+	}
+	
+	
+}

+ 24 - 1
src/main/java/com/goafanti/portal/controller/PortalSearchApiController.java

@@ -12,12 +12,15 @@ import org.springframework.web.bind.annotation.RestController;
 import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.demand.service.DemandService;
 
 @RestController
 @RequestMapping(value = "/portal/search")
 public class PortalSearchApiController extends BaseApiController {
 	@Resource
-	private AchievementService achievementService;
+	private AchievementService	achievementService;
+	@Resource
+	private DemandService		demandService;
 
 	/**
 	 * 科技成果搜索
@@ -43,4 +46,24 @@ public class PortalSearchApiController extends BaseApiController {
 		return res;
 	}
 
+	/**
+	 * 科技需求搜索
+	 */
+	@RequestMapping(value = "/demandList", method = RequestMethod.GET)
+	public Result demandSerarchList(String keyword, Integer industryCategoryA, Integer industryCategoryB,
+			Integer demandType, BigDecimal budgetCostLower, BigDecimal budgetCostUpper,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.listDemandSearchList(keyword, industryCategoryA, industryCategoryB, demandType,
+				budgetCostLower, budgetCostUpper, pNo, pSize));
+		return res;
+	}
+
 }