【维普】软件工程-基于SpringBoot的宠物领养系统的设计与实现_第1页
【维普】软件工程-基于SpringBoot的宠物领养系统的设计与实现_第2页
【维普】软件工程-基于SpringBoot的宠物领养系统的设计与实现_第3页
【维普】软件工程-基于SpringBoot的宠物领养系统的设计与实现_第4页
【维普】软件工程-基于SpringBoot的宠物领养系统的设计与实现_第5页
已阅读5页,还剩53页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

目录参考文献朱九超,孙泉云,夏炉明,等.流浪宠物的成因、危害及其防控对策[J].上海畜牧兽医通讯,2015(3):3.赵衡.对流浪宠物该如何有效管理[N].检察日报,2017-12-16(003).吴文洋,刘世宇.基于B/S架构宠物领养管理系统设计[J].软件,2020,41(11):85-87.赵亚洲,杨晓冬.动物领养管理系统的设计与实现[J].无线互联科技,2022,19(18):61-65+72.姜苏.基于互联网平台解决社会流浪动物问题的可行性研究[D].泰安:山东农业大学,2020.李俊山,叶霞,罗蓉,等.数据库原理及应用(SQLServer)[M].北京:清华大学出版社,2017.黑马程序员.JavaEE企业级应用开发教程(Spring+SpringMVC+MyBatis)[M].北京:人民邮电出版社,2017.黄玲,余霞.基于云平台的电子商务商品智能推荐系统[J].现代电子技术,2020,43(5):183-186.LimH,XieL.ANewWeightedImputedNeighborhood-RegularizedTri-FactorizationOne-ClassCollaborativeFilteringAlgorithm:ApplicationtoTargetGenePredictionofTranscriptionFactors[J].IEEE/ACMtransactionsoncomputationalbiologyandbioinformatics,2021(1):18.王绍卿,李鑫鑫,孙福振,等.个性化新闻推荐技术研究综述[J].计算机科学与探索,2020,14(1):18-29.HuangChuangguang,YinJian,WanJing,Unmcertainneighbors'collaborativefilteringrecommendationalgorithm[J].ChineseJournalofcomputers,2014,33(8):1369-1377.汤伟韬,余敦辉,魏世伟.融合知识图谱与用户评论的商品推荐算法[J].计算机工程,2020,46(8):93-100.王子茹,宋尚文,阎红灿.协同过滤推荐算法的性能对比与分析[J].计算机仿真,2022,39(09):435-440.荣辉桂,火生旭,胡春华,等.基于用户相似度的协同过滤推荐算法[J].通信学报,2014,35(2):16-24.ZhaoW,TianH,WuY,etal.ANewItem-BasedCollaborativeFilteringAlgorithmtolmprovetheAccuracyofPredictioninSparseData[J].InternationalJournalofComputationalIntelligenceSystems,2022,15(1):1-15.致谢附录附录ApublicclassUser{

privateIntegeruserid;

privateStringaccount;

privateStringpassword;

privateStringusername;

privateStringaddress;

privateintsex;

@DateTimeFormat(pattern="yyyy-MM-dd")

privateDatebirthday;

privateStringnickname;

privateDateEdittime;

privateStringtelephone;

privateintexperience;

privatebyte[]photo;

publicUser(){

}

publicUser(Integeruserid,Stringaccount,

Stringpassword,Stringusername,Stringaddress,

intsex,Datebirthday,Stringnickname,Dateedittime,

Stringtelephone,intexperience,byte[]photo){

this.userid=userid;

this.account=account;

this.password=password;

this.username=username;

this.address=address;

this.sex=sex;

this.birthday=birthday;

this.nickname=nickname;

Edittime=edittime;

this.telephone=telephone;

this.experience=experience;

this.photo=photo;

}

publicIntegergetUserid(){

returnuserid;}

publicvoidsetUserid(Integeruserid){

this.userid=userid;}

publicStringgetAccount(){

returnaccount;}

