📄 newsinfo.java
字号:
ArrayList newsList = new ArrayList();
NewsExt newExt = new NewsExt();
newExt.setParam(":VNEWS_ID", news_id);
newsList = newExt.selByList("SEL_ONE_NEWS");
return newsList;
}
public ArrayList genNewsByNewsType(String classId, int num)
throws SaasApplicationException {
ArrayList newsList = new ArrayList();
NewsExt newExt = new NewsExt();
newExt.setParam(":VNEWS_TYPE", classId);
newsList = newExt.selByList("SEL_BY_NEWSTYPE", 0, num);
return newsList;
}
// 查询未审核的客户新闻 add by sjp date:2007-06-05
public void gennocheckinfo(Buffers inbuffer) {
log.LOG_INFO("进入gennocheckinfo方法...");
this.outBuffer = inbuffer;
String query_param = inbuffer.getString("QUERY_PARAM");
String cust_id = inbuffer.getString("SESSION_CUST_ID");
try {
if (query_param.equals(""))
this.queryResult = gennocheckinfo(cust_id);
else
this.queryResult = searchNews(query_param, cust_id, "1");
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
log.LOG_INFO("退出gennocheckinfo方法...");
}
public ArrayList gennocheckinfo(String cust_id)
throws SaasApplicationException {
ArrayList newsList = new ArrayList();
NewsExt newExt = new NewsExt();
newExt.setParam(":VCUST_ID", cust_id);
newExt.setParam(":VVALIDITY", "1");
newsList = newExt.selByList("SEL_BY_NOCHECK");
return newsList;
}
// 修改新闻 add by sjp date:2007-06-05
public void updatenewsinfo(Buffers inbuffer) {
log.LOG_INFO("进入updatenewsinfo方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
NewsDAO newsDAO = new NewsDAO();
newsDAO.setNews_id(inbuffer.getString("NEWS_ID"));
newsDAO.setNews_type(inbuffer.getString("NEWS_TYPE"));
newsDAO.setTitle(inbuffer.getString("TITLE"));
newsDAO.setContent(inbuffer.getString("CONTENT"));
newsDAO.setPublish_user_id(inbuffer.getString("SESSION_USER_ID"));
try {
iResult = updatenewsinfo(newsDAO);
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出updatenewsinfo方法...");
}
public int updatenewsinfo(NewsDAO newsDAO) throws SaasApplicationException {
NewsExt newExt = new NewsExt();
commMethodMgr comm = new commMethodMgr();
String news_id = comm.GenTradeId();
newExt.setParam(":VNEWS_ID", newsDAO.getNews_id());
newExt.setParam(":VNEWS_TYPE", newsDAO.getNews_type());
newExt.setParam(":VTITLE", newsDAO.getTitle());
newExt.setParam(":VCONTENT", newsDAO.getContent());
newExt.setParam(":VPUBLISH_USER_ID", newsDAO.getPublish_user_id());
tradeQuery.executeBy(newExt.insBy("UPDATE_BY_ONE"));
return 0;
}
// 删除新闻 add by sjp date:2007-06-05
public void delnewsinfo(Buffers inbuffer) {
log.LOG_INFO("进入delnewsinfo方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
String news_id = inbuffer.getString("NEWS_ID");
try {
iResult = delnewsinfo(news_id);
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出delnewsinfo方法...");
}
public int delnewsinfo(String news_id) throws SaasApplicationException {
NewsExt newExt = new NewsExt();
newExt.setParam(":VNEWS_ID", news_id);
tradeQuery.executeBy(newExt.insBy("DEL_BY_ONE"));
return 0;
}
// 查找图片路径
public String getCustAttachPath(String strAttachId, String flag)
throws SaasApplicationException {
log.LOG_INFO("进入getAttachPath方法...");
Attachinfo attachInfo = new Attachinfo();
String file_path = attachInfo.getAttachPath(strAttachId, flag, "0");
log.LOG_INFO("退出getAttachPath方法...");
return file_path;
}
// 新闻审核 add by sjp date:2007-06-05
public void audnewsinfo(Buffers inbuffer) {
log.LOG_INFO("进入delnewsinfo方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
String news_id = inbuffer.getString("NEWS_ID");
try {
iResult = audnewsinfo(news_id);
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出delnewsinfo方法...");
}
public int audnewsinfo(String news_id) throws SaasApplicationException {
NewsExt newExt = new NewsExt();
newExt.setParam(":VNEWS_ID", news_id);
newExt.setParam(":VVALIDITY", "0");
tradeQuery.executeBy(newExt.insBy("AUD_BY_ONE"));
return 0;
}
/**
* @param title
* @param cust_id
* @return
* @throws SaasApplicationException
*/
public ArrayList searchNews(String title, String cust_id, String validity)
throws SaasApplicationException {
ArrayList itemsList = new ArrayList();
NewsExt newExt = new NewsExt();
newExt.setParam(":VTITLE", "%" + title + "%");
newExt.setParam(":VCUST_ID", cust_id);
newExt.setParam(":VVALIDITY", validity);
itemsList = newExt.selByList("SEL_BY_SEARCH");
return itemsList;
}
// 分页查询
public ArrayList getNewsListByCust(int iStart, String strCustId)
throws SaasApplicationException {
if (iStart == 0) {
iStart = 0;
} else {
iStart = (iStart - 1) * 30;
}
ArrayList newsList = new ArrayList();
NewsExt newExt = new NewsExt();
newExt.setParam(":VCUST_ID", strCustId);
newExt.setParam(":VVALIDITY", "0");
newsList = newExt.selByList("SEL_BY_CUST", iStart, 30);
return newsList;
}
// 统计总数
public int getNewsNumber(String cust_id) throws SaasApplicationException {
ArrayList newsList = new ArrayList();
NewsExt newExt = new NewsExt();
newExt.setParam(":VCUST_ID", cust_id);
newExt.setParam(":VVALIDITY", "0");
newsList = newExt.selByList("SEL_BY_CUST");
if (newsList != null) {
return newsList.size();
} else {
return 0;
}
}
// 分页搜索查询
public ArrayList getNewsListBySearch(int iStart, String Keys)
throws SaasApplicationException {
if (iStart == 0) {
iStart = 0;
} else {
iStart = (iStart - 1) * 30;
}
ArrayList productList = new ArrayList();
NewsExt productExt = new NewsExt();
productExt.setParam(":VCONTENT", "%" + Keys.trim() + "%");
productList = productExt.selByList("SEL_BY_KEYS", iStart, 30);
return productList;
}
// 分页搜索统计
public int getNewsSearch(String Keys) throws SaasApplicationException {
ArrayList productList = new ArrayList();
NewsExt productExt = new NewsExt();
productExt.setParam(":VCONTENT", "%" + Keys.trim() + "%");
productList = productExt.selByList("SEL_BY_KEYS");
if (productList != null) {
return productList.size();
} else {
return 0;
}
}
public ArrayList getNewsCountByType(int iStart, int limit, String Keys)
throws SaasApplicationException {
if (iStart == 0) {
iStart = 0;
} else {
iStart = (iStart - 1) * limit;
}
ArrayList productList = new ArrayList();
NewsExt productExt = new NewsExt();
productExt.setParam(":VCONTENT", "%" + Keys.trim() + "%");
productList = productExt.selByList("SEL_BY_KEYS", iStart, limit);
return productList;
}
public int getNewsCountByTypeCount(String news_type)
throws SaasApplicationException {
int size = 0;
ArrayList newsList = new ArrayList();
NewsExt newsExt = new NewsExt();
newsExt.setParam(":VNEWS_TYPE", news_type);
newsList = newsExt.selByList("SEL_BY_NEWS_TYPE_CT");
if (newsList != null && newsList.size() > 0) {
HashMap map = (HashMap) newsList.get(0);
size = Integer.parseInt(map.get("ct").toString());
}
return size;
}
/**
* @param iStart
* @param limit
* @param news_type
* @return 取新闻列表
* @throws SaasApplicationException
*/
public ArrayList getNewsByType(int iStart, int limit, String news_type)
throws SaasApplicationException {
if (iStart > 1) {
iStart = (iStart - 1) * limit;
} else {
iStart = 0;
}
ArrayList newsList = new ArrayList();
NewsExt newsExt = new NewsExt();
newsExt.setParam(":VNEWS_TYPE", news_type);
newsList = newsExt.selByList("SEL_BY_NEWS_TYPE", iStart, limit);
return newsList;
}
/**
* @param news_id
* @return 根据news_id取数据
* @throws SaasApplicationException
*/
public ArrayList getNewsById(String news_id)
throws SaasApplicationException {
ArrayList newsList = new ArrayList();
NewsExt newsExt = new NewsExt();
newsExt.setParam(":VNEWS_ID", news_id);
newsList = newsExt.selByList("SEL_BY_NEWS_ID");
return newsList;
}
public ArrayList getNewCastById() throws SaasApplicationException {
ArrayList newsList = new ArrayList();
NewsExt newsExt = new NewsExt();
newsList = newsExt.selByList("SEL_NEWS_CAST");
return newsList;
}
/**
* add by WangY
* 取出相关新闻
* @param news_type
* @return
* @throws SaasApplicationException
*/
public ArrayList getAboutByType(String news_type) throws SaasApplicationException {
ArrayList newsList = new ArrayList();
NewsExt newsExt = new NewsExt();
newsExt.setParam(":VNEWS_TYPE", news_type);
newsList = newsExt.selByList("SEL_ABOUT_TYPE");
return newsList;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -