package com.newvideo.web.action;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
|
import org.apache.struts2.ServletActionContext;
|
import org.apache.struts2.interceptor.ServletRequestAware;
|
import org.springframework.stereotype.Component;
|
|
import com.newvideo.domain.AdminInfo;
|
import com.newvideo.domain.DetailSystem;
|
import com.newvideo.domain.SystemInfo;
|
import com.newvideo.service.imp.SystemService;
|
import com.newvideo.util.Constant;
|
import com.newvideo.util.StringUtil;
|
import com.newvideo.web.tag.PageEntity;
|
import com.opensymphony.xwork2.ActionContext;
|
import com.opensymphony.xwork2.ActionSupport;
|
|
@Component
|
public class SystemAction extends ActionSupport implements ServletRequestAware {
|
@Resource
|
private SystemService systemService;
|
|
public SystemService getSystemService() {
|
return systemService;
|
}
|
|
public void setSystemService(SystemService systemService) {
|
this.systemService = systemService;
|
}
|
|
HttpServletRequest request;
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
|
/**
|
* ϵͳ�б�
|
*
|
* @return
|
*/
|
public String systemList() {
|
setRequest();
|
request.setAttribute("systemList", systemService.getSystemList());
|
return SUCCESS;
|
}
|
|
/**
|
* ��ϵͳ�б�
|
*
|
* @return
|
*/
|
public String detailSystemList() {
|
setRequest();
|
key = StringUtil.getUTF8String(key, "ISO-8859-1");
|
pageIndex = pageIndex <= 0 ? 1 : pageIndex;
|
List<DetailSystem> list = systemService.getDetailSystemList(key, pageIndex);
|
|
long count = systemService.getDetailSystemListCount(key);
|
PageEntity pe = new PageEntity();
|
pe.setPageIndex(pageIndex);
|
pe.setPageSize(Constant.pageCount);
|
Map<String, String> map = new HashMap<String, String>();
|
map.put("key", key);
|
pe.setParams(map);
|
pe.setTotalCount((int) count);
|
request.setAttribute("pageEntity", pe);
|
request.setAttribute("detailSystemList", list);
|
return SUCCESS;
|
}
|
|
/**
|
* ������ϵͳ
|
*
|
* @return
|
*/
|
public String updateDetailSystem() {
|
setRequest();
|
DetailSystem ds = systemService.getDetailSystemById(id);
|
ds.setAppName(StringUtil.getUTF8String(appName, "ISO-8859-1"));
|
ds.setBeizhu(StringUtil.getUTF8String(beizhu, "ISO-8859-1"));
|
ds.setIosUmengAppKey(iosUmengAppKey);
|
ds.setIosUmengMasterKey(iosUmengMasterKey);
|
ds.setPackageName(packageName);
|
ds.setPlatform(platform);
|
ds.setSystem(new SystemInfo(system));
|
ds.setUmengAppKey(umengAppKey);
|
ds.setUmengMasterKey(umengMasterKey);
|
ds.setSohuKey(sohuKey);
|
ds.setSohuPartner(sohuPartner);
|
if (StringUtil.isNullOrEmpty(appStoreIng))
|
ds.setAppStoreIng(false);
|
else {
|
ds.setAppStoreIng(true);
|
ds.setAppStoreVersion(appStoreVersion);
|
}
|
systemService.updateDetailSystem(ds);
|
return SUCCESS;
|
}
|
|
public String getSystemForAddDetailSystem() {
|
setRequest();
|
List<SystemInfo> list = systemService.getSystemList();
|
request.setAttribute("systemList", list);
|
return SUCCESS;
|
}
|
|
public String getDetailSystem() {
|
setRequest();
|
DetailSystem ds = systemService.getDetailSystemById(id);
|
request.setAttribute("detailSystem", ds);
|
List<SystemInfo> list = systemService.getSystemList();
|
request.setAttribute("systemList", list);
|
return SUCCESS;
|
}
|
|
/**
|
* �����ϸ��ϵͳ
|
*
|
* @return
|
*/
|
public String addDetailSystem() {
|
setRequest();
|
DetailSystem ds = new DetailSystem();
|
ds.setCreatetime(System.currentTimeMillis() + "");
|
ds.setAppName(StringUtil.getUTF8String(appName, "ISO-8859-1"));
|
ds.setBeizhu(StringUtil.getUTF8String(beizhu, "ISO-8859-1"));
|
ds.setInfo((AdminInfo) request.getAttribute("ADMIN_USER"));
|
ds.setIosUmengAppKey(iosUmengAppKey);
|
ds.setIosUmengMasterKey(iosUmengMasterKey);
|
ds.setPackageName(packageName);
|
ds.setPlatform(platform);
|
ds.setSystem(new SystemInfo(system));
|
ds.setUmengAppKey(iosUmengAppKey);
|
ds.setUmengMasterKey(iosUmengMasterKey);
|
ds.setSohuKey(sohuKey);
|
ds.setSohuPartner(sohuPartner);
|
|
if (StringUtil.isNullOrEmpty(appStoreIng))
|
ds.setAppStoreIng(false);
|
else {
|
ds.setAppStoreIng(true);
|
ds.setAppStoreVersion(appStoreVersion);
|
}
|
|
systemService.addDetailSystem(ds);
|
return SUCCESS;
|
}
|
|
public String deleteDetailSystem() {
|
setRequest();
|
systemService.deleteDetailSystem(id);
|
return SUCCESS;
|
}
|
|
public String deleteDetailSystemList() {
|
setRequest();
|
String urls = request.getParameter("urls");
|
String[] ids = urls.split(",");
|
for (String st : ids) {
|
systemService.deleteDetailSystem(st);
|
}
|
return SUCCESS;
|
}
|
|
// ϵͳ��¡
|
public String detailSystemClone() {
|
setRequest();
|
systemService.detailSystemClone(request.getParameter("fromid"), request.getParameter("toid"));
|
|
return SUCCESS;
|
}
|
|
public void setServletRequest(HttpServletRequest arg0) {
|
this.request = arg0;
|
|
}
|
|
public void setRequest() {
|
if (request != null)
|
return;
|
ActionContext ac = ActionContext.getContext();
|
HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST);
|
this.request = request;
|
}
|
|
private String key;
|
private int pageIndex;
|
|
public String getKey() {
|
return key;
|
}
|
|
public void setKey(String key) {
|
this.key = key;
|
}
|
|
public int getPageIndex() {
|
return pageIndex;
|
}
|
|
public void setPageIndex(int pageIndex) {
|
this.pageIndex = pageIndex;
|
}
|
|
private String id;
|
private String packageName;
|
private String appName;
|
private String beizhu;
|
private String umengAppKey;
|
private String iosUmengAppKey;
|
private String umengMasterKey;
|
private String iosUmengMasterKey;
|
private int platform;// 1-Android 2-IOS
|
private String system;
|
private String appStoreIng;// �Ƿ������ϴ�Ӧ���г�
|
private int appStoreVersion;// �ϴ��汾
|
private String sohuPartner;
|
private String sohuKey;
|
|
public String getSohuPartner() {
|
return sohuPartner;
|
}
|
|
public void setSohuPartner(String sohuPartner) {
|
this.sohuPartner = sohuPartner;
|
}
|
|
public String getSohuKey() {
|
return sohuKey;
|
}
|
|
public void setSohuKey(String sohuKey) {
|
this.sohuKey = sohuKey;
|
}
|
|
public String getAppStoreIng() {
|
return appStoreIng;
|
}
|
|
public void setAppStoreIng(String appStoreIng) {
|
this.appStoreIng = appStoreIng;
|
}
|
|
public int getAppStoreVersion() {
|
return appStoreVersion;
|
}
|
|
public void setAppStoreVersion(int appStoreVersion) {
|
this.appStoreVersion = appStoreVersion;
|
}
|
|
public String getSystem() {
|
return system;
|
}
|
|
public void setSystem(String system) {
|
this.system = system;
|
}
|
|
public String getId() {
|
return id;
|
}
|
|
public void setId(String id) {
|
this.id = id;
|
}
|
|
public HttpServletRequest getRequest() {
|
return request;
|
}
|
|
public void setRequest(HttpServletRequest request) {
|
this.request = request;
|
}
|
|
public String getPackageName() {
|
return packageName;
|
}
|
|
public void setPackageName(String packageName) {
|
this.packageName = packageName;
|
}
|
|
public String getAppName() {
|
return appName;
|
}
|
|
public void setAppName(String appName) {
|
this.appName = appName;
|
}
|
|
public String getBeizhu() {
|
return beizhu;
|
}
|
|
public void setBeizhu(String beizhu) {
|
this.beizhu = beizhu;
|
}
|
|
public String getUmengAppKey() {
|
return umengAppKey;
|
}
|
|
public void setUmengAppKey(String umengAppKey) {
|
this.umengAppKey = umengAppKey;
|
}
|
|
public String getIosUmengAppKey() {
|
return iosUmengAppKey;
|
}
|
|
public void setIosUmengAppKey(String iosUmengAppKey) {
|
this.iosUmengAppKey = iosUmengAppKey;
|
}
|
|
public String getUmengMasterKey() {
|
return umengMasterKey;
|
}
|
|
public void setUmengMasterKey(String umengMasterKey) {
|
this.umengMasterKey = umengMasterKey;
|
}
|
|
public String getIosUmengMasterKey() {
|
return iosUmengMasterKey;
|
}
|
|
public void setIosUmengMasterKey(String iosUmengMasterKey) {
|
this.iosUmengMasterKey = iosUmengMasterKey;
|
}
|
|
public int getPlatform() {
|
return platform;
|
}
|
|
public void setPlatform(int platform) {
|
this.platform = platform;
|
}
|
|
}
|