publicvoidsetAccount(Stringaccount){

this.account=account;}

publicStringgetPassword(){

returnpassword;}

publicvoidsetPassword(Stringpassword){

this.password=password;}

publicStringgetUsername(){

returnusername;}

publicvoidsetUsername(Stringusername){

this.username=username;}

publicStringgetAddress(){

returnaddress;}

publicvoidsetAddress(Stringaddress){

this.address=address;}

附录B

@Controller

publicclassUserLoginController{

@Autowired

privateUserServiceuserService;

@Value("${imgpath}")

privateStringimgpath;

@PostMapping(value="user/login")

publicStringUserLogin(Stringaccount,Stringpassword,

Map<String,Object>map,HttpSessionsession){

Useruser=userService.returnUserByAccount(account,password);

if(user!=null){

session.setAttribute("loginUser",user);

map.put("loginUser",user);

System.out.println("要登录的用户为:"+user);

if(user.getPhoto()!=null){

StringfileSavePath=imgpath+

"Project_1.0\\src\\main\\resources\\static\\asserts\\userphoto\\";

StringfileSaveName=fileSavePath+user.getUserid()+".jpg";

Stringsrc="/asserts/userphoto/";

Stringfilename=src+user.getUserid()+".jpg";

session.setAttribute("filename",filename);

FileOutputStreamfos=null;

byte[]photo=user.getPhoto();

try{

fos=newFileOutputStream(fileSaveName);

fos.write(photo);

}catch(FileNotFoundExceptione){

e.printStackTrace();

}catch(IOExceptione){

e.printStackTrace();

}finally{

if(fos!=null)

{

try{

fos.close();

}catch(IOExceptione){

e.printStackTrace();

}

}

}

//将路径传给”用户页面“去显示

map.put("fileName",filename);

}

else{

//头像头像为空。显示一个默认头像

map.put("fileName","/asserts/img/catDefault.jpg");

session.setAttribute("filename","/asserts/img/catDefault.jpg");

}

return"userPage";

}

else{

map.put("msg","密码错误或账号不对,导致登录失败");

System.out.println("登录失败");

return"index";

}

}

附录C

@Controller

publicclassAdminManagePetsController{

@Autowired

privateAdoptRelationshipServiceadoptRelationshipService;

@Autowired

privateVarietiesServicevarietiesService;

@Autowired

privateAnimalServiceanimalService;

@Autowired

privateAdminServiceadminService;

@Value("${imgpath}")

privateStringimgpath;

@GetMapping(value="toManagePetsPage")

publicStringtoManagePetsPage(@RequestParam("currentPage")IntegercurrentPage,

Modelmodel,HttpSessionsession)

{

//管理员信息回显

ControllerTrmationEcho(session,model,1);

IntegernumberOfAnimals=animalService.getNumberOfAnimals();

PageSupportpageSupport=newPageSupport();

ArrayList<Integer>integers=PaginationTool.paginationTool(currentPage,numberOfAnimals,pageSupport,3);

//分页显示的动物信息

Map<Integer,Animal>allAnimalsBySeparate=

adminService.getAllAnimalsBySeparate(currentPage*pageSupport.getPageSize(),pageSupport.getPageSize());

intsize=allAnimalsBySeparate.size();

//存储去页面展示的各动物的照片路径信息

Map<Integer,String>fileName=newHashMap<>();

intk=1;

while(size!=0&&allAnimalsBySeparate.get(currentPage*pageSupport.getPageSize()+k)!=null)

{

Integerid=allAnimalsBySeparate.get(currentPage*pageSupport.getPageSize()+k).getAnimalID();

if(allAnimalsBySeparate.get(currentPage*pageSupport.getPageSize()+k).getPhoto()!=null)

{

//动物照片的相对路径

Stringfilename="/asserts/animalphoto/"+id+".jpg";

fileName.put(id,filename);

}

size--;

k++;

}

model.addAttribute("fileName",fileName);

model.addAttribute("animals",allAnimalsBySeparate);

//在页面中用于循环的变量

ArrayList<Integer>arrayList=newArrayList<>();

inti=pageSupport.getPageSize();

intj=1;

while(i!=0)

{

arrayList.add(j);

i--;

j++;

}

model.addAttribute("arrayList",arrayList);

model.addAttribute("list",integers);

//前端页面在Map中取值的Key值

model.addAttribute("currentPage",currentPage*pageSupport.getPageSize());

System.out.println(allAnimalsBySeparate);

return"managePets";

}

@GetMapping(value="toEditAnimalPage")

publicStringtoEditAnimalPage(@RequestParam(value="animalId")IntegeranimalID,HttpSessionsession,Modelmodel)

{

//管理员信息回显

ControllerTrmationEcho(session,model,1);

//根据动物编号查询出动物

AnimalanimalById=animalService.getAnimalById(animalID);

//也页面回显

model.addAttribute("EditAnimal",animalById);

Collection<Varieties>varieties=varietiesService.getAllVarieties().values();

//回显动物种类

model.addAttribute("varieties",varieties);

VarietiesvarietiesById=varietiesService.getVarietiesById(animalById.getVarieties().getVarietiesID());

model.addAttribute("varietiesById",varietiesById);

return"editAnimalPage";

}

@PostMapping(value="updateAnimalInfo")

publicStringupdateAnimalInfo(@RequestPart(value="animalPhotos")MultipartFilefile,

Animalanimal,@RequestParam("varietiesID")IntegervarietiesID)

throwsIOException

{

Stringfilename=null;

if(!file.isEmpty())

{

//拿到文件名

IntegeranimalID=animal.getAnimalID();

//文件保存路径

StringfileSavePath=imgpath+

"Project_1.0\\src\\main\\resources\\static\\asserts\\animalphoto\\";

//完整文件名

filename=fileSavePath+animalID+".jpg";

//将文件传输到一个地方,先将文件保存在本地,再写入到数据库

file.transferTo(newFile(filename));

FileInputStreamfis=newFileInputStream(filename);

//更新动物照片

inti=animalService.updateAnimalPhotos(animal.getAnimalID(),fis);

if(i!=0)

{

System.out.println("更新动物照片成功");

}

else{

System.out.println("更新动物照片失败");

}

fis.close();

}

//更新动物信息

inti=animalService.updateAnimalInfo(animal,varietiesID);

if(i!=0)

{

System.out.println("更新动物信息成功");

}

else{

System.out.println("更新动物信息失败");

}

return"redirect:/toManagePetsPage?currentPage=0";

}

}附录D@OverridepublicList<Animal>selectAll(Integercurrent){if(current==null){returnnull;}//List<Animal>page=newList<>(current,8);List<Animal>list=articleMapper.selectAll(page);returnlist;}@OverridepublicList<Animal>getAnimal(IntegeruserId){try{//创建训练集FastByIDMap<PreferenceArray>preMap=newFastByIDMap<>();//首先放自己的行为List<History>histories=historyMapper.getHistoryByUserId(userId);if(histories==null||histories.size()<=0){//如果是新用户的话,就没有历史记录,直接返回首页页面returnselectAll(newRandom().nextInt(5)).getRecords();}PreferenceArrayuser1=newGenericUserPreferenceArray(100);inttemp=0;for(Historyhistory:histories){user1.setUserID(temp,history.getUserId());user1.setItemID(temp,Long.parseLong(history.getPid()));user1.setValue(temp,newRandom().nextLong()%10);temp++;}preMap.put(userId,user1);//每个用户大概10条数据,一次从50条数据中查找Page<Student>userPage=newPage<>(newRandom().nextInt(3),5);List<Student>users=studentMapper.selectPage(userPage,null).getRecords();("用户"+String.valueOf(users.size()));for(Studentuser:users){histories=historyMapper.getHistoryByUserId(user.getId());user1=newGenericUserPreferenceArray(10);temp=0;for(Historyhistory:histories)

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论