/*
* 文件名:TopicAction.java
* 版权:Copyright 2010 ChinaSoft Resource All Rights Reserved
* 修改人:曾小云 20010-10-27
* 修改时间:20010-10-27
* 修改内容:新增
*
*/
package com.community.action.bbs;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import com.community.common.config.CommonKey;
import com.community.common.util.TimeTools;
import com.community.model.CutPageModel;
import com.community.model.Forum;
import com.community.model.Member;
import com.community.model.Topic;
import com.community.model.TopicModel;
import com.community.model.User;
import com.community.service.ForumService;
import com.community.service.TopicService;
import com.opensymphony.xwork2.ActionSupport;
/**
* 产品表ACTION
* @author zengxiaoyun
* @version
*/
public class BBSTopicAction extends ActionSupport
{
/**
* 版本序列号
*/
private static final long serialVersionUID = 1425356328898645071L;
/**
* 日志对象
*/
private static final Logger log = Logger.getLogger(BBSTopicAction.class);
/**
* Topic 集合
*/
private List<Topic> seList;
/**
* Topic 集合
*/
private List<TopicModel> topicModels;
/**
* 二级板块 集合
*/
private List<Forum> forum;
/**
* 一级板块 集合
*/
private List<Forum> forumparent;
/**
* Topic 对象
*/
private Topic topic;
/**
* topicService service
*/
private TopicService topicService;
/**
* forumService service
*/
private ForumService forumService;
//主题
private Topic zhuTopic;
/**
*名称
*/
private String topicname;
/**
* 主贴
*/
private Topic topicParent;
//板块信息
private Forum foruminfo;
/**
* 图片地址
*/
private String parentname;
// 版主类型,弹出框选择 版主的时候,三个版主选择 z 正版主, f1 , 副版主1, f2 副版主2
private String topicertype;
//正版主名字
private String topicerzname;
/**
* 上传文件名
*/
private String tlevel;
private String parentid;
private String title;
//板块ID
private String forumid;
private String tidorparentid;
/**
* 当前页
*/
private String p;
/**
* 分页bean
*/
private CutPageModel cutpage;
private int pagesize = 15;
/**
* 增加产品记录
* @return
*
*/
public String addTopic()
{
try
{
//插入一条topic 记录
log.info(topic);
topic.setCreate_time(TimeTools.getStringFromDate(new Date(),"yyyy-MM-dd hh:mm:ss"));
// 根据登陆用户 获取登陆用户所管辖的社区单位ID
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
Member member = (Member)session.getAttribute("member");
topic.setCreater(String.valueOf(member.getMid()));
if(topic.getContent() == null || topic.getContent().equals(""))
{
topic.setContent("无内容");
}
this.topicService.insertTopic(topic);
this.tlevel=topic.getTlevel();
this.parentid=topic.getParentid();
this.forumid = topic.getForumid();
if(!topic.getParentid().equals("0"))
{
this.tidorparentid = topic.getParentid();
return "topicView";
}
}
catch(Exception e)
{
log.error(e.toString());
return ERROR;
}
return "topicList";
}
/**
* 跳到增加版块页面
* @return
*
*/
public String toAddTopic()
{
try
{
//查询板块信息
this.foruminfo = this.forumService.selectForumByForumId(Integer.parseInt(forumid));
//如果传的parentid !=0 则 是 发回帖
if(!topic.getParentid().equals("0"))
{
this.topicParent = this.topicService.selectTopicByTopicId(Integer.parseInt(topic.getParentid()));
}
}
catch(Exception e)
{
log.error(e.toString());
return ERROR;
}
return "add";
}
/**
* 跳到增加版块页面
* @return
*
*/
public String toReplyTopic()
{
try
{
//查询板块信息
this.foruminfo = this.forumService.selectForumByForumId(Integer.parseInt(forumid));
//如果传的parentid !=0 则 是 发回帖
if(!topic.getParentid().equals("0"))
{
this.topicParent = this.topicService.selectTopicByTopicId(Integer.parseInt(topic.getParentid()));
}
}
catch(Exception e)
{
log.error(e.toString());
return ERROR;
}
return "reply";
}
/**
* 公用的查询列表的方法
* @return
*/
@SuppressWarnings("unchecked")
public String commonSelectTopic()
{
pagesize = 15;
//查询参数MAP
HashMap map = new HashMap();
// 产品周期
map.put("title", title);
map.put("tlevel",tlevel );
map.put("parentid",parentid );
map.put("forumid",forumid );
log.info(topicertype);
try
{
this.topicModels = new ArrayList<TopicModel>();
int allSize = this.topicService.countTopicInfo(map);
//处理得到当前页
int cur = CutPageModel.checkpages(p, allSize,pagesize);
//分页得到数据
this.seList = this.topicService.selectPageTopic(map,(cur-1)*pagesize, pagesize);
//查询 从贴列表
for(int i = 0 ; i < this.seList.size() ; i++)
{
Topic t = this.seList.get(i);
HashMap m = new HashMap();
m.put("parentid", t.getTid());
List<Topic> childs = this.topicService.selectPageTopic(m);
//设置回帖数量
this.seList.get(i).setRemark10(String.valueOf(childs.size()));
Topic last = null;
if(childs.size()!=0)
{
last = childs.get(0);
}
else
{
last = new Topic();
}
TopicModel model = new TopicModel();
model.setTopic(this.seList.get(i));
model.setChildTopics(childs);
model.setLastTopic(last);
this.topicModels.add(model);
}
//查询板块信息
this.foruminfo = this.forumService.selectForumByForumId(Integer.parseInt(forumid));
//封装数据到标签
//参数:1.链接action.action?a=a
没有合适的资源?快使用搜索试试~ 我知道了~
mobilePhoneSite.rar
共1166个文件
gif:305个
jpg:165个
jsp:135个
需积分: 0 0 下载量 46 浏览量
2011-05-20
09:25:43
上传
评论
收藏 5.65MB RAR 举报
温馨提示
资源详情
资源评论
资源推荐
收起资源包目录
mobilePhoneSite.rar (1166个子文件)
BBSMyAction.class 12KB
BBSTopicAction.class 12KB
MobileAction.class 10KB
TopicAction.class 9KB
BBSForumAction.class 9KB
PropertyAction.class 8KB
MemberAction.class 8KB
PictureAction.class 8KB
ProductsAction.class 8KB
ReleaseAction.class 7KB
ForumAction.class 6KB
ProductsListAction.class 6KB
Topic.class 6KB
MobileDetailAction.class 6KB
MailSender.class 6KB
Products.class 6KB
Forum.class 5KB
QueryProductDetailAction.class 5KB
AdviceAction.class 5KB
Member.class 5KB
BBSLoginAction.class 5KB
SelectUserAction.class 5KB
TimeTools.class 5KB
Page.class 4KB
ProductAllInfos.class 4KB
ProductsDAOImpl.class 4KB
MailSenderAction.class 4KB
ClientAction.class 4KB
PictureDAOImpl.class 4KB
MyPage.class 4KB
UpdatePasswordManegeAction.class 4KB
LoginDAOImp.class 4KB
Picture.class 4KB
AddUserAction.class 4KB
PictureServiceImpl.class 4KB
Property.class 4KB
CommonTools.class 3KB
MemberDAOImpl.class 3KB
ClientInfo.class 3KB
Advice.class 3KB
LoginAction.class 3KB
ProductsServiceImpl.class 3KB
ReleaseDAOImpl.class 3KB
UserDAOImpl.class 3KB
PopedomFilter.class 3KB
UserServiceImpl.class 3KB
IbatisKey.class 3KB
TopicDAOImpl.class 3KB
FileRead.class 3KB
DeleteUserNameAction.class 3KB
ForumDAOImpl.class 3KB
User.class 3KB
PropertyDAOImpl.class 3KB
Log.class 3KB
TopicServiceImpl.class 2KB
CutPageModel.class 2KB
MemberServiceImpl.class 2KB
AdviceDaoImpl.class 2KB
PropertyServiceImpl.class 2KB
ClientInfoDAOImpl.class 2KB
ForumServiceImpl.class 2KB
BaseUtils.class 2KB
ReleaseServiceImpl.class 2KB
Release.class 2KB
JumpingAction.class 2KB
MyCutPage.class 2KB
CutPage.class 2KB
BBSForgetPwd.class 2KB
HelpAction.class 2KB
ClientInfoServiceImpl.class 2KB
AdviceServiceImpl.class 2KB
RemindCondition.class 1KB
ImeiDAOImpl.class 1KB
Imei.class 1KB
TopicModel.class 1KB
ExitUserAction.class 1KB
PictureService.class 1KB
PictureDAO.class 1KB
ProductsService.class 1KB
ProductsDAO.class 1KB
PhoneParam.class 1KB
LoginServiceImpl.class 1KB
ForumModel.class 1KB
UserService.class 1KB
UserDAO.class 1KB
MakeXML.class 1KB
TopicService.class 1KB
TopicDAO.class 1KB
PersonalQueryOne.class 1KB
PhoneParamDAOImpl.class 1006B
QueryCondition.class 981B
ProductsDetailDAOImpl.class 931B
MemberService.class 897B
MemberDAO.class 885B
ForumService.class 880B
PropertyService.class 870B
ForumDAO.class 868B
PropertyDAO.class 858B
CommonResource.class 828B
ReleaseService.class 793B
共 1166 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
zhuganbao520
- 粉丝: 0
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0