Browse Source

科技成果搜索LIST

Antiloveg 8 years ago
parent
commit
1134d7fded

+ 6 - 0
src/main/java/com/goafanti/achievement/service/AchievementService.java

@@ -1,5 +1,6 @@
 package com.goafanti.achievement.service;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 import com.goafanti.achievement.bo.AchievementImportBo;
@@ -9,6 +10,7 @@ import com.goafanti.achievement.bo.AchievementUserOwnerDetailBo;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.demand.bo.DemandAchievementListBo;
+import com.goafanti.portal.bo.AchievementSearchListBo;
 
 public interface AchievementService {
 
@@ -44,5 +46,9 @@ public interface AchievementService {
 
 	void insertImport(List<AchievementImportBo> data);
 
+	Pagination<AchievementSearchListBo> listAchievementSearchList(Integer category, Integer maturity, BigDecimal transferPriceLower,
+			BigDecimal transferPriceUpper, Integer transferMode, String keyword, Integer fieldA, Integer fieldB,
+			Integer pageNo, Integer pageSize);
+
 
 }

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

@@ -1,5 +1,6 @@
 package com.goafanti.achievement.service.impl;
 
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -44,6 +45,7 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.demand.bo.DemandAchievementListBo;
+import com.goafanti.portal.bo.AchievementSearchListBo;
 
 @Service
 public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> implements AchievementService {
@@ -308,11 +310,61 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			}
 			achievementList.add(a);
 		}
-		
+
 		achievementMapper.insertBatch(achievementList);
 		achievementKeywordMapper.insertBatch(AchievementKeywordList);
 	}
 
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AchievementSearchListBo> listAchievementSearchList(Integer category, Integer maturity,
+			BigDecimal transferPriceLower, BigDecimal transferPriceUpper, Integer transferMode, String keyword,
+			Integer fieldA, Integer fieldB, Integer pNo, Integer pSize) {
+		if (StringUtils.isBlank(keyword)) {
+			return null;
+		}
+		Map<String, Object> params = new HashMap<>();
+		params.put("keyword", keyword);
+
+		if (null != category) {
+			params.put("category", category);
+		}
+
+		if (null != maturity) {
+			params.put("maturity", maturity);
+		}
+
+		if (null != transferPriceLower) {
+			params.put("transferPriceLower", transferPriceLower);
+		}
+
+		if (null != transferPriceUpper) {
+			params.put("transferPriceUpper", transferPriceUpper);
+		}
+
+		if (null != transferMode) {
+			params.put("transferMode", transferMode);
+		}
+
+		if (null != fieldA) {
+			params.put("fieldA", fieldA);
+		}
+
+		if (null != fieldB) {
+			params.put("fieldB", fieldB);
+		}
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0) {
+			pSize = 10;
+		}
+		return (Pagination<AchievementSearchListBo>) findPage("findSearchAchievementListByPage",
+				"findSearchAchievementCount", params, pNo, pSize);
+	}
+
 	private void createTechBorkerNotice(Achievement a) {
 		noticeMapper.insert(disposeNotice(a, null));
 	}

+ 3 - 3
src/main/java/com/goafanti/common/enums/AchievementReleaseStatus.java

@@ -7,9 +7,9 @@ import org.apache.commons.lang3.StringUtils;
 
 public enum AchievementReleaseStatus {
 	
-	UNRELEASE(1, "成果未发布"),
-	RELEASED(2, "成果已发布"),
-	OTHER(3, "其他");
+	UNRELEASE(0, "成果未发布"),
+	RELEASED(1, "成果已发布"),
+	OTHER(2, "其他");
 
 	private AchievementReleaseStatus(Integer code, String desc) {
 		this.code = code;

+ 112 - 32
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -656,34 +656,34 @@
   	LEFT JOIN user_identity ui on a.owner_id = ui.uid
   	where deleted_sign = 0 and owner_type = 0
   	<if test="ownerId != null">
-		and  owner_id = #{ownerId,jdbcType=VARCHAR}
+		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
 	</if>
   	<if test="serialNumber != null">
-		and  serial_number = #{serialNumber,jdbcType=INTEGER}
+		and  a.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
 	<if test="auditStatus != null">
-		and  audit_status = #{auditStatus,jdbcType=INTEGER}
+		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
 	</if>
 	<if test="name != null">
-		and  name = #{name,jdbcType=VARCHAR}
+		and  a.name = #{name,jdbcType=VARCHAR}
 	</if>
 	<if test="keyword != null">
-		and  keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
 	</if>
 	<if test="category != null">
-		and  category = #{category,jdbcType=INTEGER}
+		and  a.category = #{category,jdbcType=INTEGER}
 	</if>
 	<if test="status != null">
-		and  status = #{status,jdbcType=INTEGER}
+		and  a.status = #{status,jdbcType=INTEGER}
 	</if>
 	<if test="rStart != null">
-       and	release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
+       and	a.release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
 	</if>
 	<if test="rEnd != null">
-	   and release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	   and a.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
 	</if>
 	<if test="releaseStatus != null">
-	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
+	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
 	</if>
 	order by serial_number desc
 	<if test="page_sql!=null">
@@ -741,34 +741,34 @@
   	LEFT JOIN organization_identity oi on a.owner_id = oi.uid
   	where deleted_sign = 0 and owner_type = 1
   	<if test="ownerId != null">
-		and  owner_id = #{ownerId,jdbcType=VARCHAR}
+		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
 	</if>
   	<if test="serialNumber != null">
-		and  serial_number = #{serialNumber,jdbcType=INTEGER}
+		and  a.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
 	<if test="auditStatus != null">
-		and  audit_status = #{auditStatus,jdbcType=INTEGER}
+		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
 	</if>
 	<if test="name != null">
-		and  name = #{name,jdbcType=VARCHAR}
+		and  a.name = #{name,jdbcType=VARCHAR}
 	</if>
 	<if test="keyword != null">
-		and  keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
 	</if>
 	<if test="category != null">
-		and  category = #{category,jdbcType=INTEGER}
+		and  a.category = #{category,jdbcType=INTEGER}
 	</if>
 	<if test="status != null">
-		and  status = #{status,jdbcType=INTEGER}
+		and  a.status = #{status,jdbcType=INTEGER}
 	</if>
 	<if test="rStart != null">
-       and	release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
+       and	a.release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
 	</if>
 	<if test="rEnd != null">
-	   and release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	   and a.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
 	</if>
 	<if test="releaseStatus != null">
-	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
+	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
 	</if>
 	order by serial_number desc
 	<if test="page_sql!=null">
@@ -779,37 +779,37 @@
   <select id="findOrgOwnerAchievementCount" parameterType="String" resultType="java.lang.Integer">
   	select 
   		count(1)
-  	from achievement
-  	where deleted_sign = 0 and owner_type = 1
+  	from achievement a
+  	where a.deleted_sign = 0 and a.owner_type = 1
   	<if test="ownerId != null">
-		and  owner_id = #{ownerId,jdbcType=VARCHAR}
+		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
 	</if>
   	<if test="serialNumber != null">
-		and  serial_number = #{serialNumber,jdbcType=INTEGER}
+		and  a.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
 	<if test="auditStatus != null">
-		and  audit_status = #{auditStatus,jdbcType=INTEGER}
+		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
 	</if>
 	<if test="name != null">
-		and  name = #{name,jdbcType=VARCHAR}
+		and  a.name = #{name,jdbcType=VARCHAR}
 	</if>
 	<if test="keyword != null">
-		and  keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
 	</if>
 	<if test="category != null">
-		and  category = #{category,jdbcType=INTEGER}
+		and  a.category = #{category,jdbcType=INTEGER}
 	</if>
 	<if test="status != null">
-		and  status = #{status,jdbcType=INTEGER}
+		and  a.status = #{status,jdbcType=INTEGER}
 	</if>
 	<if test="rStart != null">
-       and	release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
+       and	a.release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
 	</if>
 	<if test="rEnd != null">
-	   and release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	   and a.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
 	</if>
 	<if test="releaseStatus != null">
-	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
+	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
 	</if>
   </select>
   
@@ -980,4 +980,84 @@
     </foreach>
   </insert>
   
+  <select id="findSearchAchievementListByPage" parameterType="String" resultType="com.goafanti.portal.bo.AchievementSearchListBo">
+  	select 
+  		a.id, a.name, a.keyword,
+  		a.serial_number as serialNumber, a.data_category as dataCategory, a.category,
+  		a.release_date as releaseDate, a.owner_type as ownerType, ui.username,
+  		oi.unit_name as unitName, a.field_a as fieldA, a.field_b as fieldB,
+  		a.transfer_price as transferPrice, a.maturity, a.transfer_mode as transferMode
+  	from achievement a 
+  	left join user_identity ui on ui.uid = a.owner_id
+  	left join organization_identity oi on oi.uid = a.owner_id
+  	where a.deleted_sign = 0 
+  	<if test="keyword != null">
+  		and a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+  	</if>
+  	<if test="category != null">
+  		and a.category = #{category,jdbcType=INTEGER}
+  	</if>
+  	
+  	<if test="maturity != maturity">
+  		and a.maturity = #{maturity,jdbcType=INTEGER}
+  	</if>
+  	<if test="transferPriceLower != null">
+  		and a.transfer_price <![CDATA[ > ]]> #{transferPriceLower,jdbcType=DECIMAL}
+  	</if>
+  	<if test="transferPriceUpper != null">
+  		and a.transfer_price <![CDATA[ < ]]> #{transferPriceUpper,jdbcType=DECIMAL}
+  	</if>
+  	<if test="transferMode != null">
+  		and a.transfer_mode = #{transferMode,jdbcType=INTEGER}
+  	</if>
+  	<if test="fieldA != null">
+  		and a.field_a = #{fieldA,jdbcType=INTEGER}
+  	</if>
+  	<if test="fieldB != null">
+  		and a.field_b = #{fieldB,jdbcType=INTEGER}
+  	</if>
+  	and a.deleted_sign = 0 
+  	and a.release_status = 1
+  	and a.audit_status = 4
+  	order by a.release_date desc
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id="findSearchAchievementCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from achievement a
+  	where a.deleted_sign = 0 
+  	<if test="keyword != null">
+  		and a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+  	</if>
+  	<if test="category != null">
+  		and a.category = #{category,jdbcType=INTEGER}
+  	</if>
+  	
+  	<if test="maturity != maturity">
+  		and a.maturity = #{maturity,jdbcType=INTEGER}
+  	</if>
+  	<if test="transferPriceLower != null">
+  		and a.transfer_price <![CDATA[ > ]]> #{transferPriceLower,jdbcType=DECIMAL}
+  	</if>
+  	<if test="transferPriceUpper != null">
+  		and a.transfer_price <![CDATA[ < ]]> #{transferPriceUpper,jdbcType=DECIMAL}
+  	</if>
+  	<if test="transferMode != null">
+  		and a.transfer_mode = #{transferMode,jdbcType=INTEGER}
+  	</if>
+  	<if test="fieldA != null">
+  		and a.field_a = #{fieldA,jdbcType=INTEGER}
+  	</if>
+  	<if test="fieldB != null">
+  		and a.field_b = #{fieldB,jdbcType=INTEGER}
+  	</if>
+  	and a.deleted_sign = 0 
+  	and a.release_status = 1
+  	and a.audit_status = 4
+  </select>
+  
 </mapper>

+ 229 - 0
src/main/java/com/goafanti/portal/bo/AchievementSearchListBo.java

@@ -0,0 +1,229 @@
+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 AchievementSearchListBo {
+	private String id;
+	
+	/**
+	 * 编号
+	 */
+	private Integer serialNumber;
+	
+	/**
+	 * 关键词
+	 */
+	private String keyword;
+	
+	/**
+	 * 成果
+	 */
+	private String name;
+	
+	/**
+	 * 数据类别 (0--成果, 1--技术, 2--项目)
+	 */
+	private Integer dataCategory;
+	
+	/**
+	 * 类型(0--专利, 2--软著, 3--项目, 4--版权, 5--工业设计, 6--配方, 7--非标)
+	 */
+	private Integer category;
+	
+	/**
+	 * 所有人名称(个人)
+	 */
+	private String username;
+	
+	/**
+	 * 所有人名称(组织)
+	 */
+	private String unitName;
+	
+	/**
+	 * 发布时间
+	 */
+	private Date releaseDate;
+	
+	/**
+	 * 所有人类型(0--个人,1--组织)
+	 */
+	private Integer ownerType;
+	
+	/**
+	 * 行业分类A
+	 */
+	private Integer fieldA;
+	
+	/**
+	 * 行业分类B
+	 */
+	private Integer fieldB;
+	
+	/**
+	 * 交易价格
+	 */
+	private BigDecimal transferPrice;
+	
+	/**
+	 * 成熟度
+	 */
+	private Integer maturity;
+	
+	/**
+	 * 交易方式
+	 */
+	private Integer transferMode;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public Integer getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(Integer serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getDataCategory() {
+		return dataCategory;
+	}
+
+	public void setDataCategory(Integer dataCategory) {
+		this.dataCategory = dataCategory;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getCategory() {
+		return category;
+	}
+
+	public void setCategory(Integer category) {
+		this.category = category;
+	}
+
+	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 Date getReleaseDate() {
+		return releaseDate;
+	}
+
+	public void setReleaseDate(Date releaseDate) {
+		this.releaseDate = releaseDate;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getOwnerType() {
+		return ownerType;
+	}
+	
+	public void setOwnerType(Integer ownerType) {
+		this.ownerType = ownerType;
+	} 
+	
+	
+	
+	public String getKeyword() {
+		return keyword;
+	}
+
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
+	
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getFieldA() {
+		return fieldA;
+	}
+
+	public void setFieldA(Integer fieldA) {
+		this.fieldA = fieldA;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getFieldB() {
+		return fieldB;
+	}
+
+	public void setFieldB(Integer fieldB) {
+		this.fieldB = fieldB;
+	}
+
+	public BigDecimal getTransferPrice() {
+		return transferPrice;
+	}
+
+	public void setTransferPrice(BigDecimal transferPrice) {
+		this.transferPrice = transferPrice;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getMaturity() {
+		return maturity;
+	}
+
+	public void setMaturity(Integer maturity) {
+		this.maturity = maturity;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getTransferMode() {
+		return transferMode;
+	}
+
+	public void setTransferMode(Integer transferMode) {
+		this.transferMode = transferMode;
+	}
+
+	public String getReleaseDateFormattedDate() {
+		if (this.releaseDate == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getReleaseDate(), AFTConstants.YYYYMMDD);
+		}
+	}
+
+	public void setReleaseDateFormattedDate(String releaseDateFormattedDate) {
+
+	}
+	
+	
+
+}

+ 46 - 0
src/main/java/com/goafanti/portal/controller/PortalSearchApiController.java

@@ -0,0 +1,46 @@
+package com.goafanti.portal.controller;
+
+import java.math.BigDecimal;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+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;
+
+@RestController
+@RequestMapping(value = "/portal/search")
+public class PortalSearchApiController extends BaseApiController {
+	@Resource
+	private AchievementService achievementService;
+
+	/**
+	 * 科技成果搜索
+	 */
+	@RequestMapping(value = "/achievementList", method = RequestMethod.GET)
+	public Result achievementSearchList(Integer category, Integer maturity, BigDecimal transferPriceLower,
+			BigDecimal transferPriceUpper, Integer transferMode, String keyword, Integer fieldA, Integer fieldB,
+			String pageNo, String pageSize) {
+		Result res = new Result();
+		if (StringUtils.isBlank(keyword)) {
+			return res;
+		}
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(achievementService.listAchievementSearchList(category, maturity, transferPriceLower,
+				transferPriceUpper, transferMode, keyword, fieldA, fieldB, pNo, pSize));
+		return res;
+	}
+
+}

+ 10 - 0
src/main/java/com/goafanti/portal/service/PortalSearchService.java

@@ -0,0 +1,10 @@
+package com.goafanti.portal.service;
+
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.portal.bo.AchievementSearchListBo;
+
+public interface PortalSearchService {
+
+	Pagination<AchievementSearchListBo> listAchievementSearchList(String keyword, Integer pNo, Integer pSize);
+
+}

+ 1 - 0
src/main/resources/shiro_base_auth.ini

@@ -15,4 +15,5 @@
 /admin/**=admin,permission
 /role/**=admin,permission
 /permission/**=admin,permission
+/portal/search/**=anon
 /**=login