校园资料分享平台的设计与开发、资料分享
1、使用框架和技术
2、功能展示与说明
3、系统展示
3.1 使用到技术
3.2 前台展示
3.3 后台界面
4. 论文资料和程序
1、使用框架和技术
Spring +SpringMVC +Hibernate+Mysql+easyui+Bootstrap+redis+ActiveMq+Maven
2、功能展示与说明
- 用户登录注册、注册 发送短信验证码 和邮箱验证、登录验证码
- 前台展示、资料下载 下载未登录 跳转到登录页
- 资料上传
- 搜索资料
- 用户留言
- 用户管理
- 资料管理
- 留言管理
- 下载量分析
- 分类管理
- 等
3、系统展示
3.1 使用到技术
用户注册部分核心代码
@Action("userAction_register")
public String register() throws IOException{
Map<String, Object> session = super.getSession();
String sessionCode = (String) session.get("imageCode");
if(UtilFuns.isEmpty(vercode)||!vercode.equalsIgnoreCase(sessionCode)){
ServletActionContext.getResponse().getWriter().println(0);
System.out.println("图形验证码不匹配");
return NONE;
}
String key ="code_"+model.getTelephone();
String redisTelCode = redisTemplate.opsForValue().get(key);
if(UtilFuns.isEmpty(phoneVercode) || ! phoneVercode.equals(redisTelCode)){
ServletActionContext.getResponse().getWriter().println(1);
System.out.println("手机验证码不匹配");
return NONE;
}
model.setState(0);
model.setRegistTime(new Date());
String pwd = Encrypt.md5(model.getPassword(), model.getUserName());
model.setPassword(pwd);
userClientService.saveOrUpdate(model);
jmsTemplate.send("dataShare-mail", new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
MapMessage message = session.createMapMessage();
message.setString("email", model.getEmail());
return message;
}
});
ServletActionContext.getResponse().getWriter().println(2);
redisTemplate.delete(key);
return NONE;
}
用户分享资料部分核心代码
@Action(value="uploadAction_upload" ,
results={@Result(name="toIndex",type="redirect",location="/index.jsp")})
public String upload() throws Exception {
String realPath =null;
if(file!=null){
FileInputStream in = new FileInputStream(file);
String fileNameExtension = fileFileName.substring(fileFileName.indexOf("."),fileFileName.length());
String realName =UUID.randomUUID().toString()+fileNameExtension;
FileOutputStream out = new FileOutputStream(new File(path, realName));
byte[] b = new byte[1024];
int len = 0;
while ((len = in.read(b)) > 0) {
out.write(b, 0, len);
}
realPath ="/"+realName;
out.close();
in.close();
}
model.setCount(0);
model.setState(0);
model.setUploadFilePath(realPath);
model.setUploadTime(new Date());
UserClient user = userClientService.findByUserId(userId);
UploadCategory category = uploadCategoryService.findById(categoryId);
model.setUser(user);
model.setUploadCategory(category);
model.setFileName(fileFileName);
uploadService.saveOrUpdata(model);
return "toIndex";
}
