Browse Source

投放修改

jun.zhou 9 years ago
parent
commit
bb6066d73c

+ 10 - 3
src/main/java/com/cloudcross/ssp/service/impl/PlaceClassInformationService.java

@@ -1,5 +1,6 @@
 package com.cloudcross.ssp.service.impl;
 package com.cloudcross.ssp.service.impl;
 
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -82,10 +83,16 @@ public class PlaceClassInformationService implements IPlaceClassInformationServi
 	@Override
 	@Override
 	public List<PlaceClassInformation> queryPlaceClassInformationByAdgroupId(Long adgroupId) {
 	public List<PlaceClassInformation> queryPlaceClassInformationByAdgroupId(Long adgroupId) {
 		//场景小类ID
 		//场景小类ID
+		
 		List<Long> placeIdList = adGroupPlaceService.queryPlaceByAdgroupId(adgroupId);
 		List<Long> placeIdList = adGroupPlaceService.queryPlaceByAdgroupId(adgroupId);
-		Map<String,Object> condition = new HashMap<String,Object>();
-		condition.put("placeIdList", placeIdList);
-		return myBatisDao.getList("placeClassInformationSqlMapper.queryPlaceClassInfoByplaceId", condition);
+		if(placeIdList != null && placeIdList.size()>0){
+			Map<String,Object> condition = new HashMap<String,Object>();
+			condition.put("placeIdList", placeIdList);
+			return myBatisDao.getList("placeClassInformationSqlMapper.queryPlaceClassInfoByplaceId", condition);
+		}else{
+			return new ArrayList<PlaceClassInformation>();
+		}
+		
 	}
 	}
 	public List<Long>queryPlaceClassIndfoIdByAdgroupId(Long adgroupId){
 	public List<Long>queryPlaceClassIndfoIdByAdgroupId(Long adgroupId){
 		return myBatisDao.getList("placeClassInformationSqlMapper.queryClassIdByAdgroupId", adgroupId);
 		return myBatisDao.getList("placeClassInformationSqlMapper.queryClassIdByAdgroupId", adgroupId);

+ 19 - 18
src/main/java/com/cloudcross/ssp/web/advertiser/main/ad/target/OperatorAdGroupController.java

@@ -230,7 +230,7 @@ public class OperatorAdGroupController extends SimpleController{
 	 */
 	 */
 	@RequestMapping("/zonelist")
 	@RequestMapping("/zonelist")
 	@ResponseBody
 	@ResponseBody
-	public List<Zone> queryZoneByPosition(String position){
+	public List<Zone> queryZoneByPosition(String position,Long adgroupId){
 		Map<String,Object>condition = new HashMap<String,Object>();
 		Map<String,Object>condition = new HashMap<String,Object>();
 		List<Integer> positionList = new ArrayList<Integer>();
 		List<Integer> positionList = new ArrayList<Integer>();
 		if(position != null && position != ""){
 		if(position != null && position != ""){
@@ -240,7 +240,11 @@ public class OperatorAdGroupController extends SimpleController{
 			}
 			}
 			condition.put("positionList", positionList);
 			condition.put("positionList", positionList);
 			condition.put("operatorId", getLoginUser().getOperatorId());
 			condition.put("operatorId", getLoginUser().getOperatorId());
-			return this.zoneService.queryZoneByCondition(condition);
+			//所有满足条件的广告位
+			List<Zone>all = this.zoneService.queryZoneByCondition(condition);
+			//已选广告位
+			List<Zone> selectZoneList =  this.zoneService.queryZoneByAdgroupId(adgroupId);
+			return getUnSelectZoneList(selectZoneList,all);
 		}
 		}
 		return new ArrayList<Zone>();
 		return new ArrayList<Zone>();
 	}
 	}
@@ -301,7 +305,6 @@ public class OperatorAdGroupController extends SimpleController{
 				}
 				}
 				placeIdStr = placeIdStr + selectedPlaceList.get(i).getId();
 				placeIdStr = placeIdStr + selectedPlaceList.get(i).getId();
 			}
 			}
