Antiloveg 8 years ago
parent
commit
77e0e5d60d

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

@@ -30,4 +30,6 @@ public interface DemandMapper {
 	void insertBatch(List<Demand> demandList);
 
 	DemandSearchDetailBo selectDemandSearchDetail(String id);
+
+	DemandSearchDetailBo selectDemandSearchDetail(String uid, String id);
 }

+ 1 - 2
src/main/java/com/goafanti/common/mapper/AchievementInterestMapper.xml

@@ -84,7 +84,7 @@
   	select 
   		ai.id, ai.achievement_id as achievementId, ai.create_time as createTime,
   		a.name, a.serial_number as serialNumber, a.deleted_sign as deletedSign,
-  		a.audit_status as auditStatus
+  		a.audit_status as auditStatus, a.keyword
   	from achievement_interest ai
   	left join achievement a on a.id = ai.achievement_id
   	where 1=1
@@ -101,7 +101,6 @@
   	select 
   		count(1)
   	from achievement_interest ai
-  	left join achievement a on a.id = ai.achievement_id
   	where 1=1
   	<if test="uid != null">
   		and	ai.uid = #{uid,jdbcType=VARCHAR}

+ 27 - 0
src/main/java/com/goafanti/common/mapper/DemandInterestMapper.xml

@@ -80,6 +80,33 @@
     where id = #{id,jdbcType=VARCHAR}
   </update>
   
+   <select id="findDemandInterestListByPage" parameterType="String" resultType="com.goafanti.portal.bo.DemandInterestListBo">
+  	select 
+  		di.id, di.demand_id as demandId, di.create_time as createTime,
+  		d.name, d.serial_number as serialNumber, d.deleted_sign as deletedSign,
+  		d.audit_status as auditStatus, d.keyword, d.status
+  	from demand_interest di
+  	left join demand d on d.id = di.demand_id
+  	where 1=1
+  	<if test="uid != null">
+  		and di.uid = #{uid,jdbcType=VARCHAR}
+  	</if> 
+  	order by di.create_time desc
+  	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findDemandInterestCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from demand_interest di
+  	where 1=1
+  	<if test="uid != null">
+  		and	di.uid = #{uid,jdbcType=VARCHAR}
+  	</if> 
+  </select>
+  
    <select id="selectDemandInterestByUidAndDemandId" resultMap="BaseResultMap"  >
     select 
     <include refid="Base_Column_List" />

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

@@ -975,7 +975,7 @@
   		oi.unit_name as unitName, di.id as demandInterestId
   	from demand d
   	left join user_identity ui on ui.uid = d.employer_id
-  	left join organization_identity oi on oi.uid = employer_id
+  	left join organization_identity oi on oi.uid = d.employer_id
   	left join demand_interest d on di.demand_id = d.id and di.uid = #{0}
   	where d.id = #{1}
   </select>

+ 4 - 0
src/main/java/com/goafanti/demand/service/DemandInterestService.java

@@ -1,6 +1,8 @@
 package com.goafanti.demand.service;
 
 import com.goafanti.common.model.DemandInterest;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.portal.bo.DemandInterestListBo;
 
 
 public interface DemandInterestService {
@@ -11,5 +13,7 @@ public interface DemandInterestService {
 
 	DemandInterest selectDemandInterestByUidAndDemandId(String userId, String id);
 
+	Pagination<DemandInterestListBo> listDemandInterest(Integer pNo, Integer pSize);
+
 
 }

+ 24 - 0
src/main/java/com/goafanti/demand/service/impl/DemandInterestServiceImpl.java

@@ -1,6 +1,8 @@
 package com.goafanti.demand.service.impl;
 
 import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.UUID;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -8,9 +10,12 @@ import org.springframework.stereotype.Service;
 
 import com.goafanti.common.dao.DemandInterestMapper;
 import com.goafanti.common.model.DemandInterest;
+import com.goafanti.common.model.User;
 import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.demand.service.DemandInterestService;
+import com.goafanti.portal.bo.DemandInterestListBo;
 
 @Service
 public class DemandInterestServiceImpl extends BaseMybatisDao<DemandInterestMapper> implements DemandInterestService {
@@ -39,5 +44,24 @@ public class DemandInterestServiceImpl extends BaseMybatisDao<DemandInterestMapp
 		return demandInterestMapper.selectDemandInterestByUidAndDemandId(uid, id);
 	}
 
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<DemandInterestListBo> listDemandInterest(Integer pNo, Integer pSize) {
+		Map<String, Object> params = new HashMap<>();
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		if (TokenManager.getToken() instanceof User) {
+			params.put("uid", TokenManager.getUserId());
+		}
+		return (Pagination<DemandInterestListBo>) findPage("findDemandInterestListByPage",
+				"findDemandInterestCount", params, pNo, pSize);
+	}
+
 	
 }

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

