基于javaweb和mysql的springbootoa办公自动化系统设计和实现(java+springboot+freemarker+mysql+maven+mybatis+jpa)
·
基于javaweb和mysql的springbootoa办公自动化系统设计和实现(java+springboot+freemarker+mysql+maven+mybatis+jpa)
私信源码获取及调试交流
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBootoa办公自动化系统设计和实现(java+springboot+freemarker+mysql+maven+mybatis+jpa)
java springbootOA办公自动化系统:
主要功能模块:系统、用户、角色、考勤、流程、公告、邮件、任务、日程、计划、文件、笔记、通讯录、讨论区等多个模块管理
使用Maven进行项目管理,基于springboot框架开发的项目,mysql底层数据库,前端采用freemarker模板引擎,Bootstrap作为前端UI框架,集成了jpa、mybatis等框架。
@Controller
@RequestMapping("/")
public class FileController {
@Autowired
private FileServices fs;
@Autowired
private FilePathdao fpdao;
@Autowired
private FileListdao fldao;
@Autowired
private UserDao udao;
/**
* 第一次进入
*
* @param model
* @return
*/
@RequestMapping("filemanage")
public String usermanage(@SessionAttribute("userId")Long userid,Model model) {
System.out.println(userid);
User user = udao.findOne(userid);
FilePath filepath = fpdao.findByPathName(user.getUserName());
System.out.println(filepath);
if(filepath == null){
FilePath filepath1 = new FilePath();
filepath1.setParentId(1L);
filepath1.setPathName(user.getUserName());
filepath1.setPathUserId(user.getUserId());
filepath = fpdao.save(filepath1);
}
model.addAttribute("nowpath", filepath);
model.addAttribute("paths", fs.findpathByparent(filepath.getId()));
model.addAttribute("files", fs.findfileBypath(filepath));
model.addAttribute("userrootpath",filepath);
model.addAttribute("mcpaths",fs.findpathByparent(filepath.getId()));
return "file/filemanage";
}
return "redirect:/noteview";
}
// 笔记主界面
@RequestMapping(value = "noteview", method = RequestMethod.GET)
public String test(Model model, HttpServletRequest request, HttpSession session,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "baseKey", required = false) String baseKey,
@RequestParam(value = "type", required = false) String type,
@RequestParam(value = "status", required = false) String status,
@RequestParam(value = "time", required = false) String time,
@RequestParam(value = "icon", required = false) String icon) {
Long userid = Long.parseLong(session.getAttribute("userId") + "");
cataloglist = (List<Catalog>) catalogDao.findcatauser(userid);
setSomething(baseKey, type, status, time, icon, model,null,null);
Page<Note> upage=NoteService.sortpage(page, baseKey, userid,null,null,null, type, status, time);
model.addAttribute("sort", "&userid="+userid);
paging(model, upage);
typestatus(request);
model.addAttribute("url", "notewrite");
model.addAttribute("calist", cataloglist);
return "note/noteview";
}
// post请求 添加类型
@RequestMapping(value = "noteview", method = RequestMethod.POST)
public String test3332(HttpServletRequest request, @Param("title") String title, HttpSession session) {
int flag = 0;
Long userid = Long.parseLong(session.getAttribute("userId") + "");
User user = userDao.findOne(userid);
String catalogName = request.getParameter("name");
if (catalogName != null) {
List<String> catanamelist = catalogDao.findcataname(userid);
for (String caname : catanamelist) {
if (caname.contains("(") && caname.contains(")"))
caname = caname.substring(0, caname.indexOf("("));
if (caname.equals(catalogName)) {
flag++;
}
}
}
}
// 执行业务代码
System.out.println("此操作是正确的");
req.setAttribute("success", "后台验证成功");
}
System.out.println("是否进入最后的实体类信息:" + menu);
return "forward:/informedit";
}
}
if (!StringUtil.isEmpty(user.getUserSign())) {
users.setUserSign(user.getUserSign());
}
if (!StringUtil.isEmpty(user.getPassword())) {
users.setPassword(user.getPassword());
}
if (!StringUtil.isEmpty(imgpath)) {
users.setImgPath(imgpath);
}
request.setAttribute("users", users);
ResultVO res = BindingResultVOUtil.hasErrors(br);
if (!ResultEnum.SUCCESS.getCode().equals(res.getCode())) {
List<Object> list = new MapToList<>().mapToList(res.getData());
request.setAttribute("errormess", list.get(0).toString());
System.out.println("list错误的实体类信息:" + user);
System.out.println("list错误详情:" + list);
System.out.println("list错误第一条:" + list.get(0));
System.out.println("啊啊啊错误的信息——:" + list.get(0).toString());
} else {
udao.save(users);
request.setAttribute("success", "执行成功!");
}
return "forward:/userpanel";
}
@RequestMapping("image/**")
public void image(Model model, HttpServletResponse response, @SessionAttribute("userId") Long userId, HttpServletRequest request)
throws Exception {
String projectPath = ClassUtils.getDefaultClassLoader().getResource("").getPath();
System.out.println(projectPath);
String startpath = new String(URLDecoder.decode(request.getRequestURI(), "utf-8"));
String path = startpath.replace("/image", "");
File f = new File(rootpath, path);
* 删除分类名称
*/
@RequestMapping("deletetypename")
public String deletetypename(@RequestParam(value="typename") String typename,@SessionAttribute("userId") Long userId){
User user=uDao.findOne(userId);
List<DirectorUser> dus=auDao.findByCatalogNameAndUser(typename, user);
for (DirectorUser directorUser : dus) {
directorUser.setCatalogName(null);
}
addressUserService.savaList(dus);
return "redirect:/outaddresspaging";
}
/**addtypename
* 增加外部分类名称
* */
@RequestMapping("addtypename")
public String addTypename(@RequestParam(value="typename",required=false) String typename,
@RequestParam(value="oldtypename",required=false) String oldtypename,
@SessionAttribute("userId") Long userId,Model model){
System.out.println("进来这个了么?");
User user=uDao.findOne(userId);
if(oldtypename!=null){
List<DirectorUser> dus=auDao.findByCatalogNameAndUser(oldtypename, user);
for (DirectorUser directorUser : dus) {
directorUser.setCatalogName(typename);
}
addressUserService.savaList(dus);
}else{
DirectorUser dc=new DirectorUser(user, typename);
addressUserService.save(dc);
}
Set<String> catalogs=auDao.findByUser(user);
System.out.println(catalogs);
model.addAttribute("catalogs", catalogs);
return "address/addtypename";
}
/**
* 分享给我的消息的界面
*/
@Controller
@RequestMapping("/")
public class ChatManageController {
@Autowired
DiscussDao discussDao;
@Autowired
DiscussService disService;
@Autowired
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);
}
}
long typeId = typeDao.findByTypeModelAndTypeName("aoa_note_list", typename).getTypeId();
String statusName = request.getParameter("status");
long statusId = statusDao.findByStatusModelAndStatusName("aoa_note_list", statusName).getStatusId();
// 这里返回ResultVO对象,如果校验通过,ResultEnum.SUCCESS.getCode()返回的值为200;否则就是没有通过;
ResultVO res = BindingResultVOUtil.hasErrors(br);
if (!ResultEnum.SUCCESS.getCode().equals(res.getCode())) {
List<Object> list = new MapToList<>().mapToList(res.getData());
request.setAttribute("errormess", list.get(0).toString());
} else {
// nid为-1就是新建或者是从某个目录新建
if (nid == -1 || nid == -3) {
// 判断文件是否为空
if (!file.isEmpty()) {
att = (Attachment) fs.savefile(file, user, null, false);
attid = att.getAttachmentId();
} else if (file.isEmpty())
attid = null;
// 0l表示新建的时候默认为没有收藏
note = new Note(note2.getTitle(), note2.getContent(), catalogId, typeId, statusId, attid, new Date(),
0l);
// 判断是否共享
if (request.getParameter("receiver") != null && (request.getParameter("receiver").trim().length() > 0)) {
userss = new HashSet<>();
String receivers = request.getParameter("receiver");
note.setReceiver(receivers);
String[] receiver = receivers.split(";");
// 先绑定自己再
userss.add(user);
// 再绑定其他人
for (String re : receiver) {
System.out.println(re);
User user2 = userDao.findid(re);
if (user2 == null) {
} else
userss.add(user2);
}
} else {
// 保存为该用户的笔记 绑定用户id
userss = new HashSet<>();
userss.add(user);
}
}
// nid大于0就是修改某个对象
if (nid > 0) {
note = noteDao.findOne(nid);
if (note.getAttachId() == null) {
if (!file.isEmpty()) {
public String witeMail4() {
return "mail/mail";
}
@RequestMapping("ffff")
public @ResponseBody PageInfo<Map<String, Object>> no() {
PageHelper.startPage(2, 10);
List<Map<String, Object>> list = nm.findMyNotice(2L);
PageInfo<Map<String, Object>> info = new PageInfo<Map<String, Object>>(list);
System.out.println(info);
return info;
}
}
@Controller
@RequestMapping("/")
public class MenuSysController {
Logger log = LoggerFactory.getLogger(getClass());
@Autowired
private IndexDao iDao;
@Autowired
private MenuSysService menuService;
@Autowired
private UserDao uDao;
@Autowired
private RoleDao rdao;
@Autowired
private RolepowerlistDao rldao;
@Autowired
private RoleService roleService;
/**
* 显示菜单管理界面
* @param req
* @return
*/
@RequestMapping("testsysmenu")
public String testsysmenu(HttpServletRequest req) {
menuService.findAllMenuSys(req);
return "systemcontrol/menumanage";
}
/**
* 查找菜单
*/
@RequestMapping("menutable")
public String menuTable(HttpServletRequest req){
if(!StringUtils.isEmpty(req.getParameter("name"))){
req.setAttribute("oneMenuAll", iDao.findByMenuNameLike("%"+req.getParameter("name")+"%"));
}
else{
menuService.findAllMenuSys(req);
}
@Controller
@RequestMapping("/")
public class InformManageController {
Logger log = LoggerFactory.getLogger(getClass());
@Autowired
private StatusDao statusDao;
@Autowired
private TypeDao typeDao;
@Autowired
private InformDao informDao;
@Autowired
private InformService informService;
@Autowired
private UserDao uDao;
@Autowired
private DeptDao deptDao;
@Autowired
private InformRelationDao informrelationDao;
@Autowired
private InformRelationService informrelationservice;
@Autowired
private NoticeMapper nm;
/**
* 通知管理面板
*
* @return
*/
@RequestMapping("infrommanage")
@Service
@Transactional
public class ProcessService {
@Autowired
private UserDao udao;
@Autowired
private DeptDao ddao;
@Autowired
break;
case "share":
fileLists = fldao.findByFileIsshareAndFileIstrash(1L, 0L);
model.addAttribute("files", fileLists);
model.addAttribute("isshare", 1);
model.addAttribute("isload",1);
model.addAttribute("userid",userid);
break;
default:
break;
}
model.addAttribute("type", type);
return "file/filetypeload";
}
@RequestMapping("findfileandpath")
public String findfileandpath(@SessionAttribute("userId") Long userid,
@RequestParam(value = "findfileandpath",required=false) String findfileandpath,
@RequestParam(value = "type",defaultValue="all") String type,
Model model){
System.out.println("查找!~~~~~~");
String findlike = "%" +findfileandpath+ "%";
User user = udao.findOne(userid);
FilePath fpath = fpdao.findByParentIdAndPathUserId(1L, userid);
String contenttype;
List<FileList> fileLists = null;
List<FilePath> filePaths = null;
System.out.println(type);
switch (type) {
case "document":
fileLists = fldao.finddocumentlike(user, findlike);
model.addAttribute("files", fileLists);
model.addAttribute("isload",1);
break;
case "picture":
contenttype = "image/%";
* @param size
* @return
*/
@RequestMapping("holi")
public String holi(@RequestParam("filePath") MultipartFile filePath, HttpServletRequest req, @Valid Holiday 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)) {
SystemTypeList type = tydao.findOne(eve.getTypeId());
if (eve.getTypeId() == 40) {
if (type.getTypeSortValue() < eve.getLeaveDays()) {
model.addAttribute("error", "婚假必须小于10天。");
return "common/proce";
}
} else if (eve.getTypeId() == 38) {
if (type.getTypeSortValue() < eve.getLeaveDays()) {
model.addAttribute("error", "单次事假必须小于4天。");
return "common/proce";
}
} else if (eve.getTypeId() == 42) {
if (type.getTypeSortValue() < eve.getLeaveDays()) {
model.addAttribute("error", "陪产假必须小于10天。");
return "common/proce";
}
} else {
//set主表
ProcessList pro = eve.getProId();
proservice.index5(pro, val, lu, filePath, shen.getUserName());
hdao.save(eve);
//存审核表
proservice.index7(shen, pro);
}
} else {
return "common/proce";
}
private NoteService NoteService;
@Autowired
private CatalogDao catalogDao;
@Autowired
private CatalogService catalogService;
@Autowired
private TypeDao typeDao;
@Autowired
private StatusDao statusDao;
@Autowired
private UserDao userDao;
@Autowired
private AttachmentDao attDao;
@Autowired
private NoteUserDao noteUserDao;
@Autowired
private ProcessService pservice;
@Autowired
private DeptDao ddao;
@Autowired
private PositionDao pdao;
Attachment att;
List<Note> noteList;
List<Catalog> cataloglist=new ArrayList<Catalog>();
List<SystemTypeList> type;
List<SystemStatusList> status;
// 收藏查询
@RequestMapping("collectfind")
public String dsafdsf(Model model, HttpServletRequest request, @RequestParam("iscollect") String iscollected,@RequestParam("cata") Long cid,
HttpSession session,@RequestParam(value="page",defaultValue="0")int page,@RequestParam(value="baseKey",required=false)String baseKey
,@RequestParam(value = "type", required = false) String type,
@RequestParam(value = "status", required = false) String status,
@RequestParam(value = "time", required = false) String time,
@RequestParam(value = "icon", required = false) String icon
) {
if(cid==-2)
cid=null;
Long userid = Long.valueOf(session.getAttribute("userId") + "");
long collect = Long.valueOf(iscollected);
System.out.println("收集"+collect);
if (collect == 1) {
setSomething(baseKey, type, status, time, icon, model,cid,null);
Page<Note> upage= NoteService.sortpage(page, null, userid, collect, cid, null, type, status, time);
model.addAttribute("url", "collectfind");
paging(model, upage);
//获得数据之后就将cid重新设置
@RequestParam(value="pageNum",defaultValue="1") int page) {
Long userId = Long.parseLong(session.getAttribute("userId") + "");
PageHelper.startPage(page, 10);
List<Map<String, Object>> list = nm.findMyNotice(userId);
PageInfo<Map<String, Object>> pageinfo=new PageInfo<Map<String, Object>>(list);
List<Map<String, Object>> list2=informrelationservice.setList(list);
for (Map<String, Object> map : list2) {
System.out.println(map);
}
model.addAttribute("url", "informlistpaging");
model.addAttribute("list", list2);
model.addAttribute("page", pageinfo);
System.out.println(pageinfo);
return "inform/informlist";
}
/**
* 编辑通知界面
*/
@RequestMapping("informedit")
public String infromEdit(HttpServletRequest req, HttpSession session, Model model) {
session.removeAttribute("noticeId");
List<SystemTypeList> typeList = typeDao.findByTypeModel("inform");
List<SystemStatusList> statusList = statusDao.findByStatusModel("inform");
if (!StringUtils.isEmpty(req.getAttribute("errormess"))) {
req.setAttribute("errormess", req.getAttribute("errormess"));
}
if (!StringUtils.isEmpty(req.getAttribute("success"))) {
req.setAttribute("success", "数据保存成功");
}
req.setAttribute("typeList", typeList);
req.setAttribute("statusList", statusList);
if (!StringUtils.isEmpty(req.getParameter("id"))) {
Long noticeId = Long.parseLong(req.getParameter("id"));
NoticesList noticeList = informDao.findOne(noticeId);
model.addAttribute("noticeList", noticeList);
model.addAttribute("typeName", typeDao.findOne(noticeList.getTypeId()).getTypeName());
model.addAttribute("statusName", statusDao.findOne(noticeList.getStatusId()).getStatusName());
session.setAttribute("noticeId", noticeId);
}
return "inform/informedit";
}
/**
* 详细通知显示
*/
@RequestMapping("informshow")
public String informShow(HttpServletRequest req, Model model) {
Long noticeId = Long.parseLong(req.getParameter("id"));
if (!StringUtils.isEmpty(req.getParameter("read"))) {
}
@Controller
@RequestMapping("/")
public class DaymanageController {
@Autowired
DaymanageDao daydao;
@Autowired
UserDao udao;
@Autowired
DaymanageServices dayser;
@Autowired
StatusDao statusdao;
@Autowired
TypeDao typedao;
@Autowired
ProcessService ps;
@RequestMapping("daymanage")
private String daymanage(@SessionAttribute("userId") Long userid,
Model model,@RequestParam(value="page",defaultValue="0") int page,
@RequestParam(value="size",defaultValue="10") int size
) {
List<SystemTypeList> types = typedao.findByTypeModel("aoa_schedule_list");
List<SystemStatusList> statuses = statusdao.findByStatusModel("aoa_schedule_list");
List<Order> orders=new ArrayList<>();
orders.add(new Order(Direction.DESC, "statusId"));
orders.add(new Order(Direction.DESC, "createTime"));
Sort sort=new Sort(orders);
Pageable pa=new PageRequest(page, size,sort);
User user = udao.findOne(userid);
Page<ScheduleList> myday = daydao.findByUser(user, pa);
List<ScheduleList> scheduleLists = myday.getContent();
model.addAttribute("schedules",scheduleLists);
model.addAttribute("types",types);
model.addAttribute("statuses",statuses);
model.addAttribute("page", myday);
model.addAttribute("url", "daymanagepaging");
model.addAttribute("ismyday", 1);
return "daymanage/daymanage";
}
@RequestMapping("daymanagepaging")
private String daymanagepaging(@SessionAttribute("userId") Long userid,
Model model,@RequestParam(value="page",defaultValue="0") int page,













更多推荐
所有评论(0)