Antiloveg 8 år sedan
förälder
incheckning
05baac767a

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

@@ -3,6 +3,7 @@ package com.goafanti.common.dao;
 import java.util.List;
 
 import com.goafanti.common.model.Lecture;
+import com.goafanti.lecture.bo.BigShotLectureListBo;
 import com.goafanti.lecture.bo.LectureListBo;
 
 public interface LectureMapper {
@@ -24,7 +25,9 @@ public interface LectureMapper {
 
 	Integer countHotNum();
 
-	LectureListBo listHot();
+	List<LectureListBo> listHot();
 
-	LectureListBo listDynamic();
+	List<LectureListBo> listDynamic();
+
+	List<BigShotLectureListBo> listBigShotLecture();
 }

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

@@ -3,6 +3,7 @@ package com.goafanti.common.dao;
 import java.util.List;
 
 import com.goafanti.common.model.Star;
+import com.goafanti.star.bo.BigShotStarListBo;
 import com.goafanti.star.bo.HotStarListBo;
 
 public interface StarMapper {
@@ -25,4 +26,6 @@ public interface StarMapper {
 	void deleteAll();
 
 	void insertBatch(List<Star> startList);
+
+	List<BigShotStarListBo> listBigShotStar();
 }

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

@@ -18,4 +18,6 @@ public interface UserInterestMapper {
     int updateByPrimaryKey(UserInterest record);
 
 	UserInterest findByFromUidAndToUid(@Param("fromUid")String fromUid, @Param("toUid")String toUid);
+
+	Integer countByToUid(String toUid);
 }

+ 16 - 0
src/main/java/com/goafanti/common/mapper/LectureMapper.xml

@@ -275,4 +275,20 @@
 	  		l.deleted_sign = 0
 	  	and l.dynamic = 1
   </select>
+  
+  <select id="listBigShotLecture" resultType="com.goafanti.lecture.bo.BigShotLectureListBo">
+  		select 
+	  		l.id,
+	  		l.uid,
+	  		l.name,
+	  		l.lecture_time as lectureTime,
+	  		l.summary,
+	  		l.lecture_url as lectureUrl,
+	  		ui.username 
+	  	from lecture l
+	  	left join  user_identity ui on ui.uid = l.uid
+	  	where 
+	  		l.deleted_sign = 0
+	  	and l.hot = 1
+  </select>
 </mapper>

+ 19 - 0
src/main/java/com/goafanti/common/mapper/StarMapper.xml

@@ -139,4 +139,23 @@
       )
     </foreach>
   </insert>
+  
+  <select id="listBigShotStar" resultType="com.goafanti.star.bo.BigShotStarListBo">
+  	select
+  		u.id as uid,
+  		u.number,
+  		ui.username,
+  		uc.engaged_field as engagedField,
+  		uc.professional_title as professionalTitle,
+  		uc.work_unit as workUnit,
+  		adc.achievement_count as achievementNum,
+  		info.person_portrait_url as personPortraitUrl
+  	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 
+  	where s.hot = 1 
+  </select>
 </mapper>

+ 7 - 0
src/main/java/com/goafanti/common/mapper/UserInterestMapper.xml

@@ -124,4 +124,11 @@
     WHERE
 	 ui.from_uid = #{fromUid,jdbcType=VARCHAR}
   </select>
+  
+  <select id="countByToUid" parameterType="java.lang.String" resultType="java.lang.Integer">
+  	select 
+  		count(1) 
+  	from user_interest 
+  	where to_uid = #{toUid,jdbcType=VARCHAR} 
+  </select>
 </mapper>

+ 5 - 0
src/main/java/com/goafanti/lecture/bo/BigShotLectureListBo.java

@@ -0,0 +1,5 @@
+package com.goafanti.lecture.bo;
+
+public class BigShotLectureListBo extends LectureListBo{
+
+}

+ 5 - 2
src/main/java/com/goafanti/lecture/service/LectureService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.goafanti.common.model.Lecture;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.lecture.bo.BigShotLectureListBo;
 import com.goafanti.lecture.bo.LectureListBo;
 
 public interface LectureService {
@@ -21,8 +22,10 @@ public interface LectureService {
 
 	Integer countHotNum();
 
-	LectureListBo listHot();
+	List<LectureListBo> listHot();
 
-	LectureListBo listDynamic();
+	List<LectureListBo> listDynamic();
+
+	List<BigShotLectureListBo> listBigShotLecture();
 
 }

+ 8 - 2
src/main/java/com/goafanti/lecture/service/impl/LectureServiceImpl.java

@@ -18,6 +18,7 @@ import com.goafanti.common.model.Lecture;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.lecture.bo.BigShotLectureListBo;
 import com.goafanti.lecture.bo.LectureListBo;
 import com.goafanti.lecture.service.LectureService;
 
@@ -106,13 +107,18 @@ public class LectureServiceImpl extends BaseMybatisDao<LectureMapper> implements
 	}
 
 	@Override
-	public LectureListBo listHot() {
+	public List<LectureListBo> listHot() {
 		return lectureMapper.listHot();
 	}
 
 	@Override
-	public LectureListBo listDynamic() {
+	public List<LectureListBo> listDynamic() {
 		return lectureMapper.listDynamic();
 	}
 
+	@Override
+	public List<BigShotLectureListBo> listBigShotLecture() {
+		return lectureMapper.listBigShotLecture();
+	}
+
 }

+ 53 - 0
src/main/java/com/goafanti/portal/controller/PortalBigShotController.java

@@ -0,0 +1,53 @@
+package com.goafanti.portal.controller;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.goafanti.lecture.bo.BigShotLectureListBo;
+import com.goafanti.lecture.service.LectureService;
+import com.goafanti.star.bo.BigShotStarListBo;
+import com.goafanti.star.service.StarService;
+import com.goafanti.user.service.UserInterestService;
+
+/**
+ * 大咖说
+ */
+@RestController
+public class PortalBigShotController {
+	@Resource
+	private StarService			starService;
+	@Resource
+	private UserInterestService	userInterestService;
+	@Resource
+	private LectureService		lectureService;
+
+	/**
+	 * 科技明星展示
+	 */
+	// @RequestMapping(value = "/portal/scienceTechnology/bigShot", method =
+	// RequestMethod.GET)
+	public ModelAndView bigShot() {
+		ModelAndView mv = new ModelAndView();
+		List<BigShotStarListBo> starList = starService.listBigShotStar();
+		if (null != starList && starList.size() > 0) {
+			Integer fansNum = 0;
+			for (BigShotStarListBo bo : starList) {
+				if (StringUtils.isNotBlank(bo.getUid())) {
+					fansNum = userInterestService.countByToUid(bo.getUid());
+					bo.setFansNum(fansNum);
+				}
+			}
+			mv.addObject("starList", starList);
+		}
+		List<BigShotLectureListBo> lectureList = lectureService.listBigShotLecture();
+		mv.addObject("lectureList", lectureList);
+		mv.setViewName("/portal/scienceTechnology/bigShot");
+		return mv;
+	}
+
+}

+ 25 - 2
src/main/java/com/goafanti/portal/controller/PortalStarController.java

@@ -1,11 +1,34 @@
 package com.goafanti.portal.controller;
 
+import javax.annotation.Resource;
+
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.lecture.service.LectureService;
+import com.goafanti.star.service.StarService;
+
+/**
+ * 科技明星
+ */
 @RestController
-@RequestMapping(value = "/portal/star")
-public class PortalStarController extends BaseApiController{
+public class PortalStarController extends BaseApiController {
+	@Resource
+	private StarService starService;
+	@Resource
+	private LectureService lectureService;
+	
+	
 	
+	//@RequestMapping(value = "/portal/scienceTechnology/star", method = RequestMethod.GET)
+	public ModelAndView star(){
+		ModelAndView mv = new ModelAndView();
+		lectureService.listDynamic();
+		//mv.addObject("lectureList", lectureList);
+		mv.setViewName("/portal/scienceTechnology/bigShot");
+		return mv;
+	}
 }

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

@@ -0,0 +1,26 @@
+package com.goafanti.star.bo;
+
+import com.goafanti.user.bo.StarListBo;
+
+public class BigShotStarListBo extends StarListBo {
+	private Integer	fansNum;
+
+	private String	personPortraitUrl;
+
+	public Integer getFansNum() {
+		return fansNum;
+	}
+
+	public void setFansNum(Integer fansNum) {
+		this.fansNum = fansNum;
+	}
+
+	public String getPersonPortraitUrl() {
+		return personPortraitUrl;
+	}
+
+	public void setPersonPortraitUrl(String personPortraitUrl) {
+		this.personPortraitUrl = personPortraitUrl;
+	}
+
+}

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

@@ -3,6 +3,7 @@ package com.goafanti.star.service;
 import java.util.List;
 
 import com.goafanti.common.model.Star;
+import com.goafanti.star.bo.BigShotStarListBo;
 import com.goafanti.star.bo.HotStarListBo;
 
 
@@ -14,4 +15,6 @@ public interface StarService {
 
 	void save(List<Star> star, String[] hot);
 
+	List<BigShotStarListBo> listBigShotStar();
+
 }

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

@@ -12,6 +12,7 @@ import com.goafanti.common.dao.StarMapper;
 import com.goafanti.common.enums.StarHotType;
 import com.goafanti.common.enums.StarType;
 import com.goafanti.common.model.Star;
+import com.goafanti.star.bo.BigShotStarListBo;
 import com.goafanti.star.bo.HotStarListBo;
 import com.goafanti.star.service.StarService;
 @Service
@@ -52,5 +53,9 @@ public class StarServiceImpl implements StarService {
 		}
 		starMapper.insertBatch(startList);
 	}
+	@Override
+	public List<BigShotStarListBo> listBigShotStar() {
+		return starMapper.listBigShotStar();
+	}
 
 }

+ 2 - 0
src/main/java/com/goafanti/user/service/UserInterestService.java

@@ -16,4 +16,6 @@ public interface UserInterestService {
 
 	Pagination<InterestUserListBo> listInterestUser(Integer pNo, Integer pSize);
 
+	Integer countByToUid(String uid);
+
 }

+ 5 - 0
src/main/java/com/goafanti/user/service/impl/UserInterestServiceImpl.java

@@ -62,4 +62,9 @@ public class UserInterestServiceImpl extends BaseMybatisDao<UserInterestMapper>
 		return (Pagination<InterestUserListBo>) findPage("findInterestUserListByPage",
 				"findInterestUserCount", params, pageNo, pageSize);
 	}
+
+	@Override
+	public Integer countByToUid(String toUid) {
+		return userInterestMapper.countByToUid(toUid);
+	}
 }