@@ -386,7 +386,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 	@Override
 	public DemandSearchDetailBo selectDemandSearchDetail(String uid, String id) {
-		return demandMapper.selectDemandSearchDetail(id);
+		return demandMapper.selectDemandSearchDetail(uid, id);
 	}
 
 	private Map<String, Object> disposeParams(Integer auditStatus, String province, Integer serialNumber, String name,

+ 1 - 80
src/main/java/com/goafanti/portal/bo/AchievementInterestListBo.java

@@ -1,52 +1,10 @@
 package com.goafanti.portal.bo;
 
-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 AchievementInterestListBo {
-	private String	id;
+public class AchievementInterestListBo extends InterestListBo{
 
 	private String	achievementId;
 
-	private Date	createTime;
-
-	private String	name;
-
-	private Integer	serialNumber;
-
-	private Integer	deletedSign;
-
-	private Integer	auditStatus;
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Integer getSerialNumber() {
-		return serialNumber;
-	}
-
-	public void setSerialNumber(Integer serialNumber) {
-		this.serialNumber = serialNumber;
-	}
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
 	public String getAchievementId() {
 		return achievementId;
 	}
@@ -55,42 +13,5 @@ public class AchievementInterestListBo {
 		this.achievementId = achievementId;
 	}
 
-	public Date getCreateTime() {
-		return createTime;
-	}
-
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
-
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getDeletedSign() {
-		return deletedSign;
-	}
-
-	public void setDeletedSign(Integer deletedSign) {
-		this.deletedSign = deletedSign;
-	}
-	
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getAuditStatus() {
-		return auditStatus;
-	}
-
-	public void setAuditStatus(Integer auditStatus) {
-		this.auditStatus = auditStatus;
-	}
-
-	public String getCreateTimeFormattedDate() {
-		if (this.createTime == null) {
-			return null;
-		} else {
-			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
-		}
-	}
-
-	public void setCreateTimeFormattedDate(String createTimeFormattedDate) {
-
-	}
 
 }

+ 29 - 0
src/main/java/com/goafanti/portal/bo/DemandInterestListBo.java

@@ -0,0 +1,29 @@
+package com.goafanti.portal.bo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonFormat.Shape;
+
+public class DemandInterestListBo extends InterestListBo {
+
+	private String	demandId;
+
+	private Integer	status;
+
+	public String getDemandId() {
+		return demandId;
+	}
+
+	public void setDemandId(String demandId) {
+		this.demandId = demandId;
+	}
+
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+}

+ 96 - 0
src/main/java/com/goafanti/portal/bo/InterestListBo.java

@@ -0,0 +1,96 @@
+package com.goafanti.portal.bo;
+
+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 InterestListBo {
+	private String	id;
+
+	private Date	createTime;
+
+	private String	name;
+
+	private Integer	serialNumber;
+
+	private Integer	deletedSign;
+
+	private Integer	auditStatus;
+
+	private String	keyword;
+	
+	public String getKeyword() {
+		return keyword;
+	}
+
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Integer getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(Integer serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getDeletedSign() {
+		return deletedSign;
+	}
+
+	public void setDeletedSign(Integer deletedSign) {
+		this.deletedSign = deletedSign;
+	}
+
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(Integer auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
+	public String getCreateTimeFormattedDate() {
+		if (this.createTime == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
+		}
+	}
+
+	public void setCreateTimeFormattedDate(String createTimeFormattedDate) {
+
+	}
+
+}

+ 18 - 0
src/main/java/com/goafanti/portal/controller/PortalBussinessApiController.java

@@ -36,6 +36,24 @@ public class PortalBussinessApiController extends CertifyApiController{
 	private AchievementInterestService	achievementInterestService;
 	@Resource
 	private DemandInterestService		demandInterestService;
+	
+	/**
+	 * 科技需求"感兴趣列表"
+	 */
+	@RequestMapping(value = "/demandInterestList", method = RequestMethod.GET)
+	public Result demandInterestList(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(demandInterestService.listDemandInterest(pNo, pSize));
+		return res;
+	}
 
 	/**
 	 * 科技成果"感兴趣列表"