Browse Source

科技成果我的关注(感兴趣)列表

Antiloveg 8 years ago
parent
commit
4ec99bba9c

+ 5 - 0
src/main/java/com/goafanti/achievement/service/AchievementInterestService.java

@@ -1,9 +1,14 @@
 package com.goafanti.achievement.service;
 
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.portal.bo.AchievementInterestListBo;
+
 public interface AchievementInterestService {
 
 	void saveAchievementInterest(String id);
 
 	int saveCancelAchievementInterest(String id);
 
+	Pagination<AchievementInterestListBo> listAchievementInterest(Integer pNo, Integer pSize);
+
 }

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

@@ -51,7 +51,7 @@ public interface AchievementService {
 			Integer maturity, BigDecimal transferPriceLower, BigDecimal transferPriceUpper, Integer transferMode,
 			String keyword, Integer fieldA, Integer fieldB, Integer pageNo, Integer pageSize);
 
-	AchievementDetailBo selectAchievementSearchDetail(String id);
+	AchievementDetailBo selectAchievementSearchDetail(String uid, String id);
 
 
 }

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

@@ -1,6 +1,8 @@
 package com.goafanti.achievement.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;
@@ -9,9 +11,13 @@ import org.springframework.stereotype.Service;
 import com.goafanti.achievement.service.AchievementInterestService;
 import com.goafanti.common.dao.AchievementInterestMapper;
 import com.goafanti.common.model.AchievementInterest;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.portal.bo.AchievementInterestListBo;
+
 @Service
-public class AchievementInterestServiceImpl implements AchievementInterestService{
+public class AchievementInterestServiceImpl extends BaseMybatisDao<AchievementInterestMapper> implements AchievementInterestService{
 	@Autowired
 	private AchievementInterestMapper achievementInterestMapper;
 
@@ -31,4 +37,23 @@ public class AchievementInterestServiceImpl implements AchievementInterestServic
 	public int saveCancelAchievementInterest(String id) {
 		return achievementInterestMapper.deleteByPrimaryKey(id);
 	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AchievementInterestListBo> listAchievementInterest(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;
+		}
+		
+		params.put("uid", TokenManager.getUserId());
+
+		return (Pagination<AchievementInterestListBo>) findPage("findAchievementInterestListByPage",
+				"findAchievementInterestCount", params, pNo, pSize);
+	}
 }

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

@@ -370,7 +370,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 	}
 
 	@Override
-	public AchievementDetailBo selectAchievementSearchDetail(String id) {
+	public AchievementDetailBo selectAchievementSearchDetail(String uid, String id) {
 		return achievementMapper.selectAchievementSearchDetail(id);
 	}
 

+ 10 - 0
src/main/java/com/goafanti/common/mapper/AchievementInterestMapper.xml

@@ -79,4 +79,14 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  
+  <select id="findAchievementInterestListByPage" parameterType="String" resultType="com.goafanti.portal.bo.AchievementInterestListBo">
+  	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
+  		from achievement_interest ai
+  		left join achievement a on a.id = ai.achievement_id
+  		where ai.uid = #{uid,jdbcType=VARCHAR}
+  </select>
 </mapper>

+ 4 - 2
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -1078,11 +1078,13 @@
   		a.maturity_video_url as maturityVideoUrl, a.innovation, a.cooperation_mode as cooperationMode,
   		a.bargaining_mode as bargainingMode, a.technical_scene as technicalScene, a.breakthrough,
   		a.patent_case as patentCase, a.awards, a.team_des as teamDes, 
-  		a.parameter, a.tech_plan_url as techPlanUrl, a.business_plan_url as businessPlanUrl
+  		a.parameter, a.tech_plan_url as techPlanUrl, a.business_plan_url as businessPlanUrl,
+  		ai.id as achievementInterestId
   	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.id = #{id,jdbcType=VARCHAR}
+  	left join achievement_interest ai on ai.achievement_id = a.id and ai.uid = #{0}
+  	where a.id = #{1}
   </select>
   
 </mapper>

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

@@ -972,11 +972,12 @@
   		d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
   		d.fixed_cycle as fixedCycle, d.people_number as peopleNumber, d.fixed_scheme as fixedScheme,
   		d.cost_escrow as costEscrow, d.validity_period as validityPeriod, ui.username,
-  		oi.unit_name as unitName
+  		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
-  	where d.id = #{id,jdbcType=VARCHAR}
+  	left join demand_interest d on di.demand_id = d.id and di.uid = #{0}
+  	where d.id = #{1}
   </select>
   
 </mapper>

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

@@ -1,9 +1,13 @@
 package com.goafanti.demand.service;
 
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.portal.bo.AchievementInterestListBo;
+
 public interface DemandInterestService {
 
 	int saveCancelDemandInterest(String id);
 
 	void saveAchievementInterest(String id);
 
+
 }

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

@@ -55,6 +55,6 @@ public interface DemandService {
 			Integer industryCategoryB, Integer demandType, BigDecimal budgetCostLower, BigDecimal budgetCostUpper,
 			Integer pNo, Integer pSize);
 
-	DemandSearchDetailBo selectDemandSearchDetail(String id);
+	DemandSearchDetailBo selectDemandSearchDetail(String uid, String id);
 
 }

