【Java开源代码栏目提醒】:网学会员,鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“AdbannerAction.java”一文,供大家参考学习!
package com.kemp.web.actions;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.kemp.util.DateWrapper;
import com.kemp.video.adbanner.AdBanner;
import com.kemp.video.adbanner.IAdBannerService;
import com.kemp.video.advertisement.IAdvertismentService;
import com.kemp.video.hotel.IHotelService;
import com.kemp.video.subdictionary.ISubDictionaryService;
import com.kemp.video.subdictionary.SubDictionary;
import com.kemp.web.baseaction.AbstractAction;
public class AdbannerAction extends AbstractAction{
private IAdBannerService adBannerService;
private ISubDictionaryService subDictionaryService;
private IAdvertismentService advertismentservice;
private IHotelService hotelService;
private ArrayList hotelList;
private ArrayList adBannerList;
private AdBanner adBanner;
private SubDictionary subDictionary;
private List advertismentList;//骞垮憡
private List pageLevelList;//鐗堥潰绾у埆
private List stairList;//涓绾у箍鍛婁綅
private List secondList;//浜岀骇骞垮憡浣?
private List specList;//骞垮憡瑙勬牸
private String hotelIds ;//鎵閫夐厭搴梚d鐨勫?
private String firstPlace; //绗竴骞垮憡浣?
private String nextPlace; //绗簩骞垮憡浣?
private String bannerId="0"; //0琛ㄧず鏂板 鍏朵粬琛ㄧず淇敼
private String message; //杩斿洖椤甸潰鎻愮ず娑堟伅
private String saveok="0"; //鏍囧織
private String whereValue="";
//鎻愮ず椤甸潰鍏辩敤
private int notBusyNum; //绌洪棽骞垮憡浣嶇殑鏁扮洰
private int notReleaseNum; //鏈彂甯冨箍鍛婄殑鏁扮洰
private int toDateNum; //鍒版湡骞垮憡鐨勬暟鐩?
//缂栬緫骞垮憡浣嶄俊鎭?
public String edit()throws Exception{
if(saveok.equals("1")){
message="娣诲姞鎴愬姛!";
}
if(!bannerId.equals("0")){
adBanner = adBannerService.getAdBannerById(Integer.parseInt(bannerId));
hotelIds = String.valueOf(adBanner.getHotel().getHotelId());//褰撹繘琛屼慨鏀圭殑鏃跺檋otelIds鐨勫煎氨鏄厭搴梚d鐨勫?
}
pageLevelList= subDictionaryService.getListByCodeId(101);
stairList= subDictionaryService.getListByCodeId(102);
secondList= subDictionaryService.getListByCodeId(103);
specList= subDictionaryService.getListByCodeId(105);
return SUCCESS;
}
//淇濆瓨骞垮憡浣?
public String save()throws Exception{
adBanner.setStatus("0");//璁剧疆鐘舵佷负绌洪棽
String result = adBannerService.addBatch(hotelIds, adBanner);
return result;
}
// 鑾峰緱鎵鏈夌殑閰掑簵鍒楄〃
public String selectHotel(){
where = "from Hotel";
hotelList= (ArrayList) hotelService.find(where);
return SUCCESS;
}
// 鑾峰緱鍗犵敤骞垮憡浣嶇殑鍒楄〃
public String listBusy() throws Exception{
if(where.length()<1){
where = " where status= '1'";//榛樿鐨勬煡璇?
}
pager = adBannerService.getAdBannerList(currentPage,pagerMethod,this.getWhere());
adBannerList = (ArrayList) pager.getList();
setCurrentPage(String.valueOf(pager.getCurrentPage()));
return SUCCESS;
}
// 鑾峰緱绌洪棽骞垮憡浣嶇殑鍒楄〃
public String listNotBusy() throws Exception{
if(where.length()<1){
where = " where status= '0'";//榛樿鐨勬煡璇?
}
pager = adBannerService.getAdBannerList(currentPage,pagerMethod,where);
adBannerList = (ArrayList) pager.getList();
setCurrentPage(String.valueOf(pager.getCurrentPage()));
return SUCCESS;
}
// 鍒犻櫎
public String delete(){
adBannerService.deleteAdBanner(adBanner.getBannerId());
return SUCCESS;
}
//鑾峰彇鎻愮ず椤甸潰鏁版嵁
public String notBusyNum() throws Exception{
where = "FROM AdBanner WHERE status = '0'";
notBusyNum = adBannerService.find(where).size();
where = "FROM Advertisment WHERE status = '0'";
notReleaseNum = advertismentservice.find(where).size();
Calendar C = Calendar.getInstance();// 寰楀埌褰撳墠鏃堕棿
C.add(C.DATE, -5);//鍦ㄥ綋鍓嶇殑鏃ユ湡涓婂姞涓?澶?
//鎻愬墠5澶╂彁绀哄埌鏈熷箍鍛?
java.util.Date temp_date = C.getTime();
String nowdate = DateWrapper.getLongDate(temp_date);
where = "FROM Advertisment WHERE status = '1' and endDate <= '"+nowdate+"'";
toDateNum = advertismentservice.find(where).size();
return SUCCESS;
}
public IAdBannerService getAdBannerService() {
return adBannerService;
}
public void setAdBannerService(IAdBannerService adBannerService) {
this.adBannerService = adBannerService;
}
public ISubDictionaryService getSubDictionaryService() {
return subDictionaryService;
}
public void setSubDictionaryService(ISubDictionaryService subDictionaryService) {
this.subDictionaryService = subDictionaryService;
}
public IAdvertismentService getAdvertismentservice() {
return advertismentservice;
}
public void setAdvertismentservice(IAdvertismentService advertismentservice) {
this.advertismentservice = advertismentservice;
}
public IHotelService getHotelService() {
return hotelService;
}
public void setHotelService(IHotelService hotelService) {
this.hotelService = hotelService;
}
public List getAdvertismentList() {
return advertismentList;
}
public void setAdvertismentList(List advertismentList) {
this.advertismentList = advertismentList;
}
public ArrayList getHotelList() {
return hotelList;
}
public void setHotelList(ArrayList hotelList) {
this.hotelList = hotelList;
}
public List getPageLevelList() {
return pageLevelList;
}
public void setPageLevelList(List pageLevelList) {
this.pageLevelList = pageLevelList;
}
public List getSecondList() {
return secondList;
}
public void setSecondList(List secondList) {
this.secondList = secondList;
}
public List getSpecList() {
return specList;
}
public void setSpecList(List specList) {
this.specList = specList;
}
public List getStairList() {
return stairList;
}
public void setStairList(List stairList) {
this.stairList = stairList;
}
public AdBanner getAdBanner() {
return adBanner;
}
public void setAdBanner(AdBanner adBanner) {
this.adBanner = adBanner;
}
public String getHotelIds() {
return hotelIds;
}
public void setHotelIds(String hotelIds) {
this.hotelIds = hotelIds;
}
public String getFirstPlace() {
return firstPlace;
}
public void setFirstPlace(String firstPlace) {
this.firstPlace = firstPlace;
}
public String getNextPlace() {
return nextPlace;
}
public void setNextPlace(String nextPlace) {
this.nextPlace = nextPlace;
}
public SubDictionary getSubDictionary() {
return subDictionary;
}
public void setSubDictionary(SubDictionary s
上一篇:
AdBanner.java
下一篇:
超市进销存管理系统的开发