Browse Source

投放修改

jun.zhou 9 years ago
parent
commit
ee373be567

+ 3 - 3
src/main/java/com/cloudcross/ssp/model/AdGroup.java

@@ -71,7 +71,7 @@ public final class AdGroup implements ISelector{
 	//是否全客网站
 	private Integer site;
 	//操作系统 1-iOS,2-Android,3-WP,4-Symbian,5-MAC OS,6-Windows,7-other
-	private Integer os;
+	private String os;
 	//广告位ID集合
 	private List<Long> zoneIdList;
 	//场景ID集合
@@ -377,11 +377,11 @@ public final class AdGroup implements ISelector{
 	
 	
 	
-	public Integer getOs() {
+	public String getOs() {
 		return os;
 	}
 
-	public void setOs(Integer os) {
+	public void setOs(String os) {
 		this.os = os;
 	}
 

+ 0 - 10
src/main/java/com/cloudcross/ssp/web/advertiser/main/ad/target/AdGroupController.java

@@ -480,15 +480,6 @@ public class AdGroupController extends SimpleController {
 			}
 		}
 		
-		/*List<AdGroupPlace> adGroupPlaceList = adGroupPlaceService.findAll(adGroup.getId());
-		for(int i = 0; i < adGroupPlaceList.size(); i++) {
-			//如果遍历到最后一个时就不必再加逗号
-			if(i == (adGroupPlaceList.size() - 1)) {
-				place = place + adGroupPlaceList.get(i).getPlaceId();
-			} else {
-				place = place + adGroupPlaceList.get(i).getPlaceId() + ",";
-			}
-		}*/
 		
 		// 千次转换
 	    adGroup.setMaxImpression(adGroup.getMaxImpression() / 1000);
@@ -555,7 +546,6 @@ public class AdGroupController extends SimpleController {
 		model.addAttribute("activeTime", activeTime);
 		model.addAttribute("place",place);
 		model.addAttribute("adGroup", adGroup);
-		//model.addAttribute("adGroupPlaceList",adGroupPlaceList);
 		model.addAllAttributes(paramMap);
 		return page("edit");
 	}

+ 67 - 27
src/main/java/com/cloudcross/ssp/web/advertiser/main/ad/target/OperatorAdGroupController.java

@@ -281,19 +281,52 @@ public class OperatorAdGroupController extends SimpleController{
 		Campaign campaign = campaignService.findById(adGroup.getCampaignId());
 		model.addAttribute("budget", campaign.getTotalBudget());
 		
-		//找到所有的大场景场景,并且显示出来
-		List<PlaceClassInformation> placeList = placeClassInformationService.findAll();
+		Integer placeStatus = -1;//场景状态   1表示场景,2表示分组
+		String placeIdStr = "";
+		int len = 0;
+		/**
+		 * 处理场景
+		 */
 		//找到已选场景,拼接ID字符串
 		List<PlaceClassInformation> selectedPlaceList =  this.placeClassInformationService.queryPlaceClassInformationByAdgroupId(id);
-		String placeIdStr = "";
-		for(PlaceClassInformation pci:selectedPlaceList){
-			placeIdStr = placeIdStr + pci.getId()+",";
+		if(null != selectedPlaceList && selectedPlaceList.size()>0){
+			placeStatus = 1;
+			//找到所有的大场景场景,并且显示出来
+			List<PlaceClassInformation> placeList = placeClassInformationService.findAll();
+			len = selectedPlaceList.size();
+			for(int i=0;i<len;i++){
+				if(i<len-1){
+					placeIdStr = placeIdStr + selectedPlaceList.get(i).getId()+",";
+					continue;
+				}
+				placeIdStr = placeIdStr + selectedPlaceList.get(i).getId();
+			}
+			model.addAttribute("placeStatus", placeStatus);
+			model.addAttribute("placeIdStr", placeIdStr);
+			model.addAttribute("placeList", placeList);
 		}
-		if(null != placeIdStr && !"".equals(placeIdStr)){
-			placeIdStr = placeIdStr.substring(0, placeIdStr.length()-1);
+
+		//已选分组,字符串拼接
+		List<WifiGroupInfo> selectGroupList = this.wifiGroupInfoService.queryWifiGroupInfoByadgroupId(id);
+		if(selectGroupList != null && selectGroupList.size()>0){
+			placeStatus = 2;
+			//全部分组
+			Map<String,Object>condition = new HashMap<String,Object>();
+			condition.put("operatorId", getLoginUser().getOperatorId());
+			List<WifiGroupInfo> allWifiGroupInfoList = this.wifiGroupInfoService.queryWifiGroupInfoByCondition(condition);
+			len = selectGroupList.size();
+			for(int i=0;i<len;i++){
+				if(i<len-1){
+					placeIdStr = placeIdStr + selectGroupList.get(i).getId() + ",";
+					continue;
+				}
+				placeIdStr = placeIdStr + selectGroupList.get(i).getId();
+			}
+			model.addAttribute("placeStatus", placeStatus);
+			model.addAttribute("placeIdStr", placeIdStr);
+			model.addAttribute("placeList", allWifiGroupInfoList);
 		}
-		model.addAttribute("placeIdStr", placeIdStr);
-		model.addAttribute("placeList", placeList);
+		
 		
 		//已选广告位
 		List<Zone> selectZoneList =  this.zoneService.queryZoneByAdgroupId(id);
@@ -302,21 +335,7 @@ public class OperatorAdGroupController extends SimpleController{
 		model.addAttribute("selectZoneList", selectZoneList);
 		model.addAttribute("unselectZoneList", unselectZoneList);
 		
-		//全部分组
-		Map<String,Object>condition = new HashMap<String,Object>();
-		condition.put("operatorId", getLoginUser().getOperatorId());
-		List<WifiGroupInfo> allWifiGroupInfoList = this.wifiGroupInfoService.queryWifiGroupInfoByCondition(condition);
-		//已选分组,字符串拼接
-		List<WifiGroupInfo> selectGroupList = this.wifiGroupInfoService.queryWifiGroupInfoByadgroupId(id);
-		String groupIdStr = "";
-		for(WifiGroupInfo group:selectGroupList){
-			groupIdStr = groupIdStr + group.getId() + ",";
-		}
-		if(null != groupIdStr && !"".equals(groupIdStr)){
-			groupIdStr = groupIdStr.substring(0,groupIdStr.length()-1);
-		}
-		model.addAttribute("groupIdStr", groupIdStr);
-		model.addAttribute("allWifiGroupInfoList", allWifiGroupInfoList);
+		
 		
 		
 		// 千次转换
@@ -375,7 +394,13 @@ public class OperatorAdGroupController extends SimpleController{
 					model.addAttribute("time", tmpDirect.getBackShow());
 				}
 			}
-		}	
+		}
+		
+		model.addAttribute("campaignId", campaignId);
+		model.addAttribute("advertiserId", campaign.getAdvertiserId());	
+		model.addAttribute("orderId", campaign.getOrderId());
+		model.addAttribute("agentId", campaign.getAgentId());
+		
 		model.addAttribute("areas", areas);
 		model.addAttribute("selectedwifi", selectedWifi);
 		model.addAttribute("cacheSelected", cacheSelected);
@@ -390,12 +415,27 @@ public class OperatorAdGroupController extends SimpleController{
 	 * @param select 已选广告位
 	 * @return  未选广告位
 	 */
-	List<Zone> getUnSelectZoneList(List<Zone> select){
+	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);
-		allZoneList.removeAll(select);
+		
+		if(select != null && select.size()>0){
+			int selectLen = select.size();
+			int allLen = allZoneList.size();
+			for(int i=0;i<selectLen;i++){
+				Long selectId = select.get(i).getId();
+				for(int j=0;j<allLen;j++){
+					Long allId = allZoneList.get(j).getId();
+					if(selectId.equals(allId)){
+						allZoneList.remove(j);
+						break;
+					}
+				}
+			}
+			
+		}
 		return allZoneList;
 	}