該項目含有源碼、文檔、PPT、配套開發軟件、軟件安裝教程、項目發布教程等學習內容。
目錄
一、項目介紹:
二、文檔學習資料:
三、模塊截圖:
四、開發技術與運行環境:
五、代碼展示:
六、數據庫表截圖:
一、項目介紹:
背景:非物質文化遺產是指人類口頭傳統、表演藝術、社會實踐、儀式、節慶、知識與實踐、傳統手工藝等各種傳統文化表現形式。隨著社會的發展和文化保護意識的增強,非物質文化遺產的保護、傳承和展示變得越來越重要。因此,建立一個慶陽非物質文化遺產展示平臺的課題具有重要的研究意義。
目的:本課題旨在建立一個在線展示平臺,通過多種技術手段,如視頻、圖片、文字介紹等,全面展示慶陽地區的非物質文化遺產,促進非物質文化遺產的傳承和宣傳。
意義:通過該研究,可以更好地向公眾展示慶陽地區豐富的非物質文化遺產,增強公眾對非物質文化遺產的認識和保護意識,促進非物質文化遺產的傳承和發展。同時,也可以為慶陽地區的旅游業發展和文化產業振興提供有力支持。
研究方法:主要包括數字化展示技術、多媒體內容制作、網站建設、用戶體驗設計等。通過數字化展示技術對非物質文化遺產進行多維度的展示,利用多媒體內容制作技術制作展示內容,搭建專門的網站平臺進行展示,同時注重用戶體驗設計,使得展示平臺更加直觀、生動、易于理解。同時,還可以采用社會調研和用戶反饋等方法對展示平臺進行改進和優化。
二、文檔學習資料:
三、模塊截圖:
四、開發技術與運行環境:
技術棧:
1. 前端技術:
???Vue.js:用于構建用戶界面的漸進式JavaScript框架。
???Element UI:Vue的UI組件庫,用于快速構建界面。
???Axios:基于Promise的HTTP客戶端,用于與后端進行通信。
2. 后端技術:
???Spring:用于構建業務邏輯層的Java框架。
???Spring MVC:用于構建Web層的Spring框架。
???MyBatis:一個支持定制化SQL、存儲過程以及高級映射的持久層框架。
3. 數據庫技術:
???MySQL:常用的關系型數據庫管理系統。
4. 構建工具:
???Maven:項目管理和構建自動化工具。
運行環境:
1. 開發環境:
???IDE:如IDEA或eclipse,用于編碼和調試。
???本地數據庫:如MySQL,用于數據存儲和查詢。
???本地服務器:如Tomcat7.0,用于部署和運行Web應用。
五、代碼展示(示范代碼注釋):
/*** 用戶* 后端接口* @author* @email
*/
@RestController
@Controller
@RequestMapping("/yonghu")
public class YonghuController {private static final Logger logger = LoggerFactory.getLogger(YonghuController.class);private static final String TABLE_NAME = "yonghu";@Autowiredprivate YonghuService yonghuService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate GonggaoService gonggaoService;//公告@Autowiredprivate GuwenService guwenService;//顧問@Autowiredprivate GuwenChatService guwenChatService;//用戶咨詢@Autowiredprivate GuwenYuyueService guwenYuyueService;//顧問預約@Autowiredprivate JiankangzhishiService jiankangzhishiService;//健康知識@Autowiredprivate JiankangzhishiCollectionService jiankangzhishiCollectionService;//健康知識收藏@Autowiredprivate JiankangzhishiLiuyanService jiankangzhishiLiuyanService;//健康知識留言@Autowiredprivate UsersService usersService;//管理員/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不會進入");else if("用戶".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));else if("顧問".equals(role))params.put("guwenId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = yonghuService.queryPage(params);//字典表數據轉換List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list){//修改對應字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端詳情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity轉viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把實體數據重構到view中//修改對應字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到數據");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永遠不會進入");Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());logger.info("sql語句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"賬戶或者用戶手機號或者用戶身份證號已經被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());YonghuEntity oldYonghuEntity = yonghuService.selectById(yonghu.getId());//查詢原先數據String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永遠不會進入");if("".equals(yonghu.getYonghuPhoto()) || "null".equals(yonghu.getYonghuPhoto())){yonghu.setYonghuPhoto(null);}yonghuService.updateById(yonghu);//根據id更新return R.ok();}/*** 刪除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<YonghuEntity> oldYonghuList =yonghuService.selectBatchIds(Arrays.asList(ids));//要刪除的數據yonghuService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 批量上傳*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<YonghuEntity> yonghuList = new ArrayList<>();//上傳的東西Map<String, List<String>> seachFields= new HashMap<>();//要查詢的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"該文件沒有后綴");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后綴為xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//獲取文件路徑File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上傳文件,請聯系管理員");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//讀取xls文件dataList.remove(0);//刪除第一行,因為第一行是提示for(List<String> data:dataList){//循環YonghuEntity yonghuEntity = new YonghuEntity();
// yonghuEntity.setUsername(data.get(0)); //賬戶 要改的
// yonghuEntity.setPassword("123456");//密碼
// yonghuEntity.setYonghuName(data.get(0)); //用戶姓名 要改的
// yonghuEntity.setYonghuPhone(data.get(0)); //用戶手機號 要改的
// yonghuEntity.setYonghuIdNumber(data.get(0)); //用戶身份證號 要改的
// yonghuEntity.setYonghuPhoto("");//詳情和圖片
// yonghuEntity.setSexTypes(Integer.valueOf(data.get(0))); //性別 要改的
// yonghuEntity.setYonghuEmail(data.get(0)); //用戶郵箱 要改的
// yonghuEntity.setCreateTime(date);//時間yonghuList.add(yonghuEntity);//把要查詢是否重復的字段放入map中//賬戶if(seachFields.containsKey("username")){List<String> username = seachFields.get("username");username.add(data.get(0));//要改的}else{List<String> username = new ArrayList<>();username.add(data.get(0));//要改的seachFields.put("username",username);}//用戶手機號if(seachFields.containsKey("yonghuPhone")){List<String> yonghuPhone = seachFields.get("yonghuPhone");yonghuPhone.add(data.get(0));//要改的}else{List<String> yonghuPhone = new ArrayList<>();yonghuPhone.add(data.get(0));//要改的seachFields.put("yonghuPhone",yonghuPhone);}//用戶身份證號if(seachFields.containsKey("yonghuIdNumber")){List<String> yonghuIdNumber = seachFields.get("yonghuIdNumber");yonghuIdNumber.add(data.get(0));//要改的}else{List<String> yonghuIdNumber = new ArrayList<>();yonghuIdNumber.add(data.get(0));//要改的seachFields.put("yonghuIdNumber",yonghuIdNumber);}}//查詢是否重復//賬戶List<YonghuEntity> yonghuEntities_username = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("username", seachFields.get("username")));if(yonghuEntities_username.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_username){repeatFields.add(s.getUsername());}return R.error(511,"數據庫的該表中的 [賬戶] 字段已經存在 存在數據為:"+repeatFields.toString());}//用戶手機號List<YonghuEntity> yonghuEntities_yonghuPhone = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("yonghu_phone", seachFields.get("yonghuPhone")));if(yonghuEntities_yonghuPhone.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_yonghuPhone){repeatFields.add(s.getYonghuPhone());}return R.error(511,"數據庫的該表中的 [用戶手機號] 字段已經存在 存在數據為:"+repeatFields.toString());}//用戶身份證號List<YonghuEntity> yonghuEntities_yonghuIdNumber = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("yonghu_id_number", seachFields.get("yonghuIdNumber")));if(yonghuEntities_yonghuIdNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_yonghuIdNumber){repeatFields.add(s.getYonghuIdNumber());}return R.error(511,"數據庫的該表中的 [用戶身份證號] 字段已經存在 存在數據為:"+repeatFields.toString());}yonghuService.insertBatch(yonghuList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入數據異常,請聯系管理員");}}/*** 登錄*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));if(yonghu==null || !yonghu.getPassword().equals(password))return R.error("賬號或密碼不正確");String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "用戶");R r = R.ok();r.put("token", token);r.put("role","用戶");r.put("username",yonghu.getYonghuName());r.put("tableName","yonghu");r.put("userId",yonghu.getId());return r;}/*** 注冊*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody YonghuEntity yonghu, HttpServletRequest request) {
// ValidatorUtils.validateEntity(user);Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity != null)return R.error("賬戶或者用戶手機號或者用戶身份證號已經被使用");yonghu.setCreateTime(new Date());yonghuService.insert(yonghu);return R.ok();}/*** 重置密碼*/@GetMapping(value = "/resetPassword")public R resetPassword(Integer id, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectById(id);yonghu.setPassword("123456");yonghuService.updateById(yonghu);return R.ok();}/*** 修改密碼*/@GetMapping(value = "/updatePassword")public R updatePassword(String oldPassword, String newPassword, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectById((Integer)request.getSession().getAttribute("userId"));if(newPassword == null){return R.error("新密碼不能為空") ;}if(!oldPassword.equals(yonghu.getPassword())){return R.error("原密碼輸入錯誤");}if(newPassword.equals(yonghu.getPassword())){return R.error("新密碼不能和原密碼一致") ;}yonghu.setPassword(newPassword);yonghuService.updateById(yonghu);return R.ok();}/*** 忘記密碼*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));if(yonghu!=null){yonghu.setPassword("123456");yonghuService.updateById(yonghu);return R.ok();}else{return R.error("賬號不存在");}}/*** 獲取用戶的session用戶信息*/@RequestMapping("/session")public R getCurrYonghu(HttpServletRequest request){Integer id = (Integer)request.getSession().getAttribute("userId");YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity轉viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把實體數據重構到view中//修改對應字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到數據");}}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = yonghuService.queryPage(params);//字典表數據轉換List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list)dictionaryService.dictionaryConvert(c, request); //修改對應字典表字段return R.ok().put("data", page);}/*** 前端詳情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity轉viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把實體數據重構到view中//修改對應字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到數據");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber())
// .notIn("yonghu_types", new Integer[]{102});logger.info("sql語句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"賬戶或者用戶手機號或者用戶身份證號已經被使用");}}}