基于javaweb+mysql的springbootoa办公自动化系统设计和实现(java+springboot+freemarker+mysql+maven+mybatis+jpa)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBootoa办公自动化系统设计和实现(java+springboot+freemarker+mysql+maven+mybatis+jpa)
java springbootOA办公自动化系统:
主要功能模块:系统、用户、角色、考勤、流程、公告、邮件、任务、日程、计划、文件、笔记、通讯录、讨论区等多个模块管理
使用Maven进行项目管理,基于springboot框架开发的项目,mysql底层数据库,前端采用freemarker模板引擎,Bootstrap作为前端UI框架,集成了jpa、mybatis等框架。
int a2 = menuService.changeSortId2(sortId, arithNum, menuId);
log.info("a1:{}", a1);
log.info("a2:{}", a2);
} else {
int a1 = menuService.changeSortId(sortId, arithNum, parentId);
int a2 = menuService.changeSortId2(sortId, arithNum, menuId);
log.info("a1:{}", a1);
log.info("a2:{}", a2);
}
menuService.findMenuSys(req,user);
return "redirect:/testsysmenu";
}
/**
* 菜单管理的编辑界面
* @param req
* @return
*/
@RequestMapping("menuedit")
public String newpage(HttpServletRequest req) {
if(!StringUtils.isEmpty(req.getAttribute("errormess"))){
req.setAttribute("errormess", req.getAttribute("errormess"));
}
if(!StringUtils.isEmpty(req.getAttribute("success"))){
req.setAttribute("success", req.getAttribute("success"));
}
List<SystemMenu> parentList=iDao.findByParentIdOrderBySortId(0L);
req.setAttribute("parentList", parentList);
HttpSession session = req.getSession();
session.removeAttribute("getId");
if (!StringUtils.isEmpty(req.getParameter("id"))) {
Long getId = Long.parseLong(req.getParameter("id"));
SystemMenu menuObj = iDao.findOne(getId);
if (!StringUtils.isEmpty(req.getParameter("add"))) {
Long getAdd = menuObj.getMenuId();
String getName=menuObj.getMenuName();
req.setAttribute("getAdd", getAdd);
req.setAttribute("getName", getName);
log.info("getAdd:{}", getAdd);
} else {
session.setAttribute("getId", getId);
log.info("getId:{}", getId);
req.setAttribute("menuObj", menuObj);
}
}
return "systemcontrol/menuedit";
}
/**
* 系统管理表单验证
* @param req
* @param menu
@RequestParam(value="size",defaultValue="5")int size,
@RequestParam(value="baseKey",required=false) String baseKey,
Model model,@SessionAttribute("userId") Long userId
){
User user=uDao.findOne(userId);
Pageable pa=new PageRequest(page, size, new Sort(Direction.DESC, "sharetime"));
Page<DirectorUser> duspage=auDao.findByShareuser(user, pa);
if(!StringUtils.isEmpty(baseKey)){
duspage=auDao.findBaseKey("%"+baseKey+"%",user,pa);
model.addAttribute("sort", "&baseKey="+baseKey);
}else{
duspage=auDao.findByShareuser(user, pa);
}
List<DirectorUser> dus=duspage.getContent();
model.addAttribute("page", duspage);
model.addAttribute("dus", dus);
model.addAttribute("url", "mesharemess");
return "address/mesharemess";
}
/**
* 分享消息的业务controller
*/
@RequestMapping("shareother")
public String shareOther(@SessionAttribute("userId")Long userId,@RequestParam(value="directors[]") Long[] directors,
Model model,
@RequestParam(value="sharedirector") Long sharedirector){
User user=uDao.findOne(userId);
Director director=addressDao.findOne(sharedirector);
List<User> users=new ArrayList<>();
List<DirectorUser> dus=new ArrayList<>();
for (int i = 0; i < directors.length; i++) {
User shareuser=uDao.findOne(directors[i]);
System.out.println("分享的用户:"+shareuser);
DirectorUser du=auDao.findByDirectorAndUser(director, shareuser);
if(Objects.isNull(du)){
System.out.println("没找到该对象、进行保存保存");
DirectorUser dir=new DirectorUser();
dir.setUser(shareuser);
dir.setShareuser(user);
dir.setDirector(director);
dus.add(dir);
}else{
rootpath= ResourceUtils.getURL("classpath:").getPath().replace("/target/classes/","/static/image");
rootpath=ResourceUtils.getURL("classpath:").getPath() + "/static/image";
System.out.println(rootpath);
}catch (IOException e){
System.out.println("获取项目路径异常");
}
}
@RequestMapping("userpanel")
public String index(@SessionAttribute("userId") Long userId,Model model,HttpServletRequest req,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "size", defaultValue = "10") int size){
Pageable pa=new PageRequest(page, size);
User user=null;
if(!StringUtil.isEmpty((String) req.getAttribute("errormess"))){
user=(User) req.getAttribute("users");
req.setAttribute("errormess",req.getAttribute("errormess"));
}
else if(!StringUtil.isEmpty((String) req.getAttribute("success"))){
user=(User) req.getAttribute("users");
req.setAttribute("success","fds");
}
else{
//找到这个用户
user=udao.findOne(userId);
}
//找到部门名称
String deptname=ddao.findname(user.getDept().getDeptId());
//找到职位名称
String positionname=pdao.findById(user.getPosition().getId());
//找未读通知消息
List<NoticeUserRelation> noticelist=irdao.findByReadAndUserId(false, user);
//找未读邮件
List<Mailreciver> maillist=mdao.findByReadAndDelAndReciverId(false,false, user);
//找便签
Page<Notepaper> list=ndao.findByUserIdOrderByCreateTimeDesc(user,pa);
List<Notepaper> notepaperlist=list.getContent();
model.addAttribute("user", user);
tservice.updateUStatusid(logger.getTaskId().getTaskId(), logger.getLoggerStatusid());
return "redirect:/taskmanage";
}
/**
* 我的任务
*/
@RequestMapping("mytask")
public String index5(@SessionAttribute("userId") Long userId, Model model,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "size", defaultValue = "10") int size) {
Pageable pa=new PageRequest(page, size);
Page<Tasklist> tasklist= tservice.index3(userId, null, page, size);
Page<Tasklist> tasklist2=tdao.findByTickingIsNotNull(pa);
if(tasklist!=null){
List<Map<String, Object>> list=tservice.index4(tasklist, userId);
model.addAttribute("page", tasklist);
model.addAttribute("tasklist", list);
}else{
List<Map<String, Object>> list2=tservice.index4(tasklist2, userId);
model.addAttribute("page", tasklist2);
model.addAttribute("tasklist", list2);
}
model.addAttribute("url", "mychaxun");
return "task/mytask";
}
/**
* 在我的任务里面进行查询
*
* @throws ParseException
*/
@RequestMapping("mychaxun")
public String select(HttpServletRequest request, @SessionAttribute("userId") Long userId, Model model,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "size", defaultValue = "10") int size) throws ParseException {
String title =null;
if(!StringUtil.isEmpty(request.getParameter("title"))){
title = request.getParameter("title").trim();
}
Page<Tasklist> tasklist= tservice.index3(userId, title, page, size);
System.out.println(baseKey);
userspage=uDao.findUsers("%"+baseKey+"%", baseKey+"%", pa);
model.addAttribute("baseKey", baseKey);
model.addAttribute("sort", "&baseKey="+baseKey);
}else{
userspage=uDao.findAll(pa);
}
users=userspage.getContent();
model.addAttribute("modalurl", "modalpaging");
model.addAttribute("modalpage", userspage);
model.addAttribute("users", users);
return "address/shareuser";
}
/**
外部通讯录
* @return
*/
@RequestMapping("outaddresspaging")
public String outAddress(@RequestParam(value="pageNum",defaultValue="1") int page,Model model,
@RequestParam(value="baseKey",required=false) String baseKey,
@RequestParam(value="outtype",required=false) String outtype,
@RequestParam(value="alph",defaultValue="ALL") String alph,
@SessionAttribute("userId") Long userId
){
PageHelper.startPage(page, 10);
List<Map<String, Object>> directors=am.allDirector(userId, alph, outtype, baseKey);
List<Map<String, Object>> adds=addressService.fengzhaung(directors);
PageInfo<Map<String, Object>> pageinfo=new PageInfo<>(directors);
if(!StringUtils.isEmpty(outtype)){
model.addAttribute("outtype", outtype);
}
Pageable pa=new PageRequest(0, 10);
Page<User> userspage=uDao.findAll(pa);
List<User> users=userspage.getContent();
model.addAttribute("modalurl", "modalpaging");
model.addAttribute("modalpage", userspage);
model.addAttribute("users", users);
model.addAttribute("userId", userId);
model.addAttribute("baseKey", baseKey);
model.addAttribute("directors", adds);
// return page2;
// List<NoticesList> noticeList=informDao.findByUserId(userId);
// List<NoticesList>
// noticeList=informDao.findByUserIdAndTopOrderByModifyTimeDesc(userId,
// true);
// List<NoticesList>
// noticeList2=informDao.findByUserIdAndTopOrderByModifyTimeDesc(userId,
// false);
// noticeList.addAll(noticeList2);
// List<Map<String, Object>> list=informService.fengZhuang(noticeList);
// model.addAttribute("list",list);
// }
/**
* 通知管理删除
*/
@RequestMapping("infromdelete")
public String infromDelete(HttpSession session, HttpServletRequest req) {
Long noticeId = Long.parseLong(req.getParameter("id"));
Long userId = Long.parseLong(session.getAttribute("userId") + "");
NoticesList notice = informDao.findOne(noticeId);
if (!Objects.equals(userId, notice.getUserId())) {
System.out.println("权限不匹配,不能删除");
return "redirect:/notlimit";
}
System.out.println(noticeId);
informService.deleteOne(noticeId);
return "redirect:/infrommanage";
}
/**
* 通知列表删除
*/
@RequestMapping("informlistdelete")
public String informListDelete(HttpServletRequest req, HttpSession session) {
Long userId = Long.parseLong(session.getAttribute("userId") + "");
Long noticeId = Long.parseLong(req.getParameter("id"));
NoticeUserRelation relation = informrelationDao.findByUserIdAndNoticeId(uDao.findOne(userId),
informDao.findOne(noticeId));
if (Objects.isNull(relation)) {
@Service
@Transactional
public class ProcessService {
@Autowired
private UserDao udao;
@Autowired
private DeptDao ddao;
@Autowired
private RoleDao rdao;
@Autowired
private PositionDao pdao;
@Autowired
private SubjectDao sudao;
@Autowired
private StatusDao sdao;
@Autowired
private TypeDao tydao;
@Autowired
private ReviewedDao redao;
@Autowired
private AttachmentDao AttDao;
String type=tydao.findname(bu.getTypeId());
String money=ProcessService.numbertocn(bu.getAllMoney());
model.addAttribute("prove", prove);
model.addAttribute("audit", audit);
model.addAttribute("type", type);
model.addAttribute("bu", bu);
model.addAttribute("money", money);
model.addAttribute("detaillist", detaillist);
model.addAttribute("map", map);
return "process/serch";
}else if(("出差费用").equals(typename)){
Double staymoney=0.0;
Double tramoney=0.0;
EvectionMoney emoney=emdao.findByProId(process);
String money=ProcessService.numbertocn(emoney.getMoney());
List<Stay> staylist=sadao.findByEvemoney(emoney);
for (Stay stay : staylist) {
staymoney += stay.getStayMoney();
}
List<Traffic> tralist=tdao.findByEvection(emoney);
for (Traffic traffic : tralist) {
tramoney+=traffic.getTrafficMoney();
}
model.addAttribute("staymoney", staymoney);
model.addAttribute("tramoney", tramoney);
model.addAttribute("allmoney", money);
model.addAttribute("emoney", emoney);
model.addAttribute("staylist", staylist);
model.addAttribute("tralist", tralist);
model.addAttribute("map", map);
return "process/evemonserch";
}else if(("出差申请").equals(typename)){
Evection eve=edao.findByProId(process);
model.addAttribute("eve", eve);
model.addAttribute("map", map);
return "process/eveserach";
}else if(("加班申请").equals(typename)){
Overtime eve=odao.findByProId(process);
String type=tydao.findname(eve.getTypeId());
model.addAttribute("eve", eve);
model.addAttribute("map", map);
model.addAttribute("type", type);
return "process/overserch";
}else if(("请假申请").equals(typename)){
Holiday eve=hdao.findByProId(process);
String type=tydao.findname(eve.getTypeId());
model.addAttribute("eve", eve);
model.addAttribute("map", map);
@RequestMapping("/")
public class UserLogController {
@Autowired
private UserLogDao userLogDao;
@Autowired
private UserLogService userLogService;
@Autowired
private UserDao uDao;
@Autowired
private TaskDao taskDao;
@Autowired
private UserLogRecordDao userLogRecordDao;
@Autowired
private ScheduleDao scheduleDao;
@Autowired
private UserLogRecordService userLogRecordService;
//显示本周的每天的记录
@RequestMapping("countweeklogin")
public String dfsa(HttpServletResponse response) throws IOException{
Integer []r=new Integer[7];
Calendar calendar=Calendar.getInstance();
setToFirstDay(calendar);
for (int i = 0; i < 7; i++) {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
r[i]=userLogRecordDao.countlog(sdf.format(calendar.getTime()));
calendar.add(Calendar.DATE, 1);
}
String json=JSONObject.toJSONString(r);
System.out.println(json);
response.setHeader("Cache-Control", "no-cache");
response.setContentType("text/json;charset=UTF-8");
response.getWriter().write(json);
return null;
}
private static void setToFirstDay(Calendar calendar) {
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
calendar.add(Calendar.DATE, -1);
}
}
//给hashMap按照value排序
public static ArrayList<Map.Entry<String,Integer>> sortMap(Map map){
List<Map.Entry<String, Integer>> entries = new ArrayList<Map.Entry<String, Integer>>(map.entrySet());
Collections.sort(entries, new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> obj1 , Map.Entry<String, Integer> obj2) {
return obj2.getValue() - obj1.getValue();
}
});
return (ArrayList<Entry<String, Integer>>) entries;
}
//显示任务统计模块数据
@RequestMapping("counttasknum")
result.put("title", prolist.get(i).getProcessName());
result.put("pushuser", prolist.get(i).getUserName());
result.put("applytime", prolist.get(i).getApplyTime());
result.put("harry", harryname);
result.put("statusname", status.getStatusName());
result.put("statuscolor", status.getStatusColor());
result.put("proid", prolist.get(i).getProcessId());
list.add(result);
}
return list;
}
/**
* 审核人封装
*/
public List<Map<String,Object>> index4(ProcessList process){
List<Map<String,Object>> relist=new ArrayList<>();
List<Reviewed> revie=redao.findByReviewedTimeNotNullAndProId(process);
for (int i = 0; i <revie.size(); i++) {
Map<String, Object> result=new HashMap<>();
User u=udao.findOne(revie.get(i).getUserId().getUserId());
Position po=pdao.findOne(u.getPosition().getId());
SystemStatusList status=sdao.findOne(revie.get(i).getStatusId());
result.put("poname", po.getName());
result.put("username", u.getUserName());
result.put("retime",revie.get(i).getReviewedTime());
result.put("restatus",status.getStatusName());
result.put("statuscolor",status.getStatusColor());
result.put("des", revie.get(i).getAdvice());
result.put("img",u.getImgPath());
result.put("positionid",u.getPosition().getId());
relist.add(result);
}
return relist;
}
/**
* process数据封装
*/
public Map<String,Object> index3(String name,User user,String typename,ProcessList process){
System.out.println(name);
File file = fs.getFile(filelist.getFilePath());
response.setContentLength(filelist.getSize().intValue());
response.setContentType(filelist.getContentType());
response.setHeader("Content-Disposition","attachment;filename=" + new String(filelist.getFileName().getBytes("UTF-8"), "ISO8859-1"));
writefile(response, file);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 写文件 方法
*
* @param response
* @param file
* @throws IOException
*/
public void writefile(HttpServletResponse response, File file) {
ServletOutputStream sos = null;
FileInputStream aa = null;
try {
aa = new FileInputStream(file);
sos = response.getOutputStream();
// 读取文件问字节码
byte[] data = new byte[(int) file.length()];
IOUtils.readFully(aa, data);
// 将文件流输出到浏览器
IOUtils.write(data, sos);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
sos.close();
aa.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
return "redirect:/taskmanage";
}
/**
* 修改任务
*/
@RequestMapping("edittasks")
public ModelAndView index3(HttpServletRequest req, @SessionAttribute("userId") Long userId,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "size", defaultValue = "10") int size) {
Pageable pa=new PageRequest(page, size);
ModelAndView mav = new ModelAndView("task/edittask");
// 得到链接中的任务id
String taskid = req.getParameter("id");
Long ltaskid = Long.parseLong(taskid);
// 通过任务id得到相应的任务
Tasklist task = tdao.findOne(ltaskid);
// 得到状态id
Long statusid = task.getStatusId().longValue();
// 得到类型id
Long typeid = task.getTypeId();
// 查看状态表
SystemStatusList status = sdao.findOne(statusid);
// 查询类型表
SystemTypeList type = tydao.findOne(typeid);
// 查询部门下面的员工
Page<User> pagelist = udao.findByFatherId(userId,pa);
List<User> emplist=pagelist.getContent();
// 查询部门表
Iterable<Dept> deptlist = ddao.findAll();
// 查职位表
Iterable<Position> poslist = pdao.findAll();
mav.addObject("type", type);
mav.addObject("status", status);
mav.addObject("emplist", emplist);
mav.addObject("deptlist", deptlist);
mav.addObject("poslist", poslist);
mav.addObject("task", task);
mav.addObject("page", pagelist);
mav.addObject("url", "names");
@RequestMapping("doshare")
public String doshare(@RequestParam("pathid") Long pathid,
@RequestParam("checkfileids") List<Long> checkfileids,
Model model
){
if (!checkfileids.isEmpty()) {
System.out.println(checkfileids);
fs.doshare(checkfileids);
}
model.addAttribute("pathid", pathid);
model.addAttribute("message","分享成功");
return "forward:/filetest";
}
/**
* 删除前台选择的文件以及文件夹
*
* @param pathid
* @param checkpathids
* @param checkfileids
* @param model
* @return
*/
@RequestMapping("deletefile")
public String deletefile(@SessionAttribute("userId") Long userid,
@RequestParam("pathid") Long pathid,
@RequestParam("checkpathids") List<Long> checkpathids,
@RequestParam("checkfileids") List<Long> checkfileids, Model model) {
System.out.println(checkfileids);
System.out.println(checkpathids);
if (!checkfileids.isEmpty()) {
// 删除文件
//fs.deleteFile(checkfileids);
//文件放入回收战
fs.trashfile(checkfileids, 1L,userid);
}
if (!checkpathids.isEmpty()) {
// 删除文件夹
//fs.deletePath(checkpathids);
fs.trashpath(checkpathids, 1L, true);
//fs.trashPath(checkpathids);
}
model.addAttribute("pathid", pathid);
return "forward:/filetest";
}
/**
* 重命名
* @param name
* @param renamefp
* @param pathid
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "size", defaultValue = "10") int size){
proservice.index6(model, userId, page, size);
return "process/resign";
}
/**
* 离职申请接收
* @param model
* @param session
* @param request
* @param page
* @param size
* @return
*/
@RequestMapping("res")
public String res(HttpServletRequest req,@Valid Resign eve,BindingResult br,
@SessionAttribute("userId") Long userId,Model model) throws IllegalStateException, IOException{
User lu=udao.findOne(userId);//申请人
User shen=udao.findByUserName(eve.getNameuser());//审核人
Long roleid=lu.getRole().getRoleId();//申请人角色id
Long fatherid=lu.getFatherId();//申请人父id
Long userid=shen.getUserId();//审核人userid
String val=req.getParameter("val");
if(roleid>=3L && Objects.equals(fatherid, userid)){
//set主表
ProcessList pro=eve.getProId();
proservice.index8(pro, val, lu,shen.getUserName());
eve.setHandUser(udao.findByUserName(eve.getHanduser()));
rsdao.save(eve);
//存审核表
proservice.index7(shen, pro);
}else{
return "common/proce";
}
return "redirect:/xinxeng";
}
/**
* 删除
*/
@RequestMapping("sdelete")
public String dele(HttpServletRequest req,@SessionAttribute("userId") Long userId,Model model){
User lu=udao.findOne(userId);//审核人
Long proid=Long.parseLong(req.getParameter("id"));
Reviewed rev=redao.findByProIdAndUserId(proid, lu);
if(!Objects.isNull(rev)){
rev.setDel(true);
redao.save(rev);
}else{
return "common/proce";
}
model.addAttribute("page", list);
model.addAttribute("url", "panel");
return "user/panel";
}
/**
* 存便签
*/
@RequestMapping("writep")
public String savepaper(Notepaper npaper,@SessionAttribute("userId") Long userId,@RequestParam(value="concent",required=false)String concent){
User user=udao.findOne(userId);
npaper.setCreateTime(new Date());
npaper.setUserId(user);
System.out.println("内容"+npaper.getConcent());
if(npaper.getTitle()==null|| npaper.getTitle().equals(""))
npaper.setTitle("无标题");
if(npaper.getConcent()==null|| npaper.getConcent().equals(""))
npaper.setConcent(concent);
ndao.save(npaper);
return "redirect:/userpanel";
}
/**
* 删除便签
*/
@RequestMapping("notepaper")
public String deletepaper(HttpServletRequest request,@SessionAttribute("userId") Long userId){
User user=udao.findOne(userId);
String paperid=request.getParameter("id");
Long lpid = Long.parseLong(paperid);
Notepaper note=ndao.findOne(lpid);
if(user.getUserId().equals(note.getUserId().getUserId())){
nservice.delete(lpid);
}else{
System.out.println("权限不匹配,不能删除");
return "redirect:/notlimit";
}
return "redirect:/userpanel";
}
/**
* 修改用户
* @throws IOException
* @throws IllegalStateException
*/
@RequestMapping("saveuser")
public String saveemp(@RequestParam("filePath")MultipartFile filePath,HttpServletRequest request,@Valid User user,
BindingResult br,@SessionAttribute("userId") Long userId) throws IllegalStateException, IOException{
String imgpath=nservice.upload(filePath);
return "plan/plantable";
}
// 真正的报表
@RequestMapping("realplantable")
public String test23(HttpServletRequest request, Model model, HttpSession session,
@RequestParam(value="pid",required=false) String pid,
@RequestParam(value="comment",required=false) String comment,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "baseKey", required = false) String baseKey) {
System.out.println("pid的"+pid);
plantablepaging(request, model, session, page, baseKey);
if(!StringUtils.isEmpty(pid)){
Plan plan = planDao.findOne(Long.valueOf(pid));
if(plan.getPlanComment()==null)
plan.setPlanComment(comment);
else
plan.setPlanComment(plan.getPlanComment() + comment);
planDao.save(plan);}
return "plan/realplantable";
}
// 我的编辑
@RequestMapping("planedit")
public String test3(HttpServletRequest request, Model model) {
long pid = Long.valueOf(request.getParameter("pid"));
if (!StringUtils.isEmpty(request.getAttribute("errormess"))) {
request.setAttribute("errormess", request.getAttribute("errormess"));
request.setAttribute("plan", request.getAttribute("plan2"));
} else if (!StringUtils.isEmpty(request.getAttribute("success"))) {
request.setAttribute("success", request.getAttribute("success"));
request.setAttribute("plan", request.getAttribute("plan2"));
}
// 新建
if (pid == -1) {
model.addAttribute("plan", null);
model.addAttribute("pid", pid);
} else if (pid > 0) {
Plan plan = planDao.findOne(pid);
model.addAttribute("plan", plan);
model.addAttribute("pid", pid);
@RequestParam("type") String type,
Model model){
User user = udao.findOne(userid);
String contenttype;
List<FileList> fileLists = null;
List<FilePath> filePaths = null;
switch (type) {
case "document":
fileLists = fldao.finddocument(user);
System.out.println(fileLists);
model.addAttribute("files", fileLists);
model.addAttribute("isload",1);
break;
case "picture":
contenttype = "image/%";
fileLists = fldao.findByUserAndContentTypeLikeAndFileIstrash(user, contenttype, 0L);
System.out.println(fileLists);
model.addAttribute("files", fileLists);
model.addAttribute("isload",1);
break;
case "music":
contenttype = "audio/%";
fileLists = fldao.findByUserAndContentTypeLikeAndFileIstrash(user, contenttype, 0L);
System.out.println(fileLists);
model.addAttribute("files", fileLists);
model.addAttribute("isload",1);
break;
case "video":
contenttype = "video/%";
fileLists = fldao.findByUserAndContentTypeLikeAndFileIstrash(user, contenttype, 0L);
System.out.println(fileLists);
model.addAttribute("files", fileLists);
model.addAttribute("isload",1);
break;
case "yasuo":
contenttype = "application/x%";
private void setthree(String x,String name, String icon, Model model, Long cataid, Long typeid) {
//单纯根据目录
if(!StringUtils.isEmpty(cataid)&&StringUtils.isEmpty(typeid))
model.addAttribute("sort", "&"+x+"="+name+"&icon="+icon+"&id="+cataid);
//单纯的根据类型
if(StringUtils.isEmpty(cataid)&&!StringUtils.isEmpty(typeid))
model.addAttribute("sort", "&"+x+"="+name+"&icon="+icon+"&typeid="+typeid);
//根据目录和类型
if(!StringUtils.isEmpty(cataid)&&!StringUtils.isEmpty(typeid))
model.addAttribute("sort", "&"+x+"="+name+"&icon="+icon+"&id="+cataid+"&typeid="+typeid);
else if(StringUtils.isEmpty(cataid)&&StringUtils.isEmpty(typeid))
model.addAttribute("sort", "&"+x+"="+name+"&icon="+icon);
}
}