Преглед на файлове

Merge branch 'master' of ssh://admin@git.jishutao.com:55555/jishutao/jitao-server.git

wanghui преди 7 години
родител
ревизия
b975d3c402

+ 13 - 11
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -16,6 +16,7 @@ import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.banners.enums.BannersType;
 import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.fieldGlossoryBo;
+import com.goafanti.common.constant.PageConstants;
 import com.goafanti.common.model.Banners;
 import com.goafanti.common.model.Demand;
 import com.goafanti.common.utils.LimitLengthUtil;
@@ -422,6 +423,7 @@ public class WebpageController extends BaseController {
 	 * */
 	@RequestMapping(value = "/portal/demand")
 	public ModelAndView demand(HttpServletRequest request, ModelAndView modelview) {
+		String showLocation="web_demand_main";
 		String url =com.goafanti.common.utils.StringUtils.getDomainByHttpRequest(request);
 		modelview.setViewName("/portal/technologyTrading/demand");
 		//行业
@@ -429,12 +431,12 @@ public class WebpageController extends BaseController {
 		modelview.addObject("industryList", industryList);
 		
 		//最新需求
-		List<DemandListBo> recentDemandList=demandService.recentDemand(5,url);
+		List<DemandListBo> recentDemandList=demandService.recentDemand(5,url,showLocation);
 		LimitLengthUtil.limiteDemandCompanyAndName(recentDemandList, 18, 18);
 		modelview.addObject("recentDemandList",recentDemandList);
 //		 
 //		//加急需求
-		List<DemandListBo> urgentDemand=demandService.getUrgentDemand(5,url);
+		List<DemandListBo> urgentDemand=demandService.getUrgentDemand(5,url,showLocation);
 		List<DemandListBo> urgentDemand2=urgentDemand.subList(0, Math.min(2, urgentDemand.size()));
 		List<DemandListBo> urgentDemand3=urgentDemand.subList( Math.min(2, urgentDemand.size()),  Math.min(5, urgentDemand.size()));
 		System.out.print("u2:"+urgentDemand2.size()+" u3:"+urgentDemand3.size());
@@ -444,7 +446,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("urgentDemand3",urgentDemand3);
 		
 		//热点需求
-		List<DemandListBo> hotDemand=demandService.getHotDemand(5,url);
+		List<DemandListBo> hotDemand=demandService.getHotDemand(5,url,showLocation);
 		List<DemandListBo> hotDemand2=hotDemand.subList(0, Math.min(2, hotDemand.size()));
 		List<DemandListBo> hotDemand3=hotDemand.subList( Math.min(2, hotDemand.size()),  Math.min(5, hotDemand.size()));
 		System.out.print("u2:"+hotDemand2.size()+" u3:"+hotDemand3.size());
@@ -455,7 +457,7 @@ public class WebpageController extends BaseController {
 		
 		
 		//企业技术需求
-		List<DemandListBo> eightMaxCompanyDemand=demandService.companyDemand(8,url);
+		List<DemandListBo> eightMaxCompanyDemand=demandService.companyDemand(8,url,showLocation);
 		for(DemandListBo demandListBo:eightMaxCompanyDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -463,7 +465,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("companyDemandList",eightMaxCompanyDemand);
 		
 		//地区产业需求  最多4个
-		List<DemandListBo> fourMaxareaDemand=demandService.areaDemand(4,url);
+		List<DemandListBo> fourMaxareaDemand=demandService.areaDemand(4,url,showLocation);
 		for(DemandListBo demandListBo:fourMaxareaDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -472,7 +474,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("areaDemandList",fourMaxareaDemand);
 		
 		//产学研需求 最多9个
-		List<DemandListBo> nightMaxProLearnStudyDemand=demandService.proLearnStudyDemand(9,url);
+		List<DemandListBo> nightMaxProLearnStudyDemand=demandService.proLearnStudyDemand(9,url,showLocation);
 		for(DemandListBo demandListBo:nightMaxProLearnStudyDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -482,7 +484,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("proLearnStudyDemandList",nightMaxProLearnStudyDemand);
 		
 		//研产资金需求 最多4个
-		List<DemandListBo> fourMaxFundDemand=demandService.getFundCrowdDemand(4,url);
+		List<DemandListBo> fourMaxFundDemand=demandService.getFundCrowdDemand(4,url,showLocation);
 		for(DemandListBo demandListBo:fourMaxFundDemand) { 
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -491,7 +493,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("fundDemandList",fourMaxFundDemand);
 		
 		//技术人才需求
-		List<DemandListBo> sixMaxPersonnelDemand=demandService.getPersonnelDemand(6,url);
+		List<DemandListBo> sixMaxPersonnelDemand=demandService.getPersonnelDemand(6,url,showLocation);
 //		List <DemandListBo>fourMaxPersonnelDemand=personnelDemand.subList(0,Math.min(6, personnelDemand.size()));
 		for(DemandListBo demandListBo:sixMaxPersonnelDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
@@ -509,14 +511,14 @@ public class WebpageController extends BaseController {
 		DemandListBo demand=demandService.getDemandDetail(id, type);
 		int countInterest=demandService.getInterestCount(id);
 		demand.setCountInterest(countInterest+"");
-		modelAndView.addObject("demand",demand);
+		modelAndView.addObject("demand",demand); 
 		
 		//精品需求
-		List<DemandListBo>boutiqueDemandList=LimitLengthUtil.LimitListLengthRandomly(demandService.getBoutiqueDemandList(10,url),3,10); 
+		List<DemandListBo>boutiqueDemandList=LimitLengthUtil.LimitListLengthRandomly(demandService.getBoutiqueDemandList(10,url,""),3,10); 
 		modelAndView.addObject("reboutiquedemand",boutiqueDemandList); 
 		
 		//猜你喜欢
-		List<DemandListBo>guessYouLikeList=LimitLengthUtil.LimitListLengthRandomly(demandService.recentDemand(10, url), 4, 10);
+		List<DemandListBo>guessYouLikeList=LimitLengthUtil.LimitListLengthRandomly(demandService.recentDemand(10, url,""), 4, 10);
 		modelAndView.addObject("redemandlist",guessYouLikeList);
 	
 		//view

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

@@ -58,24 +58,24 @@ public interface DemandMapper {
 
 	Demand selectDemandFollow(String id);
 	
-	List<DemandListBo> selectRecentDemand(int size,String pattern);
+	List<DemandListBo> selectRecentDemand(int size,String pattern,String location);
 	
-	List<DemandListBo> selectCompanyDemand(int size,String pattern);
+	List<DemandListBo> selectCompanyDemand(int size,String pattern,String location);
 	
-	List<DemandListBo> getUrgentDemand(int size,String pattern);
+	List<DemandListBo> getUrgentDemand(int size,String pattern,String location);
 	
-	List<DemandListBo> getHotDemand(int size,String pattern);
+	List<DemandListBo> getHotDemand(int size,String pattern,String location);
 	
-	List<DemandListBo> getAreaDemand(int size,String pattern);
+	List<DemandListBo> getAreaDemand(int size,String pattern,String location);
 	
-	List<DemandListBo> 	getProLearnStudyDemand(int size,String pattern);
+	List<DemandListBo> 	getProLearnStudyDemand(int size,String pattern,String location);
 	
-	List<DemandListBo> getFundCrowdDemand(int size,String pattern);
+	List<DemandListBo> getFundCrowdDemand(int size,String pattern,String location);
 	
-	List<DemandListBo> getPersonnelDemand(int size,String pattern);
+	List<DemandListBo> getPersonnelDemand(int size,String pattern,String location);
 	
 	DemandListBo getDemandDetail(String id,Integer type);
 	
-	List<DemandListBo>getBoutiqueDemandList(int i,String pattern);
+	List<DemandListBo>getBoutiqueDemandList(int i,String pattern,String location);
 
 }

+ 6 - 5
src/main/java/com/goafanti/common/enums/DemandTypeEnum.java

@@ -6,7 +6,8 @@ public enum DemandTypeEnum {
 	PRO_LEARN_RESEARCH_DEMAND(2,"产学研合作需求"),
 	RESEARCH_PRO_FUND_DEMAND(3,"研产资金需求"),
 	AREA_INDUSTRY_DEMAND(4,"地区产业需求"),
-	EXPERT_DEMAND(5,"技术人才需求");
+	EXPERT_DEMAND(5,"技术人才需求"),
+	UNKNOW(6,"未知类型");
 	
 	private int i;
 	private String name;
@@ -30,14 +31,14 @@ public int getI() {
 
 DemandTypeEnum(int i,String name){
 	this.i=i;
-	this.name=name();
+	this.name=name;
 }
 
-public static String find(int i)
+public static DemandTypeEnum find(int i)
 {
 for(DemandTypeEnum demandTypeEnum:values()) {
-	if(demandTypeEnum.getI() == i)return demandTypeEnum.getName();
+	if(demandTypeEnum.getI() == i)return demandTypeEnum;
 }	
-return "未知类型";
+return UNKNOW;
 }
 }

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

@@ -1111,10 +1111,14 @@
   
   </select>
   <select id="selectRecentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
- select name,employer_name as employerName,d.id ,data_category as dataCategory,release_date as releaseDate,demand_type as demandType,budget_cost as budgetCost from demand d 
+ select d.name,employer_name as employerName,d.id ,data_category as dataCategory,release_date as releaseDate,demand_type as demandType,budget_cost as budgetCost 
+ ,fg.name as industryCategory1,fgg.name as industryCategory2
+ from demand d 
+     left join aft.field_glossory  fg  on fg.id=d.industry_category_a
+    left join aft.field_glossory fgg  on fgg.id=d.industry_category_b
   left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
- where audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+ where audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id  and instr(dp.publish_page,#{2})
  order by  release_date  desc limit #{0}
   </select>
   
@@ -1122,7 +1126,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
  select d.name,picture_url as pictureUrl,d.id from demand d  
    left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
- where d.data_category=1 and info_sources=1 and d.audit_status=2  and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+ where d.data_category=1 and info_sources=1 and d.audit_status=2  and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
   order by  release_date  desc limit #{0}
   </select>
   
@@ -1133,7 +1137,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
   from demand d  
     left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
-  where d.is_urgent=1 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+  where d.is_urgent=1 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
    order by  release_date  desc limit #{0}
   </select>
   
@@ -1143,7 +1147,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
   from demand d 
       left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
-   where d.is_hot=1 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+   where d.is_hot=1 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
     order by  release_date  desc limit #{0}
   </select>
   
@@ -1151,7 +1155,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
  select name,picture_url as pictureUrl ,problem_des as problemDes ,d.id from demand d 
        left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
-  where d.demand_type=4 and d.audit_status=2 and info_sources=1  and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+  where d.demand_type=4 and d.audit_status=2 and info_sources=1  and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
   order by  release_date  desc limit #{0}
   </select>
   
@@ -1161,14 +1165,14 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
     left join aft.field_glossory fgg  on fgg.id=d.industry_category_b
            left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
- where d.demand_type=2 and d.audit_status=2 and info_sources=1  and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+ where d.demand_type=2 and d.audit_status=2 and info_sources=1  and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
  order by  release_date  desc limit #{0}
   </select>
    <select id="getFundCrowdDemand" resultType="com.goafanti.demand.bo.DemandListBo">
   select d.name,picture_url as pictureUrl ,problem_des as problemDes ,d.id,crowd_cost as fundForCrowd,research_type as researchType from demand d  
              left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
-  where d.demand_type=3 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+  where d.demand_type=3 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
   order by  release_date 
    desc limit #{0}
   </select>
@@ -1177,7 +1181,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
   select d.name,picture_url as pictureUrl ,problem_des as problemDes ,d.id,budget_cost as fundForPersonnel from demand d  
  left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
-  where d.demand_type=5 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+  where d.demand_type=5 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
   order by  release_date  desc limit #{0}
   </select>
   
@@ -1194,7 +1198,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
  from demand d
  left join branch_information branchInfo on INSTR(branchInfo.domain_name,#{1})>0
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
-where d.boutique=1 and  dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
+where d.boutique=1 and  dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})
 order by release_date desc limit #{0}
   </select>  <select id="listMyDemand" resultType="com.goafanti.portal.bo.DemandSearchListBo">
 	select

+ 1 - 1
src/main/java/com/goafanti/common/utils/RandomUtil.java

@@ -13,7 +13,7 @@ public class RandomUtil {
                  randInt  = rand.nextInt(maxNum);//产生一个随机数
              }while(bool[randInt]);
             bool[randInt] = true;
-            System.out.println(randInt);
+//            System.out.println(randInt);
             res[i]=randInt;
        }
         return res;

+ 1 - 1
src/main/java/com/goafanti/demand/bo/DemandListBo.java

@@ -128,7 +128,7 @@ public class DemandListBo extends InputDemand{
 	public void setDemandType(Integer demandType) {
 		// TODO Auto-generated method stub
 		super.setDemandType(demandType);
-		setDemandTypeS(DemandTypeEnum.find(demandType.intValue()));
+		setDemandTypeS(DemandTypeEnum.find(demandType.intValue()).getName());
 		
 	}
 	

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

@@ -56,27 +56,27 @@ public interface DemandService {
 	Demand DemandFollowDetails(String id);
 	
 	//科技需求首页列表
-	List<DemandListBo> recentDemand(int size,String pattern);
+	List<DemandListBo> recentDemand(int size,String pattern,String showLocation);
 	
-	List<DemandListBo> companyDemand(int size,String pattern);
+	List<DemandListBo> companyDemand(int size,String pattern,String showLocation);
 	
-	List<DemandListBo> getUrgentDemand(int size,String pattern);
+	List<DemandListBo> getUrgentDemand(int size,String pattern,String showLocation);
 	
-	List<DemandListBo> getHotDemand(int size,String pattern);
+	List<DemandListBo> getHotDemand(int size,String pattern,String showLocation);
 	
-	List<DemandListBo> areaDemand(int size,String pattern); 
+	List<DemandListBo> areaDemand(int size,String pattern,String showLocation); 
 	
-	List<DemandListBo> proLearnStudyDemand(int size,String pattern);
+	List<DemandListBo> proLearnStudyDemand(int size,String pattern,String showLocation);
 	
-	List<DemandListBo> getFundCrowdDemand(int size,String pattern);
+	List<DemandListBo> getFundCrowdDemand(int size,String pattern,String showLocation);
 	
-	List<DemandListBo> getPersonnelDemand(int size,String pattern);
+	List<DemandListBo> getPersonnelDemand(int size,String pattern,String showLocation);
 	
 	DemandListBo getDemandDetail(String id,Integer type);
 	
 	int getInterestCount(String id);
 	
-	List<DemandListBo>getBoutiqueDemandList(int i,String pattern);
+	List<DemandListBo>getBoutiqueDemandList(int i,String pattern,String showLocation);
 	
 	DemandDetailBo selectDemandDetail(String id);
 	

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

@@ -751,52 +751,52 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	}
 		
 	@Override
-	public List<DemandListBo> recentDemand(int size,String pattern) {
+	public List<DemandListBo> recentDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.selectRecentDemand(size,pattern);
+		return demandMapper.selectRecentDemand(size,pattern,showLocation);
 	}
 	
 
 	@Override
-	public List<DemandListBo> companyDemand(int size,String pattern) {
+	public List<DemandListBo> companyDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.selectCompanyDemand(size,pattern);
+		return demandMapper.selectCompanyDemand(size,pattern,showLocation);
 	}
 
 	@Override
-	public List<DemandListBo> getUrgentDemand(int size,String pattern) {
+	public List<DemandListBo> getUrgentDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.getUrgentDemand(size,pattern);
+		return demandMapper.getUrgentDemand(size,pattern,showLocation);
 	}
 
 	@Override
-	public List<DemandListBo> getHotDemand(int size,String pattern) {
+	public List<DemandListBo> getHotDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.getHotDemand(size,pattern);
+		return demandMapper.getHotDemand(size,pattern,showLocation);
 	}
 
 	@Override
-	public List<DemandListBo> areaDemand(int size,String pattern) {
+	public List<DemandListBo> areaDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.getAreaDemand(size,pattern);
+		return demandMapper.getAreaDemand(size,pattern,showLocation);
 	}
 
 	@Override
-	public List<DemandListBo> proLearnStudyDemand(int size,String pattern) {
+	public List<DemandListBo> proLearnStudyDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.getProLearnStudyDemand(size,pattern);
+		return demandMapper.getProLearnStudyDemand(size,pattern,showLocation);
 	}
 
 	@Override
-	public List<DemandListBo> getFundCrowdDemand(int size,String pattern) {
+	public List<DemandListBo> getFundCrowdDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.getFundCrowdDemand(size,pattern);
+		return demandMapper.getFundCrowdDemand(size,pattern,showLocation);
 	}
 
 	@Override
-	public List<DemandListBo> getPersonnelDemand(int size,String pattern) {
+	public List<DemandListBo> getPersonnelDemand(int size,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.getPersonnelDemand(size,pattern);
+		return demandMapper.getPersonnelDemand(size,pattern,showLocation);
 	}
 	
 	@SuppressWarnings("unchecked")
@@ -839,9 +839,9 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	}
 
 	@Override
-	public List<DemandListBo> getBoutiqueDemandList(int i,String pattern) {
+	public List<DemandListBo> getBoutiqueDemandList(int i,String pattern,String showLocation) {
 		// TODO Auto-generated method stub
-		return demandMapper.getBoutiqueDemandList(i,pattern);
+		return demandMapper.getBoutiqueDemandList(i,pattern,showLocation);
 	}