Antiloveg 8 years ago
parent
commit
ad610ffe72

+ 1 - 1
src/main/java/com/goafanti/admin/controller/AdminStarApiController.java

@@ -71,7 +71,7 @@ public class AdminStarApiController extends BaseApiController {
 	@RequestMapping(value = "/starList", method = RequestMethod.GET)
 	public Result starList() {
 		Result res = new Result();
-		res.setData(starService.listStarList());
+		res.setData(starService.listStarList(null));
 		return res;
 	}
 

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

@@ -21,11 +21,11 @@ public interface StarMapper {
 
 	List<HotStarListBo> listHostStar();
 
-	List<HotStarListBo> listStarList();
+	List<HotStarListBo> listStarList(String uid);
 
 	void deleteAll();
 
 	void insertBatch(List<Star> startList);
 
-	List<BigShotStarListBo> listBigShotStar();
+	List<BigShotStarListBo> listBigShotStar(String uid);
 }

+ 6 - 3
src/main/java/com/goafanti/common/mapper/StarMapper.xml

@@ -108,7 +108,7 @@
   	where s.hot = 1 and ui.celebrity = 1
   </select>
   
-  <select id="listStarList"  resultType="com.goafanti.star.bo.HotStarListBo">
+  <select id="listStarList"  parameterType="java.lang.String" resultType="com.goafanti.star.bo.HotStarListBo">
   	select
   		u.id as uid,
   		u.number,
@@ -124,6 +124,7 @@
   	left join user_career uc on uc.uid = s.uid
   	left join achievement_demand_count adc on adc.uid = s.uid 
   	left join user_info info on info.uid = s.uid
+  	left join user_interest interest on interest.to_uid = s.uid and interest.from_uid = #{uid,jdbcType=VARCHAR}
   	where s.star = 1 and ui.celebrity = 1
   </select>
   
@@ -142,7 +143,7 @@
     </foreach>
   </insert>
   
-  <select id="listBigShotStar" resultType="com.goafanti.star.bo.BigShotStarListBo">
+  <select id="listBigShotStar" parameterType="java.lang.String" resultType="com.goafanti.star.bo.BigShotStarListBo">
   	select
   		u.id as uid,
   		u.number,
@@ -151,13 +152,15 @@
   		uc.professional_title as professionalTitle,
   		uc.work_unit as workUnit,
   		adc.achievement_count as achievementNum,
-  		info.person_portrait_url as personPortraitUrl
+  		info.person_portrait_url as personPortraitUrl,
+  		interest.id as interestId
   	from star s
   	left join user u on u.id = s.uid
   	left join user_info info on info.uid = s.uid
   	left join user_identity ui on ui.uid = s.uid
   	left join user_career uc on uc.uid = s.uid
   	left join achievement_demand_count adc on adc.uid = s.uid 
+  	left join user_interest interest on interest.to_uid = s.uid and interest.from_uid = #{uid,jdbcType=VARCHAR}
   	where s.hot = 1 
   </select>
 </mapper>

+ 3 - 1
src/main/java/com/goafanti/portal/controller/PortalBigShotController.java

@@ -12,6 +12,8 @@ import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.model.User;
+import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.engagedFieldGlossory.service.EngagedFieldGlossoryService;
 import com.goafanti.lecture.bo.BigShotLectureListBo;
 import com.goafanti.lecture.service.LectureService;
@@ -36,7 +38,7 @@ public class PortalBigShotController extends BaseController {
 	@RequestMapping(value = "/portal/scienceTechnology/bigShot", method = RequestMethod.GET)
 	public ModelAndView bigShot() {
 		ModelAndView mv = new ModelAndView();
-		List<BigShotStarListBo> starList = starService.listBigShotStar(AFTConstants.BIG_SHOT_STAR_CACHE_KEY);
+		List<BigShotStarListBo> starList = starService.listBigShotStar(AFTConstants.BIG_SHOT_STAR_CACHE_KEY, TokenManager.getToken() instanceof User ? TokenManager.getUserId() : null);
 		if (null != starList && starList.size() > 0) {
 			for (BigShotStarListBo bo : starList) {
 				if (StringUtils.isNotBlank(bo.getUid())) {

+ 3 - 1
src/main/java/com/goafanti/portal/controller/PortalStarController.java

@@ -12,6 +12,8 @@ import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.model.User;
+import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.engagedFieldGlossory.service.EngagedFieldGlossoryService;
 import com.goafanti.lecture.bo.LectureListBo;
 import com.goafanti.lecture.service.LectureService;
@@ -39,7 +41,7 @@ public class PortalStarController extends BaseController {
 		List<LectureListBo> lectureDynamicList = lectureService
 				.listDynamic(AFTConstants.LECTURE_DYNAMIC_LIST_CACHE_KEY);
 		mv.addObject("lectureDynamicList", lectureDynamicList);
-		List<HotStarListBo> starList = starService.listStarList();
+		List<HotStarListBo> starList = starService.listStarList(TokenManager.getToken() instanceof User ? TokenManager.getUserId() : null);
 		if (null != starList && starList.size() > 0) {
 			for (HotStarListBo bo : starList) {
 				if (StringUtils.isNotBlank(bo.getUid())) {

+ 10 - 0
src/main/java/com/goafanti/star/bo/BigShotStarListBo.java

@@ -7,6 +7,8 @@ public class BigShotStarListBo extends StarListBo {
 
 	private String	personPortraitUrl;
 
+	private String	interestId;
+
 	public Integer getFansNum() {
 		return fansNum;
 	}
@@ -23,4 +25,12 @@ public class BigShotStarListBo extends StarListBo {
 		this.personPortraitUrl = personPortraitUrl;
 	}
 
+	public String getInterestId() {
+		return interestId;
+	}
+
+	public void setInterestId(String interestId) {
+		this.interestId = interestId;
+	}
+
 }

+ 12 - 1
src/main/java/com/goafanti/star/bo/HotStarListBo.java

@@ -2,11 +2,13 @@ package com.goafanti.star.bo;
 
 import com.goafanti.user.bo.StarListBo;
 
-public class HotStarListBo extends StarListBo{
+public class HotStarListBo extends StarListBo {
 	private Integer	fansNum;
 
 	private String	personPortraitUrl;
 
+	private String	interestId;
+
 	public Integer getFansNum() {
 		return fansNum;
 	}
@@ -22,4 +24,13 @@ public class HotStarListBo extends StarListBo{
 	public void setPersonPortraitUrl(String personPortraitUrl) {
 		this.personPortraitUrl = personPortraitUrl;
 	}
+
+	public String getInterestId() {
+		return interestId;
+	}
+
+	public void setInterestId(String interestId) {
+		this.interestId = interestId;
+	}
+
 }

+ 2 - 2
src/main/java/com/goafanti/star/service/StarService.java

@@ -11,11 +11,11 @@ public interface StarService {
 
 	List<HotStarListBo> listHotStar();
 
-	List<HotStarListBo> listStarList();
+	List<HotStarListBo> listStarList(String uid);
 
 	void save(List<Star> star, String[] hot);
 
-	public List<BigShotStarListBo> listBigShotStar(Integer bigShotStarCacheKey);
+	public List<BigShotStarListBo> listBigShotStar(Integer bigShotStarCacheKey, String uid);
 	
 	public void clearBigShotStarList(Integer bigShotStarCacheKey);
 	

+ 4 - 4
src/main/java/com/goafanti/star/service/impl/StarServiceImpl.java

@@ -33,8 +33,8 @@ public class StarServiceImpl implements StarService {
 	}
 
 	@Override
-	public List<HotStarListBo> listStarList() {
-		return starMapper.listStarList();
+	public List<HotStarListBo> listStarList(String uid) {
+		return starMapper.listStarList(uid);
 	}
 
 	@Override
@@ -60,8 +60,8 @@ public class StarServiceImpl implements StarService {
 
 	@Override
 	@Cacheable(value = "BigShotStarListCache", key = "'BigShotStarList:'+#bigShotStarCacheKey")
-	public List<BigShotStarListBo> listBigShotStar(Integer bigShotStarCacheKey) {
-		return starMapper.listBigShotStar();
+	public List<BigShotStarListBo> listBigShotStar(Integer bigShotStarCacheKey, String uid) {
+		return starMapper.listBigShotStar(uid);
 	}
 
 	@Override

+ 1 - 0
src/main/webapp/WEB-INF/views/portal/scienceTechnology/bigShot.html

@@ -61,6 +61,7 @@
 						<img th:if="${star.personPortraitUrl!=null && star.personPortraitUrl!=''}" th:src="${avatarUploadHost + star.personPortraitUrl}">
 						<a href="#">
                             <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
+                            <input type="hidden" id="interestId" th:value=${star.interestId}>
                             关注
                         </a>
 					</div>

+ 1 - 0
src/main/webapp/WEB-INF/views/portal/scienceTechnology/star.html

@@ -159,6 +159,7 @@
 						<img th:if="${star.personPortraitUrl} != null" th:src="${avatarUploadHost + star.personPortraitUrl}">
 						<a href="#">
                             <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
+                            <input type="hidden" id="interestId" th:value=${star.interestId}>
                             关注
                         </a>
 					</div>