-			model.addAttribute("placeStatus", placeStatus);
 			model.addAttribute("placeIdStr", placeIdStr);
 			model.addAttribute("placeIdStr", placeIdStr);
 			model.addAttribute("placeList", placeList);
 			model.addAttribute("placeList", placeList);
 		}
 		}
@@ -321,17 +324,20 @@ public class OperatorAdGroupController extends SimpleController{
 					continue;
 					continue;
 				}
 				}
 				placeIdStr = placeIdStr + selectGroupList.get(i).getId();
 				placeIdStr = placeIdStr + selectGroupList.get(i).getId();
-			}
-			model.addAttribute("placeStatus", placeStatus);
+			}	
 			model.addAttribute("placeIdStr", placeIdStr);
 			model.addAttribute("placeIdStr", placeIdStr);
 			model.addAttribute("placeList", allWifiGroupInfoList);
 			model.addAttribute("placeList", allWifiGroupInfoList);
 		}
 		}
-		
+		model.addAttribute("placeStatus", placeStatus);
 		
 		
 		//已选广告位
 		//已选广告位
 		List<Zone> selectZoneList =  this.zoneService.queryZoneByAdgroupId(id);
 		List<Zone> selectZoneList =  this.zoneService.queryZoneByAdgroupId(id);
+		Map<String,Object> condition = new HashMap<String,Object>();
+		condition.put("operatorId", getLoginUser().getOperatorId());
+		//全部广告位
+		List<Zone> allZoneList = zoneService.queryZoneByCondition(condition);
 		//未选广告位
 		//未选广告位
-		List<Zone> unselectZoneList = getUnSelectZoneList(selectZoneList);
+		List<Zone> unselectZoneList = getUnSelectZoneList(selectZoneList,allZoneList);
 		model.addAttribute("selectZoneList", selectZoneList);
 		model.addAttribute("selectZoneList", selectZoneList);
 		model.addAttribute("unselectZoneList", unselectZoneList);
 		model.addAttribute("unselectZoneList", unselectZoneList);
 		
 		
@@ -415,28 +421,23 @@ public class OperatorAdGroupController extends SimpleController{
 	 * @param select 已选广告位
 	 * @param select 已选广告位
 	 * @return  未选广告位
 	 * @return  未选广告位
 	 */
 	 */
-	private List<Zone> getUnSelectZoneList(List<Zone> select){
-		Map<String,Object> condition = new HashMap<String,Object>();
-		condition.put("operatorId", getLoginUser().getOperatorId());
-		//全部广告位
-		List<Zone> allZoneList = zoneService.queryZoneByCondition(condition);
-		
-		if(select != null && select.size()>0){
+	private List<Zone> getUnSelectZoneList(List<Zone> select,List<Zone>all){
+		if(select != null && select.size()>0 &&all != null && all.size()>0){
 			int selectLen = select.size();
 			int selectLen = select.size();
-			int allLen = allZoneList.size();
+			int allLen = all.size();
 			for(int i=0;i<selectLen;i++){
 			for(int i=0;i<selectLen;i++){
 				Long selectId = select.get(i).getId();
 				Long selectId = select.get(i).getId();
 				for(int j=0;j<allLen;j++){
 				for(int j=0;j<allLen;j++){
-					Long allId = allZoneList.get(j).getId();
+					Long allId = all.get(j).getId();
 					if(selectId.equals(allId)){
 					if(selectId.equals(allId)){
-						allZoneList.remove(j);
+						all.remove(j);
 						break;
 						break;
 					}
 					}
 				}
 				}
 			}
 			}
 			
 			
 		}
 		}
-		return allZoneList;
+		return all;
 	}
 	}
 	
 	
 	/**
 	/**