|
@@ -23,9 +23,11 @@ import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.cloudcross.ssp.base.utils.freemarker.FreemarkerTemplateProcessor;
|
|
import com.cloudcross.ssp.base.utils.freemarker.FreemarkerTemplateProcessor;
|
|
import com.cloudcross.ssp.base.web.SimpleController;
|
|
import com.cloudcross.ssp.base.web.SimpleController;
|
|
|
|
+import com.cloudcross.ssp.common.consts.DirectType;
|
|
import com.cloudcross.ssp.common.utils.AdvertiserSortByDate;
|
|
import com.cloudcross.ssp.common.utils.AdvertiserSortByDate;
|
|
import com.cloudcross.ssp.common.utils.Common;
|
|
import com.cloudcross.ssp.common.utils.Common;
|
|
import com.cloudcross.ssp.common.utils.Pager;
|
|
import com.cloudcross.ssp.common.utils.Pager;
|
|
@@ -213,6 +215,7 @@ public class OperatorAdGroupController extends SimpleController{
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@RequestMapping("/zonelist")
|
|
@RequestMapping("/zonelist")
|
|
|
|
+ @ResponseBody
|
|
public List<Zone> queryZoneByPosition(Integer position){
|
|
public List<Zone> queryZoneByPosition(Integer position){
|
|
Map<String,Object>condition = new HashMap<String,Object>();
|
|
Map<String,Object>condition = new HashMap<String,Object>();
|
|
condition.put("position", position);
|
|
condition.put("position", position);
|
|
@@ -225,6 +228,7 @@ public class OperatorAdGroupController extends SimpleController{
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@RequestMapping("/wifiGroupInfoList")
|
|
@RequestMapping("/wifiGroupInfoList")
|
|
|
|
+ @ResponseBody
|
|
public List<WifiGroupInfo> queryWifiGroupInfoByCondition(){
|
|
public List<WifiGroupInfo> queryWifiGroupInfoByCondition(){
|
|
Map<String,Object>condition = new HashMap<String,Object>();
|
|
Map<String,Object>condition = new HashMap<String,Object>();
|
|
condition.put("operatorId",getLoginUser().getOperatorId());
|
|
condition.put("operatorId",getLoginUser().getOperatorId());
|
|
@@ -240,9 +244,99 @@ public class OperatorAdGroupController extends SimpleController{
|
|
return this.placeService.findAll();
|
|
return this.placeService.findAll();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- public String editWithOperator(){
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 媒体自投修改
|
|
|
|
+ * @param model
|
|
|
|
+ * @param paramMap
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/edit")
|
|
|
|
+ public String edit(Model model,Long adGroupId) {
|
|
|
|
+ AdGroup adGroup = adGroupService.findById(adGroupId);
|
|
|
|
+
|
|
|
|
+ //找到这个投放对应的活动,然后保存活动预算
|
|
|
|
+ Campaign campaign = campaignService.findById(adGroup.getCampaignId());
|
|
|
|
+ model.addAttribute("budget", campaign.getTotalBudget());
|
|
|
|
+
|
|
|
|
+ //找到所有的场景,并且显示出来
|
|
|
|
+ List<Place> placeList = placeService.findAll();
|
|
|
|
+
|
|
|
|
+ //获取所有已选择的场景并且用,分割存放到place里面
|
|
|
|
+ String place = "0,";
|
|
|
|
+ List<AdGroupPlace> adGroupPlaceList = adGroupPlaceService.findAll(adGroup.getId());
|
|
|
|
+ for(AdGroupPlace pc:adGroupPlaceList) {
|
|
|
|
+ if(pc != adGroupPlaceList) {
|
|
|
|
+ place += pc.getPlaceId() + ",";
|
|
|
|
+ }else {
|
|
|
|
+ place += adGroupPlaceList;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 千次转换
|
|
|
|
+ adGroup.setMaxImpression(adGroup.getMaxImpression() / 1000);
|
|
|
|
+ adGroup.setDailyMaxImpression(adGroup.getDailyMaxImpression() / 1000);
|
|
|
|
+ /**
|
|
|
|
+ * 把数据库里面的日期转换为前端的需要的格式显示
|
|
|
|
+ */
|
|
|
|
+ String activeTime = "";
|
|
|
|
+ SimpleDateFormat formatter;
|
|
|
|
+ formatter = new SimpleDateFormat ("yyyy-MM-dd");
|
|
|
|
+ String startTime = formatter.format(adGroup.getStartDate());
|
|
|
|
+ String endTime = formatter.format(adGroup.getEndDate());
|
|
|
|
+ activeTime = startTime + " to " + endTime;
|
|
|
|
+
|
|
|
|
+ //找到所有的已选择的wifi
|
|
|
|
+ List<Wifi> adGroupWifiList = wifiService.findAllAdgroupWifi(adGroup.getId());
|
|
|
|
+ //把找到的已选wifi热点转换为前端需要的数据格式
|
|
|
|
+ String cacheSelected = "[";
|
|
|
|
+ String selectedWifi ="";
|
|
|
|
+ if(adGroupWifiList != null) {
|
|
|
|
+ int index = 0;
|
|
|
|
+ for(Wifi wf: adGroupWifiList) {
|
|
|
|
+ index ++;
|
|
|
|
+ cacheSelected += "{" + "\"" + "id" + "\"" + ":\"" + wf.getId()
|
|
|
|
+ + "\",\"" + "address" + "\"" + ":" + "\"" + wf.getAddress() + "\","
|
|
|
|
+ + "\"" + "lng" + "\"" + ":" + "\"" + (float)(Math.round(wf.getLongitude()*100))/100 + "\","
|
|
|
|
+ + "\"" + "lat" + "\"" + ":" + "\"" + (float)(Math.round(wf.getLatitude()*100))/100 + "\"" + "}";
|
|
|
|
+ selectedWifi += wf.getId();
|
|
|
|
+ String str = "[" + wf + "]";
|
|
|
|
+ if(index != adGroupWifiList.size()) {
|
|
|
|
+ cacheSelected += ",";
|
|
|
|
+ selectedWifi += ",";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ cacheSelected += "]";
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 找到所有的地域定向,排期
|
|
|
|
+ */
|
|
|
|
+ Direct locationDirect = directService.findByadGroupId(adGroup.getId(), 1);
|
|
|
|
+ String areas = "";
|
|
|
|
+ if(null != locationDirect) {
|
|
|
|
+ areas = locationDirect.getBackShow();
|
|
|
|
+ }
|
|
|
|
+ //批量查询
|
|
|
|
+ List<Direct> directs = directService.findByBatch(adGroupId);
|
|
|
|
+ Long campaignId = adGroup.getCampaignId();
|
|
|
|
+ model.addAttribute("campaignId", campaignId);
|
|
|
|
+ if(directs!=null){
|
|
|
|
+ for(Direct tmpDirect : directs ) {
|
|
|
|
+ if (tmpDirect.getDirectType() == DirectType.locateType) {
|
|
|
|
+ model.addAttribute("locate", tmpDirect.getBackShow());
|
|
|
|
+ }else if(tmpDirect.getDirectType() == DirectType.timeType) {
|
|
|
|
+ model.addAttribute("time", tmpDirect.getBackShow());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ model.addAttribute("placeList",placeList);
|
|
|
|
+ model.addAttribute("areas", areas);
|
|
|
|
+ model.addAttribute("selectedwifi", selectedWifi);
|
|
|
|
+ model.addAttribute("cacheSelected", cacheSelected);
|
|
|
|
+ model.addAttribute("activeTime", activeTime);
|
|
|
|
+ model.addAttribute("place",place);
|
|
|
|
+ model.addAttribute("adGroup", adGroup);
|
|
|
|
+ model.addAttribute("adGroupPlaceList",adGroupPlaceList);
|
|
return page("edit");
|
|
return page("edit");
|
|
}
|
|
}
|
|
/**
|
|
/**
|