+ 11 - 2
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,12 +10,17 @@ import org.springframework.stereotype.Service;
 
 import com.goafanti.common.dao.DemandInterestMapper;
 import com.goafanti.common.model.DemandInterest;
+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.DemandManageListBo;
 import com.goafanti.demand.service.DemandInterestService;
+import com.goafanti.portal.bo.AchievementInterestListBo;
+
 @Service
-public class DemandInterestServiceImpl implements DemandInterestService {
+public class DemandInterestServiceImpl extends BaseMybatisDao<DemandInterestMapper> implements DemandInterestService {
 	@Autowired
-	private  DemandInterestMapper demandInterestMapper;
+	private DemandInterestMapper demandInterestMapper;
 
 	@Override
 	public int saveCancelDemandInterest(String id) {
@@ -31,4 +38,6 @@ public class DemandInterestServiceImpl implements DemandInterestService {
 		di.setUid(TokenManager.getUserId());
 		demandInterestMapper.insert(di);
 	}
+
+	
 }

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

@@ -303,7 +303,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	public List<AchievementDemandListBo> selectAchievementDemandListByDemandId(String id) {
 		return achievementDemandMapper.selectAchievementDemandListByDemandId(id);
 	}
-	
+
 	@Override
 	public void insertImport(List<DemandImportBo> data) {
 		if (null == data || data.isEmpty()) {
@@ -315,7 +315,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		List<DemandKeyword> demandKeywordList = new ArrayList<>();
 		Calendar now = Calendar.getInstance();
 		now.set(Calendar.MILLISECOND, 0);
-		for (DemandImportBo bo : data){
+		for (DemandImportBo bo : data) {
 			d = new Demand();
 			BeanUtils.copyProperties(bo, d);
 			d.setId(UUID.randomUUID().toString());
@@ -342,7 +342,7 @@ 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,
@@ -352,27 +352,27 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		if (!StringUtils.isBlank(keyword)) {
 			params.put("keyword", keyword);
 		}
-		
-		if (null != industryCategoryA){
+
+		if (null != industryCategoryA) {
 			params.put("industryCategoryA", industryCategoryA);
 		}
-		
-		if (null != industryCategoryB){
+
+		if (null != industryCategoryB) {
 			params.put("industryCategoryB", industryCategoryB);
 		}
-		
-		if (null != demandType){
+
+		if (null != demandType) {
 			params.put("demandType", demandType);
 		}
-		
-		if (null != budgetCostLower){
+
+		if (null != budgetCostLower) {
 			params.put("budgetCostLower", budgetCostLower);
 		}
-		
-		if (null != budgetCostUpper){
+
+		if (null != budgetCostUpper) {
 			params.put("budgetCostUpper", budgetCostUpper);
 		}
-		
+
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 		}
@@ -380,18 +380,15 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		if (pSize == null || pSize < 0 || pSize > 10) {
 			pSize = 10;
 		}
-		return (Pagination<DemandSearchListBo>) findPage("findSearchDemandListByPage",
-				"findSearchDemandCount", params, pNo, pSize);
+		return (Pagination<DemandSearchListBo>) findPage("findSearchDemandListByPage", "findSearchDemandCount", params,
+				pNo, pSize);
 	}
-	
+
 	@Override
-	public DemandSearchDetailBo selectDemandSearchDetail(String id) {
+	public DemandSearchDetailBo selectDemandSearchDetail(String uid, String id) {
 		return demandMapper.selectDemandSearchDetail(id);
 	}
 
-	
-	
-
 	private Map<String, Object> disposeParams(Integer auditStatus, String province, Integer serialNumber, String name,
 			String keyword, Integer infoSources, Integer demandType, String validityPeriodStartDate,
 			String validityPeriodEndDate, String username, Integer status, Integer releaseStatus,
@@ -563,9 +560,4 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		}
 	}
 
-	
-	
-
-	
-
 }

+ 14 - 0
src/main/java/com/goafanti/portal/bo/AchievementDetailBo.java

@@ -88,6 +88,20 @@ public class AchievementDetailBo extends AchievementSearchListBo {
 	 * 商业计划书URL
 	 */
 	private String businessPlanUrl;
+	
+	/**
+	 * 关注ID
+	 */
+	private String achievementInterestId;
+	
+
+	public String getAchievementInterestId() {
+		return achievementInterestId;
+	}
+
+	public void setAchievementInterestId(String achievementInterestId) {
+		this.achievementInterestId = achievementInterestId;
+	}
 
 	public String getSummary() {
 		return summary;

+ 92 - 0
src/main/java/com/goafanti/portal/bo/AchievementInterestListBo.java

@@ -0,0 +1,92 @@
+package com.goafanti.portal.bo;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.goafanti.common.constant.AFTConstants;
+
+public class AchievementInterestListBo {
+	private String	id;
+
+	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;
+	}
+
+	public void setAchievementId(String achievementId) {
+		this.achievementId = achievementId;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Integer getDeletedSign() {
+		return deletedSign;
+	}
+
+	public void setDeletedSign(Integer deletedSign) {
+		this.deletedSign = deletedSign;
+	}
+
+	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) {
+
+	}
+
+}

+ 14 - 0
src/main/java/com/goafanti/portal/bo/DemandSearchDetailBo.java

@@ -52,6 +52,20 @@ public class DemandSearchDetailBo extends DemandSearchListBo{
 	 * 有效期限
 	 */
 	private Date validityPeriod;
+	
+	/**
+	 * 关注ID
+	 */
+	private String demandInterestId;
+	
+
+	public String getDemandInterestId() {
+		return demandInterestId;
+	}
+
+	public void setDemandInterestId(String demandInterestId) {
+		this.demandInterestId = demandInterestId;
+	}
 
 	public String getTechnicalRequirements() {
 		return technicalRequirements;

+ 23 - 2
src/main/java/com/goafanti/portal/controller/PortalSearchApiController.java

@@ -21,8 +21,11 @@ import com.goafanti.common.enums.DemandAuditStatus;
 import com.goafanti.common.enums.DemandReleaseStatus;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.common.model.Demand;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.demand.service.DemandInterestService;
 import com.goafanti.demand.service.DemandService;
+import com.goafanti.portal.bo.AchievementInterestListBo;
 
 @RestController
 @RequestMapping(value = "/portal/search")
@@ -36,6 +39,24 @@ public class PortalSearchApiController extends BaseApiController {
 	@Resource
 	private DemandInterestService demandInterestService;
 	
+	/**
+	 * 科技成果"感兴趣列表"
+	 */
+	@RequestMapping(value = "/achievementInterestList", method = RequestMethod.GET)
+	private Result achievementInterestList(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);
+		}
+		Pagination<AchievementInterestListBo> aa = achievementInterestService.listAchievementInterest(pNo, pSize);
+		return res;
+	}
+	
 	
 	/**科技需求取消关注
 	 * 
@@ -160,7 +181,7 @@ public class PortalSearchApiController extends BaseApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			return res;
 		}
-		res.setData(achievementService.selectAchievementSearchDetail(id));
+		res.setData(achievementService.selectAchievementSearchDetail(TokenManager.getUserId(), id));
 		return res;
 	}
 
@@ -174,7 +195,7 @@ public class PortalSearchApiController extends BaseApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
 			return res;
 		}
-		res.setData(demandService.selectDemandSearchDetail(id));
+		res.setData(demandService.selectDemandSearchDetail(TokenManager.getUserId(), id));
 		return res;
 	}