diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 188725fc9c7e5b532f41ecd1e760d56e05ffa1eb..21b9e1e9376c1ebcb2340f9281384b4cef04e8c7 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -7,5 +7,11 @@ com.mysql.cj.jdbc.Driver jdbc:mysql://121.37.129.14:3306/kunpeng + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://121.37.129.14:3306/kunpeng + \ No newline at end of file diff --git a/DAL/DAL.iml b/DAL/DAL.iml index 5b4a9ec94865f1831300adbbe5c3fb3bc78c2a0d..dae51c210ed08593f706b7faa4439ef08ce764ed 100644 --- a/DAL/DAL.iml +++ b/DAL/DAL.iml @@ -26,6 +26,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DAL/src/main/java/entity/Admin.java b/DAL/src/main/java/entity/Admin.java index 3b92215eaee3763aed3c3bd5f3e492e641b2e76c..c789abf691b545322227dc80cae225502615ba46 100644 --- a/DAL/src/main/java/entity/Admin.java +++ b/DAL/src/main/java/entity/Admin.java @@ -1,40 +1,101 @@ package entity; public class Admin { - private Integer Ad_no; - private String Ad_name; - private String Ad_College; + private Integer adId; + private String adNo; + private String adName; + private String adCollege; + private String adPassword; + private String adSex; + private String adPortrait; + private Integer adAge; + private String adAuthority; - public Integer getAd_no() { - return Ad_no; + + public Integer getAdId() { + return adId; + } + + public void setAdId(Integer adId) { + this.adId = adId; + } + + public String getAdNo() { + return adNo; + } + + public void setAdNo(String adNo) { + this.adNo = adNo; + } + + public String getAdName() { + return adName; + } + + public void setAdName(String adName) { + this.adName = adName; + } + + public String getAdCollege() { + return adCollege; + } + + public void setAdCollege(String adCollege) { + this.adCollege = adCollege; + } + + public String getAdPassword() { + return adPassword; + } + + public void setAdPassword(String adPassword) { + this.adPassword = adPassword; + } + + public String getAdSex() { + return adSex; + } + + public void setAdSex(String adSex) { + this.adSex = adSex; + } + + public String getAdPortrait() { + return adPortrait; } - public void setAd_no(Integer ad_no) { - Ad_no = ad_no; + public void setAdPortrait(String adPortrait) { + this.adPortrait = adPortrait; } - public String getAd_name() { - return Ad_name; + public Integer getAdAge() { + return adAge; } - public void setAd_name(String ad_name) { - Ad_name = ad_name; + public void setAdAge(Integer adAge) { + this.adAge = adAge; } - public String getAd_College() { - return Ad_College; + public String getAdAuthority() { + return adAuthority; } - public void setAd_College(String ad_College) { - Ad_College = ad_College; + public void setAdAuthority(String adAuthority) { + this.adAuthority = adAuthority; } @Override public String toString() { return "Admin{" + - "Ad_no=" + Ad_no + - ", Ad_name='" + Ad_name + '\'' + - ", Ad_College='" + Ad_College + '\'' + + "adId=" + adId + + ", adNo='" + adNo + '\'' + + ", adName='" + adName + '\'' + + ", adCollege='" + adCollege + '\'' + + ", adPassword='" + adPassword + '\'' + + ", adSex='" + adSex + '\'' + + ", adPortrait='" + adPortrait + '\'' + + ", adAge=" + adAge + + ", adAuthority='" + adAuthority + '\'' + '}'; } } diff --git a/DAL/src/main/java/entity/User.java b/DAL/src/main/java/entity/User.java index 976f340e01410d5982f5844ab367b34683b80b9a..dcf0bdc6274a5ce58c4fa52ba0a4ca0060f436b2 100644 --- a/DAL/src/main/java/entity/User.java +++ b/DAL/src/main/java/entity/User.java @@ -3,42 +3,28 @@ package entity; public class User { - private Integer sno; + private String sno; private String sname; - private String sCollege; + private String scollege; private String password; private String sex; - private String age; + private Integer age; private String headportrait; private String joined; - @Override - public String toString() { - return "User{" + - "sno=" + sno + - ", sname='" + sname + '\'' + - ", sCollege='" + sCollege + '\'' + - ", password='" + password + '\'' + - ", sex='" + sex + '\'' + - ", age='" + age + '\'' + - ", headportrait='" + headportrait + '\'' + - ", joined='" + joined + '\'' + - '}'; + public Integer getId() { + return id; } - public String getJoined() { - return joined; - } - - public void setJoined(String joined) { - this.joined = joined; + public void setId(Integer id) { + this.id = id; } - public Integer getSno() { + public String getSno() { return sno; } - public void setSno(Integer sno) { + public void setSno(String sno) { this.sno = sno; } @@ -50,12 +36,12 @@ public class User { this.sname = sname; } - public String getsCollege() { - return sCollege; + public String getScollege() { + return scollege; } - public void setsCollege(String sCollege) { - this.sCollege = sCollege; + public void setScollege(String scollege) { + this.scollege = scollege; } public String getPassword() { @@ -74,11 +60,11 @@ public class User { this.sex = sex; } - public String getAge() { + public Integer getAge() { return age; } - public void setAge(String age) { + public void setAge(Integer age) { this.age = age; } @@ -90,4 +76,26 @@ public class User { this.headportrait = headportrait; } + public String getJoined() { + return joined; + } + + public void setJoined(String joined) { + this.joined = joined; + } + + @Override + public String toString() { + return "User{" + + "id=" + id + + ", sno='" + sno + '\'' + + ", sname='" + sname + '\'' + + ", scollege='" + scollege + '\'' + + ", password='" + password + '\'' + + ", sex='" + sex + '\'' + + ", age=" + age + + ", headportrait='" + headportrait + '\'' + + ", joined='" + joined + '\'' + + '}'; + } } diff --git a/DAL/src/main/java/mapper/AdminMapper.java b/DAL/src/main/java/mapper/AdminMapper.java index 9a7b053f502caea684a58bed8a02ad9b715ae3d1..7b017f74e25e92671fce17bdc12c2ad269c2696e 100644 --- a/DAL/src/main/java/mapper/AdminMapper.java +++ b/DAL/src/main/java/mapper/AdminMapper.java @@ -2,14 +2,17 @@ package mapper; import entity.Admin; import entity.Comment; +import entity.User; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface AdminMapper { int addAdmin(Admin admin); - int deleteAdmin(Integer adNo); + int deleteAdmin(String adNo); int updateAdmin(Admin admin); - Admin findByAdminInfo(); + Admin findByAdminNO(String adNo); Admin adminLogin(String adName,String adPassword); + List findAllAdmin(); + } diff --git a/DAL/src/main/java/mapper/UserMapper.java b/DAL/src/main/java/mapper/UserMapper.java index 5eb9728a5f2d0adf87a6bca7ca6cc8a19afc6796..d2be5a1bba19082f87fe0ab884f5b4d446732ea7 100644 --- a/DAL/src/main/java/mapper/UserMapper.java +++ b/DAL/src/main/java/mapper/UserMapper.java @@ -10,11 +10,14 @@ public interface UserMapper { public User login(String Sno, String Password); - int register(User user); + int register(User user); User findBySno(String sno); - List findAll(); - int update(User user); + List findAllUser(); + int updateUser(User user); int deleteUser(String sno); + List findMembers(); + int joinCommunity(String sno); + int acceptJoin(String sno); + int rejectJoin(String sno); - int updateJoinedStatusBySno(String sno); } diff --git a/DAL/src/main/resources/mapper/AdminMapper.xml b/DAL/src/main/resources/mapper/AdminMapper.xml index 925586d342672305d68ff9ad9469b561ebe29e51..1c9976258f55afb0000a626cf6c7d356c36c13d2 100644 --- a/DAL/src/main/resources/mapper/AdminMapper.xml +++ b/DAL/src/main/resources/mapper/AdminMapper.xml @@ -3,23 +3,25 @@ - + + - + + - SELECT * FROM admin - SELECT * FROM admin WHERE Ad_No= #{adNo} @@ -29,8 +31,8 @@ - - insert into admin (Ad_name,Ad_College,Ad_password,Ad_Sex,Ad_age) values ( #{adName}, #{adCollege}, #{adPassword}, #{adSex}, #{Ad_age}) + + insert into admin (Ad_no,Ad_name,Ad_College,Ad_password,Ad_Sex,Ad_age) values (#{adNo},#{adName}, #{adCollege}, #{adPassword}, #{adSex}, #{adAge}) @@ -40,7 +42,7 @@ - + DELETE FROM admin WHERE Ad_No= #{adNo} @@ -65,4 +67,5 @@ SELECT * FROM user WHERE Sno = #{sno} --> + diff --git a/DAL/src/main/resources/mapper/UserMapper.xml b/DAL/src/main/resources/mapper/UserMapper.xml index 402c72332f43c262535f2f99749a574da38162e3..4370f946265c80aa990d3073b5297af5e93cf6a8 100644 --- a/DAL/src/main/resources/mapper/UserMapper.xml +++ b/DAL/src/main/resources/mapper/UserMapper.xml @@ -3,7 +3,7 @@ - + @@ -18,7 +18,7 @@ SELECT * FROM user WHERE sno = #{param1} and sname = #{param2} --> - SELECT * FROM user @@ -49,7 +49,7 @@ - + UPDATE user SET WHERE 1=1 Sname = #{sname} @@ -68,10 +68,18 @@ + - - UPDATE user set Joined = 'auditing' where Joined = 'false' - and Sno = #{sno} + + UPDATE user SET Joined='true'where Sno=#{sno}; + + + UPDATE user SET Joined='2' where Sno=#{sno}; + + + UPDATE user SET Joined='3' where Sno=#{sno}; diff --git a/Service/src/main/java/service/AdminService.java b/Service/src/main/java/service/AdminService.java new file mode 100644 index 0000000000000000000000000000000000000000..ec4a16dd9172612289329610d971a586845aedb2 --- /dev/null +++ b/Service/src/main/java/service/AdminService.java @@ -0,0 +1,31 @@ +package service; + +import entity.Admin; +import entity.User; +import mapper.AdminMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class AdminService { + @Autowired + private AdminMapper adminMapper; + public Admin adminLogin(String adName,String adPassword){ + return adminMapper.adminLogin( adName,adPassword); + } + public int addAdmin(Admin admin){ + return adminMapper.addAdmin(admin); + } + public int deleteAdmin(String adNo){ + return adminMapper.deleteAdmin(adNo); + } + public int updateAdmin(Admin admin){ + return adminMapper.updateAdmin(admin); + } + public Admin findByAdminNO(String adNo){ + return adminMapper.findByAdminNO(adNo); + } + public List findAllAdmin(){return adminMapper.findAllAdmin();} +} diff --git a/Service/src/main/java/service/UserService.java b/Service/src/main/java/service/UserService.java index 79db50881a9cfcffc2f3ab6443233de272f375d4..6b3f008d265664b0b53f23bf495f22f0766d08bf 100644 --- a/Service/src/main/java/service/UserService.java +++ b/Service/src/main/java/service/UserService.java @@ -1,6 +1,8 @@ package service; +import entity.Admin; import entity.User; +import jdk.nashorn.internal.ir.CallNode; import mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -13,31 +15,32 @@ public class UserService { @Autowired private UserMapper userMapper; //抽象类不能实例化 - public void login(){ +/*public void login(){ System.out.println("登录中"); -} +}*/ + -/* -String sno="143"; +/*String sno="143"; String sname="234"; public User login(String username, String password){ return userMapper.login(sno,sname); - } -*/ + }*/ public User login(String Sno, String Password){return userMapper.login(Sno,Password);} - - public int register(User user){return userMapper.register(user);} - public User findById(String sno) { + public int updateUser(User user) { return userMapper.updateUser(user); } + public int register(User user){return userMapper.register(user);} + public User findBySno(String sno) { return userMapper.findBySno(sno); } - public List findAll(){ - return userMapper.findAll(); + public List findAllUser(){ + return userMapper.findAllUser(); } + public int deleteUser(String sno){ return userMapper.deleteUser(sno); } + public List findMembers(){return userMapper.findMembers();} + public int joinCommunity(String sno){return userMapper.joinCommunity(sno);} + public int acceptJoin(String sno){return userMapper.acceptJoin(sno);}; + public int rejectJoin(String sno){return userMapper.rejectJoin(sno);}; - public int updateJoinedStatusBySno(String sno){ - return userMapper.updateJoinedStatusBySno(sno); - } } diff --git a/app/src/main/java/kunpeng/Configuration/LoginConfig.java b/app/src/main/java/kunpeng/Configuration/LoginConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..0b52c87eed49dad793ac3d87d936af7b1931491d --- /dev/null +++ b/app/src/main/java/kunpeng/Configuration/LoginConfig.java @@ -0,0 +1,23 @@ +package kunpeng.Configuration; + +//import kunpeng.controller.Interceptor.LoginInterceptor; +import org.springframework.web.servlet.config.annotation.InterceptorRegistration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +//public class LoginConfig implements WebMvcConfigurer { +// @Override +// public void addInterceptors(InterceptorRegistry registry) { +// 注册TestInterceptor拦截器 +// InterceptorRegistration registration = registry.addInterceptor(new LoginInterceptor()); +// registration.addPathPatterns("/**"); //所有路径都被拦截 +// registration.excludePathPatterns( //添加不拦截路径 +// "/api/log", //登录 +// "/**/*.html", //html静态资源 +// "/**/*.js", //js静态资源 +// "/**/*.css", //css静态资源 +// "/**/*.woff", +// "/**/*.ttf" +// ); +// } +//} diff --git a/app/src/main/java/kunpeng/bean/CodeMsg.java b/app/src/main/java/kunpeng/bean/CodeMsg.java index f89a95c26b272c028d8d035e9468db7a8e74a057..b73c13190933e4945e9f52434c52e9d7a71533a3 100644 --- a/app/src/main/java/kunpeng/bean/CodeMsg.java +++ b/app/src/main/java/kunpeng/bean/CodeMsg.java @@ -41,7 +41,7 @@ public class CodeMsg { public void setMsg(String msg) { this.msg = msg; } - + //通用错误码定义 //处理成功消息码 public static CodeMsg SUCCESS = new CodeMsg(0, "success"); @@ -58,23 +58,63 @@ public class CodeMsg { public static CodeMsg PHONE_ERROR = new CodeMsg(-12, "手机号错误!"); public static CodeMsg ORDER_AUTH_ERROR = new CodeMsg(-13, "\u8ba2\u5355\u9a8c\u8bc1\u5931\u8d25\uff0c\u8ba2\u5355\u7f16\u53f7\u6216\u624b\u673a\u53f7\u8f93\u5165\u6709\u8bef\u6216\u8005\u53ef\u80fd\u4f60\u8d2d\u4e70\u7684\u662f\u76d7\u7248\uff0c\u8bf7\u8054\u7cfb\u3010\u733f\u6765\u5165\u6b64\u3011\u5ba2\u670d\uff01"); public static CodeMsg UNKNOWN_ERROR = new CodeMsg(Integer.MIN_VALUE,"未知错误,请联系管理员解决问题!"); - - + + + public static CodeMsg LOGIN_SUCCESS = new CodeMsg(20, "登录成功"); + public static CodeMsg LEVEL_ERROR = new CodeMsg(800, "你没有权限执行该操作"); + public static CodeMsg USER_NAME_NO_EXIST = new CodeMsg(21, "该用户名不存在!"); + public static CodeMsg USERNAME_NO_EXIST = new CodeMsg(-3000, "该用户名不存在!"); + public static CodeMsg USER_PASSWORD_ERROR = new CodeMsg(22, "密码错误!"); + public static CodeMsg USER_INFO = new CodeMsg(700, "用户个人信息"); + public static CodeMsg USERS_INFO = new CodeMsg(100, "用户信息"); + public static CodeMsg MEMBERS_INFO = new CodeMsg(50, "用户个人信息"); + //注册类 + public static CodeMsg USER_INFO_EMPTY = new CodeMsg(34, "请填写个人信息"); + public static CodeMsg User_SNO_EMPTY = new CodeMsg(34, "学号不能为空!"); + public static CodeMsg USER_SNO_IS_EXIST = new CodeMsg(31, "用户已存在"); + public static CodeMsg USER_USERNAME_EMPTY = new CodeMsg(34, "姓名不能为空"); + public static CodeMsg USER_PASSWORD_EMPTY = new CodeMsg(34, "密码不能为空!"); + public static CodeMsg User_SCOLLEGE_EMPTY = new CodeMsg(34, "学院不能为空"); + public static CodeMsg User_SEX_EMPTY = new CodeMsg(34, "性别不能为空"); + public static CodeMsg User_AGE_EMPTY = new CodeMsg(34, "年龄不能为空"); + public static CodeMsg Unknown_ERROR= new CodeMsg(101, "未知错误"); + public static CodeMsg REGISTER_SUCCESS= new CodeMsg(30, "成功"); + public static CodeMsg DELETE_USER_SUCCESS = new CodeMsg(600, "删除用户成功"); + public static CodeMsg DELETE_USER_ERROR= new CodeMsg(601, "删除用户失败"); + public static CodeMsg UPDATE_USER_SUCCESS = new CodeMsg(200, "修改用户信息成功"); + public static CodeMsg UPDATE_USER_ERROR= new CodeMsg(201, "修改用户信息失败"); + public static CodeMsg ADD_ADMIN_SUCCESS= new CodeMsg(300, "添加管理员成功"); + public static CodeMsg UPDATE_ADMIN_SUCCESS = new CodeMsg(301, "修改管理员信息成功"); + public static CodeMsg UPDATE_ADMIN_ERROR= new CodeMsg(81, "修改管理员信息失败"); + public static CodeMsg ADMIN_INFO = new CodeMsg(90, "管理员个人信息"); + public static CodeMsg DELETE_ADMIN_SUCCESS = new CodeMsg(500, "删管理员成功"); + public static CodeMsg DELETE_ADMIN_ERROR= new CodeMsg(501, "删除管理员失败"); + public static CodeMsg joinCommunity_SUCCESS = new CodeMsg(100, "申请进入社团请求发送成功"); + public static CodeMsg joinCommunity_EORROR= new CodeMsg(101, "申请进入社团请求发送失败"); + public static CodeMsg rejectJoin_SUCCESS = new CodeMsg(100, "申请进入社团请求已被拒绝"); + public static CodeMsg rejectJoin_ERROR= new CodeMsg(101, "申请进入社团请求发生错误"); + public static CodeMsg acceptJoin_SUCCESS = new CodeMsg(100, "申请进入社团请求已通过"); + public static CodeMsg acceptJoin_ERROR= new CodeMsg(101, "申请进入社团请求发生错误"); + + + //后台管理类错误码 //用户管理类错误 public static CodeMsg ADMIN_USERNAME_EMPTY = new CodeMsg(-2000, "用户名不能为空!"); public static CodeMsg ADMIN_PASSWORD_EMPTY = new CodeMsg(-2001, "密码不能为空!"); public static CodeMsg ADMIN_NO_RIGHT = new CodeMsg(-2002, "您所属的角色没有该权限!"); + public static CodeMsg ADMINS_INFO = new CodeMsg(400, "获取管理员信息成功!"); + public static CodeMsg ADMINS_INFO_ERROR = new CodeMsg(401, "获取管理员信息失败!"); + //登录类错误码 - public static CodeMsg USERNAME_NO_EXIST = new CodeMsg(-3000, "该用户名不存在!"); - public static CodeMsg User_PASSWORD_ERROR = new CodeMsg(-3001, "密码错误!"); + public static CodeMsg ADMIN_USERNAME_NO_EXIST = new CodeMsg(-3000, "该用户名不存在!"); + public static CodeMsg ADMIN_PASSWORD_ERROR = new CodeMsg(-3001, "密码错误!"); public static CodeMsg ADMIN_USER_UNABLE = new CodeMsg(-3002, "该用户已被冻结,请联系管理员!"); public static CodeMsg ADMIN_USER_ROLE_UNABLE = new CodeMsg(-3003, "该用户所属角色状态不可用,请联系管理员!"); public static CodeMsg ADMIN_USER_ROLE_AUTHORITES_EMPTY = new CodeMsg(-3004, "该用户所属角色无可用权限,请联系管理员!"); - public static CodeMsg User_Login_Success = new CodeMsg(20, "登录成功!"); - + //后台菜单管理类错误码 public static CodeMsg ADMIN_MENU_ADD_ERROR = new CodeMsg(-4000, "菜单添加失败,请联系管理员!"); public static CodeMsg ADMIN_MENU_EDIT_ERROR = new CodeMsg(-4001, "菜单编辑失败,请联系管理员!"); @@ -93,11 +133,11 @@ public class CodeMsg { public static CodeMsg ADMIN_USE_NO_EXIST = new CodeMsg(-6003, "用户不存在!"); public static CodeMsg ADMIN_USE_EDIT_ERROR = new CodeMsg(-6004, "用户编辑失败,请联系管理员!"); public static CodeMsg ADMIN_USE_DELETE_ERROR = new CodeMsg(-6005, "该用户存在关联数据,不允许删除!"); - + //后台用户修改密码类错误码 public static CodeMsg ADMIN_USER_UPDATE_PWD_ERROR = new CodeMsg(-7000, "旧密码错误!"); public static CodeMsg ADMIN_USER_UPDATE_PWD_EMPTY = new CodeMsg(-7001, "新密码不能为空!"); - + //后台用户修改密码类错误码 public static CodeMsg ADMIN_DATABASE_BACKUP_NO_EXIST = new CodeMsg(-8000, "备份记录不存在!"); @@ -130,23 +170,23 @@ public class CodeMsg { public static CodeMsg ADMIN_SITESETTING_EDIT_ERROR = new CodeMsg(-9400, "网站设置失败,请联系管理员!"); //前端用户登录注册类错误码 - public static CodeMsg HOME_STUDENT_REGISTER_SN_EXIST = new CodeMsg(-10001, "该学号已存在,请勿重复注册!"); - public static CodeMsg HOME_STUDENT_REGISTER_ERROR = new CodeMsg(-10002, "注册失败,请联系管理员!"); - public static CodeMsg HOME_STUDENT_SN_NO_EXIST = new CodeMsg(-10003, "该学号不存在!"); - public static CodeMsg HOME_STUDENT_PASSWORD_ERROR = new CodeMsg(-10004, "密码错误!"); - public static CodeMsg HOME_STUDENT_UNABLE = new CodeMsg(-10005, "该用户已被冻结,请联系管理员!"); + public static CodeMsg HOME_STUDENT_REGISTER_SN_EXIST = new CodeMsg(-10000, "该学号已存在,请勿重复注册!"); + public static CodeMsg HOME_STUDENT_REGISTER_ERROR = new CodeMsg(-10001, "注册失败,请联系管理员!"); + public static CodeMsg HOME_STUDENT_SN_NO_EXIST = new CodeMsg(-10002, "该学号不存在!"); + public static CodeMsg HOME_STUDENT_PASSWORD_ERROR = new CodeMsg(-10003, "密码错误!"); + public static CodeMsg HOME_STUDENT_UNABLE = new CodeMsg(-10003, "该用户已被冻结,请联系管理员!"); //前端用户中心错误码 - public static CodeMsg HOME_STUDENT_EDITINFO_ERROR = new CodeMsg(-20001, "基本信息修改失败,请联系管理员!"); - public static CodeMsg HOME_STUDENT_EDITPWD_OLD_ERROR = new CodeMsg(-20002, "原密码错误!"); + public static CodeMsg HOME_STUDENT_EDITINFO_ERROR = new CodeMsg(-20000, "基本信息修改失败,请联系管理员!"); + public static CodeMsg HOME_STUDENT_EDITPWD_OLD_ERROR = new CodeMsg(-20001, "原密码错误!"); //前端用户发布物品错误码 - public static CodeMsg HOME_STUDENT_PUBLISH_ERROR = new CodeMsg(-30001, "物品发布失败,请联系管理员!"); - public static CodeMsg HOME_STUDENT_GOODS_EDIT_ERROR = new CodeMsg(-30002, "物品发布失败,请联系管理员!"); - public static CodeMsg HOME_STUDENT_GOODS_NO_EXIST = new CodeMsg(-30003, "物品不存在!"); - public static CodeMsg HOME_STUDENT_PUBLISH_CATEGORY_EMPTY = new CodeMsg(-30004, "请选择物品分类!"); + public static CodeMsg HOME_STUDENT_PUBLISH_ERROR = new CodeMsg(-30000, "物品发布失败,请联系管理员!"); + public static CodeMsg HOME_STUDENT_GOODS_EDIT_ERROR = new CodeMsg(-30001, "物品发布失败,请联系管理员!"); + public static CodeMsg HOME_STUDENT_GOODS_NO_EXIST = new CodeMsg(-30002, "物品不存在!"); + public static CodeMsg HOME_STUDENT_PUBLISH_CATEGORY_EMPTY = new CodeMsg(-30003, "请选择物品分类!"); //前端用户举报物品 - public static CodeMsg HOME_STUDENT_REPORT_GOODS_ERROR = new CodeMsg(-40001, "举报失败,请联系管理员!"); - public static CodeMsg HOME_STUDENT_REPORTED_GOODS = new CodeMsg(-40002, "您已经举报过该物品,请勿重复举报!"); - public static CodeMsg HOME_STUDENT_REPORTED_NO_EXIST = new CodeMsg(-40003, "举报信息不存在!"); + public static CodeMsg HOME_STUDENT_REPORT_GOODS_ERROR = new CodeMsg(-40000, "举报失败,请联系管理员!"); + public static CodeMsg HOME_STUDENT_REPORTED_GOODS = new CodeMsg(-40001, "您已经举报过该物品,请勿重复举报!"); + public static CodeMsg HOME_STUDENT_REPORTED_NO_EXIST = new CodeMsg(-40002, "举报信息不存在!"); //前端用户评论 public static CodeMsg ADD_COMMENT_SUCCESSFULLY = new CodeMsg(-50000,"添加评论成功!"); public static CodeMsg HOME_STUDENT_COMMENT_ADD_ERROR = new CodeMsg(-50001, "评论失败,请联系管理员!"); diff --git a/app/src/main/java/kunpeng/bean/Result.java b/app/src/main/java/kunpeng/bean/Result.java index 6c23527f937c6eb82ce0816faeaf62204ef0c603..fc3e2f611e9124b020cc866cb5c09f171a887aa1 100644 --- a/app/src/main/java/kunpeng/bean/Result.java +++ b/app/src/main/java/kunpeng/bean/Result.java @@ -47,6 +47,9 @@ public class Result { public static Result success(T data){ return new Result(data,CodeMsg.SUCCESS); } +/* public static Result successful(CodeMsg codeMsg){ + return new Result(codeMsg); +}*/ public static Result success(CodeMsg successCodeMessage){ if (successCodeMessage.getCode() % 10 != 0){ diff --git a/app/src/main/java/kunpeng/controller/ActivityController.java b/app/src/main/java/kunpeng/controller/ActivityController.java index c2c82cd23b206b6072c01b25220eb4b6d5816258..1219f5df464539be382e7736028865eb9e7599b2 100644 --- a/app/src/main/java/kunpeng/controller/ActivityController.java +++ b/app/src/main/java/kunpeng/controller/ActivityController.java @@ -1,3 +1,4 @@ +/* package kunpeng.controller; import com.fasterxml.jackson.core.JsonProcessingException; @@ -101,9 +102,16 @@ public class ActivityController { } return resultMap; } + @RequestMapping("/queryactivity") + @ResponseBody + public ListgetAllActivitiesTitles() { //return userService.findAll(); + List allActivitiesTitles = activityService.getAllActivitiesTitles(); + return allActivitiesTitles; + } @RequestMapping ("/getActivitybyID") public Activity getActivityByID(@RequestParam String actID){ return activityService.getActivityByID(Integer.parseInt(actID)); } } +*/ diff --git a/app/src/main/java/kunpeng/controller/AdminController.java b/app/src/main/java/kunpeng/controller/AdminController.java new file mode 100644 index 0000000000000000000000000000000000000000..21d70a94fad458d558ddb7b49146f17195ab64b3 --- /dev/null +++ b/app/src/main/java/kunpeng/controller/AdminController.java @@ -0,0 +1,208 @@ +package kunpeng.controller; + +import entity.Admin; +import entity.User; +import kunpeng.bean.CodeMsg; +import kunpeng.bean.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.DigestUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.*; +import service.AdminService; +import service.UserService; +import sun.security.util.Password; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api") +public class AdminController { + @Autowired + private AdminService adminService; + @Autowired + private UserService userService; + + + /* @RequestMapping(value = "/loginAdmin", method = RequestMethod.POST) + @ResponseBody + public Result login(@RequestParam String adName, @RequestParam String adPassword) { + + Admin admin = adminService.adminLogin(adName, adPassword); + if (admin == null) { + + return Result.error(CodeMsg.ADMIN_INFO_EMPTY); + } else if (StringUtils.isEmpty(admin.getAdName())) { + return Result.error(CodeMsg.ADMIN_NAME_EMPTY); + + } else if (StringUtils.isEmpty(admin.getAdPassword())) { + return Result.error(CodeMsg.ADMIN_PASSWORD_EMPTY); + } else { + return Result.success(true); + } + + }*/ + + @RequestMapping (value = "/loginAdmin", method = RequestMethod.POST) + @ResponseBody + public Map login(@RequestParam String adNo, @RequestParam String adPassword) { + Map map = new HashMap(); + String password = DigestUtils.md5DigestAsHex(adPassword.getBytes()); + Admin admin = adminService.findByAdminNO(adNo); + if (admin == null) { + map.put("code", CodeMsg.ADMIN_USERNAME_NO_EXIST); + return map; + } else if (admin.getAdPassword().equals(password)) { + map.put("code", CodeMsg.LOGIN_SUCCESS); + map.put("admir", admin); + return map; + } else { + map.put("code", CodeMsg.ADMIN_PASSWORD_ERROR); + return map; + } + } +/* @RequestMapping(value = "/addAdmin", method = RequestMethod.POST) + @ResponseBody + public Result addAComment(@RequestParam String sno, @RequestParam String sname, @RequestParam String commentContent, @RequestParam String actID){ + if(!sno.matches(IDRegex)){ + return Result.error(CodeMsg.HOME_WRONG_STUDENT_NUMBER_FORMAT); + } + else if (sname.isEmpty()){ + return Result.error(CodeMsg.USERNAME_NO_EXIST); + } + else if (!actID.matches(IDRegex)){ + return Result.error(CodeMsg.BAD_ACTIVITYID_FORMAT); + } + else if (commentContent.equals("") || commentContent.isEmpty()){ + return Result.error(CodeMsg.HOME_STUDENT_COMMENT_CONTENT_EMPTY); + } + System.out.println("Adding a comment"); + Comment comment = new Comment(); + comment.setCmt_Sname(sname); + comment.setCmt_Date(new Date()); + comment.setCmt_Content(commentContent); + comment.setSno(Integer.valueOf(sno)); + comment.setActID(Integer.valueOf(actID)); + try { + commentService.addAComment(comment); + System.out.println("插入成功!"); + } + catch (Exception e){ + if (e instanceof DataIntegrityViolationException){//外键出现问题,证明用户/活动不在对应数据库 + return Result.error(CodeMsg.DATA_ERROR); + } + + else { + return Result.error(CodeMsg.HOME_STUDENT_COMMENT_ADD_ERROR); + } + } + return Result.success(CodeMsg.ADD_COMMENT_SUCCESSFULLY); + }*/ + + + + +@RequestMapping(value = "/addAdmin",method = RequestMethod.POST) +public Result Register(@RequestParam String sno,@RequestParam String adNo) { + User user = userService.findBySno(sno); + Admin admin = adminService.findByAdminNO(adNo); + if (admin.getAdAuthority().equals(1)) { + return Result.error(CodeMsg.LEVEL_ERROR); + } + try{ + Admin admin1 = new Admin(); + admin1.setAdNo(user.getSno()); + admin1.setAdName(user.getSname()); + admin1.setAdCollege(user.getScollege()); + admin1.setAdPassword(user.getPassword()); + admin1.setAdSex(user.getSex()); + admin1.setAdAge(user.getAge()); + int affected = adminService.addAdmin(admin1); + if (affected >=1){ + return Result.success(CodeMsg.ADD_ADMIN_SUCCESS); + }else{ + return Result.error(CodeMsg.Unknown_ERROR); + } + } catch (Exception e) { + + return Result.error(CodeMsg.Unknown_ERROR); + } +} + + @RequestMapping("/updateAdmin") + @ResponseBody + public Result Update(@RequestBody Admin admin) { + if (admin==null){ + return Result.error(CodeMsg.Unknown_ERROR); + } + try { + int affected = adminService.updateAdmin(admin); + if (affected >=1){ + return Result.success(CodeMsg.UPDATE_ADMIN_SUCCESS); + } + else { + return Result.error(CodeMsg.UPDATE_ADMIN_ERROR); + } + } + catch (Exception e){ + return Result.error(CodeMsg.Unknown_ERROR); + } + } + + + @RequestMapping("/getAdmins") + @ResponseBody + public Map findAllAdmin(){ //return userService.findAll(); + Map map=new HashMap(); + try{ + List admins = adminService.findAllAdmin(); + map.put("code",CodeMsg.ADMINS_INFO); + map.put("adminsInfo",admins); + return map;} + catch (Exception e){ + map.put("code",CodeMsg.ADMINS_INFO_ERROR); + return map; + } + } + + + @RequestMapping(value = "/adminInfo",method = RequestMethod.POST) + @ResponseBody + public Map check(@RequestParam String adNo) { + Map map=new HashMap(); + Admin admin = adminService.findByAdminNO(adNo); + map.put("code",CodeMsg.ADMIN_INFO); + map.put(" adminInfo", admin); + return map; + } + + + @RequestMapping(value = "/delAdmin",method = RequestMethod.DELETE) + @ResponseBody + public Result DeleteAdmin(@RequestParam String adNo){ + if (adNo==null){ + return Result.error(CodeMsg.Unknown_ERROR); + } + try { + int affected = adminService.deleteAdmin(adNo); + if (affected >=1){ + return Result.success(CodeMsg.DELETE_ADMIN_SUCCESS); + } + else { + return Result.error(CodeMsg.DELETE_ADMIN_ERROR); + } + } + catch (Exception e){ + return Result.error(CodeMsg.Unknown_ERROR); + } + + } + + private boolean isExist(String adNo){ + Admin admin = adminService.findByAdminNO(adNo); + if(admin == null)return false; + return true; + } + + } diff --git a/app/src/main/java/kunpeng/controller/CommentController.java b/app/src/main/java/kunpeng/controller/CommentController.java index 0294b47b7a22d8818b8bc56ca070be4e48518e69..0004614a85f4d7f2f80823603ca3fe4b9a723e28 100644 --- a/app/src/main/java/kunpeng/controller/CommentController.java +++ b/app/src/main/java/kunpeng/controller/CommentController.java @@ -1,3 +1,4 @@ +/* package kunpeng.controller; import entity.User; @@ -125,3 +126,4 @@ public class CommentController { } } +*/ diff --git a/app/src/main/java/kunpeng/controller/Interceptor/LoginInterceptor.java b/app/src/main/java/kunpeng/controller/Interceptor/LoginInterceptor.java new file mode 100644 index 0000000000000000000000000000000000000000..7a98a80b1cec9899565baf0d6a5f0b94bd00e135 --- /dev/null +++ b/app/src/main/java/kunpeng/controller/Interceptor/LoginInterceptor.java @@ -0,0 +1,68 @@ +/* +package kunpeng.controller.Interceptor; + +import java.io.IOException; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import entity.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + + +import org.springframework.web.servlet.ModelAndView; + +*/ +/** + * 登录拦截器 + * @author Administrator + * + *//* + +@Component +public class LoginInterceptor implements HandlerInterceptor{ + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { +// System.out.println("执行了TestInterceptor的preHandle方法"); + try { + //统一拦截(查询当前session是否存在user)(这里user会在每次登陆成功后,写入session) + User user=(User)request.getSession().getAttribute("USER"); + if(user!=null){ + return true; + } + response.sendRedirect(request.getContextPath()+"/api/login"); + } catch (IOException e) { + e.printStackTrace(); + } + return false;//如果设置为false时,被请求时,拦截器执行到此处将不会继续操作 + //如果设置为true时,请求将会继续执行后面的操作 + } + + */ +/** + * 请求处理之后进行调用,但是在视图被渲染之前(Controller方法调用之后) + *//* + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) { +// System.out.println("执行了TestInterceptor的postHandle方法"); + } + + */ +/** + * 在整个请求结束之后被调用,也就是在DispatcherServlet 渲染了对应的视图之后执行(主要是用于进行资源清理工作) + *//* + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { +// System.out.println("执行了TestInterceptor的afterCompletion方法"); + } +} +*/ diff --git a/app/src/main/java/kunpeng/controller/UserController.java b/app/src/main/java/kunpeng/controller/UserController.java index 4b23bbd9a111b142337038125710b1ff2c4a837b..d8b58c0abcf37bb7f4ea32d7258841a7e64c4175 100644 --- a/app/src/main/java/kunpeng/controller/UserController.java +++ b/app/src/main/java/kunpeng/controller/UserController.java @@ -3,49 +3,71 @@ package kunpeng.controller; import POJO.Iml.Usertest; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import entity.Activity; +import entity.Notice; import entity.User; import kunpeng.bean.CodeMsg; import kunpeng.bean.Result; import kunpeng.until.StringUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Controller; +import org.springframework.util.DigestUtils; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import service.ActivityService; +import service.NoticeService; import service.UserService; -import java.sql.SQLSyntaxErrorException; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; import java.util.List; +import java.util.Map; + @RestController @RequestMapping("/api") public class UserController { @Autowired private UserService userService; + @Autowired + private ActivityService activityService; + @Autowired + private NoticeService noticeService; - @RequestMapping("/toIndex") - public String show() { - return "index"; - } + @RequestMapping(value="/index",method=RequestMethod.GET) + public Map index(){ + Map map=new HashMap(); + try{ + List allActivities = activityService.getAllActivities(); + List allNotices = noticeService.getAllNotices(); + map.put("Activities",allActivities); + map.put("Notices", allNotices); + return map; + }catch (Exception e){ + map.put("code",CodeMsg.Unknown_ERROR); + return map; + } + + } @RequestMapping (value = "/login", method = RequestMethod.POST) @ResponseBody - public Result login(@RequestParam String Sno, @RequestParam String Password) { - Integer Sn = Integer.valueOf(Sno); - // int i = Integer.parseInt(Sno); - System.out.println("username:" + Sn + ", password:" +Password); - User user = userService.login(Sno, Password); - if (user == null) { - - return Result.error(CodeMsg.DATA_ERROR); - } else if (StringUtils.isEmpty(user.getSname())){ - return Result.error(CodeMsg.USERNAME_NO_EXIST); - - }else if (StringUtils.isEmpty(user.getPassword())){ - return Result.error(CodeMsg.User_PASSWORD_ERROR); - }else - { - return Result.success(true); + public Map login(@RequestParam String Sno, @RequestParam String Password) { + Map map=new HashMap(); + String password = DigestUtils.md5DigestAsHex(Password.getBytes()); + System.out.println("username:" + Sno + ", password:" +Password); + User user =userService.findBySno(Sno); + if (user == null) { + map.put("code",CodeMsg.USER_NAME_NO_EXIST); + return map; + } else if (user.getPassword().equals(password)){ + map.put("code",CodeMsg.LOGIN_SUCCESS); + map.put("user",user); + return map; + }else { + map.put("code",CodeMsg.USER_PASSWORD_ERROR); + return map; } /*if(user !=null) { return "20"; @@ -55,8 +77,49 @@ public class UserController { } @RequestMapping(value = "/register",method = RequestMethod.POST) - public String Register(@RequestBody Usertest uste) { - System.out.println("xx"); + public Result Register(@RequestBody User user) { + + if(user == null){ + return Result.error(CodeMsg.USER_INFO_EMPTY); + } + /* if(StringUtils.isEmpty(user.getSno())){ + + return Result.error(CodeMsg.User_SNO_EMPTY); + } + if(StringUtils.isEmpty(user.getSname())){ + + return Result.error(CodeMsg.USER_USERNAME_EMPTY); + } + if(StringUtils.isEmpty(user.getPassword())){ + + return Result.error(CodeMsg.USER_PASSWORD_EMPTY); + + }if(StringUtils.isEmpty(user.getScollege())){ + + return Result.error(CodeMsg.User_SCOLLEGE_EMPTY); + + }if(StringUtils.isEmpty(user.getSex())){ + + return Result.error(CodeMsg.User_SEX_EMPTY); + } + if(StringUtils.isEmpty(user.getAge())){ + + return Result.error(CodeMsg.User_AGE_EMPTY); + }*/ + String s = DigestUtils.md5DigestAsHex(user.getPassword().getBytes()); + user.setPassword(s); + if(isExist(user.getSno())){ + + return Result.error(CodeMsg.USER_SNO_IS_EXIST); + } + if(userService.register(user) <= 0){ + + return Result.error(CodeMsg.Unknown_ERROR); + } + + return Result.success(CodeMsg.REGISTER_SUCCESS); + + // Usertest usertest; // ObjectMapper objectMapper=new ObjectMapper(); // try { @@ -72,55 +135,164 @@ java 转 kotlin 时会自动小写。 * * * */// System.out.println(user.getSex()); - int register = 1; - if (register==1) { + /* int register = 1;*/ + /* if (register==1) { return "30"; } else { return "32"; - } + }*/ } - @RequestMapping("/updateUser") - @ResponseBody - public String Update(@RequestBody User user) { - - int register = userService.register(user); - if (register==1) { + @RequestMapping("/edit") + @ResponseBody + public Result Update(@RequestBody User user) { + if (user==null){ + return Result.error(CodeMsg.Unknown_ERROR); + } + try { + int affected = userService.updateUser(user); + if (affected >=1){ + return Result.success(CodeMsg.UPDATE_USER_SUCCESS); + } + else { + return Result.error(CodeMsg.UPDATE_USER_ERROR); + } + } + catch (Exception e){ + return Result.error(CodeMsg.Unknown_ERROR); + } + } + @RequestMapping(value = "/userinfo",method = RequestMethod.POST) + @ResponseBody + public Map check(@RequestParam String sno) { + Map map=new HashMap(); + try{ + User user = userService.findBySno(sno); + map.put("code",CodeMsg.USER_INFO); + map.put("userinfo",user); + return map;}catch (Exception e){ + map.put("code",CodeMsg.Unknown_ERROR); + return map; + } + } - return "loginsucess"; - } else { - return "loginError"; - } - } - @RequestMapping("/user/{id}") - @ResponseBody - public User check(@PathVariable Integer id) { - User user = userService.findById(String.valueOf(id)); - return user; - } - @RequestMapping("/findAll") + @RequestMapping("/getUsers") @ResponseBody - public List findAll(){ //return userService.findAll(); - return userService.findAll(); + public Map findAllUser(){ //return userService.findAll(); + Map map=new HashMap(); + try{ + List user = userService.findAllUser(); + map.put("code",CodeMsg.USERS_INFO); + map.put("userinfo",user); + return map;}catch (Exception e){ + map.put("code",CodeMsg.Unknown_ERROR); + return map; + } + } + @RequestMapping("/getMembers") + @ResponseBody + public Map findtMembers(){ //return userService.findAll(); + Map map=new HashMap(); + try{ + List members = userService.findMembers(); + map.put("code",CodeMsg.MEMBERS_INFO); + map.put("memberInfo",members); + return map; + } catch (Exception e){ + map.put("code",CodeMsg.Unknown_ERROR); + return map; + } } - @RequestMapping("/joinCommunity") - public Result applyJoinCommunity(@RequestParam String sno){ - int affected; + @RequestMapping(value = "/delUser",method = RequestMethod.DELETE) + @ResponseBody + public Result DeleteUser(String sno){ + if (sno==null){ + return Result.error(CodeMsg.Unknown_ERROR); + } + try { + int affected = userService.deleteUser(sno); + if (affected >=1){ + return Result.success(CodeMsg.DELETE_USER_SUCCESS); + } + else { + return Result.error(CodeMsg.DELETE_USER_ERROR); + } + } + catch (Exception e){ + return Result.error(CodeMsg.Unknown_ERROR); + } + + } + + @RequestMapping(value = "/joinCommunity",method = RequestMethod.DELETE) + @ResponseBody + public Result joinCommunity( @RequestParam String sno){ + if (sno==null){ + return Result.error(CodeMsg.Unknown_ERROR); + } + try { + int affected = userService.joinCommunity(sno); + if (affected >=1){ + return Result.success(CodeMsg.joinCommunity_SUCCESS); + } + else { + return Result.error(CodeMsg.joinCommunity_EORROR); + } + } + catch (Exception e){ + return Result.error(CodeMsg.Unknown_ERROR); + } + + } + @RequestMapping(value = "/rejectJoin",method = RequestMethod.DELETE) + @ResponseBody + public Result rejectJoin( @RequestParam String sno){ + if (sno==null){ + return Result.error(CodeMsg.Unknown_ERROR); + } try { - affected = userService.updateJoinedStatusBySno(sno); + int affected = userService.rejectJoin(sno); + if (affected >=1){ + return Result.success(CodeMsg.rejectJoin_SUCCESS); + } + else { + return Result.error(CodeMsg.rejectJoin_ERROR); + } } catch (Exception e){ - if (e instanceof DataIntegrityViolationException || e instanceof SQLSyntaxErrorException){ - throw e; + return Result.error(CodeMsg.Unknown_ERROR); + } + + } + @RequestMapping(value = "/acceptJoin",method = RequestMethod.DELETE) + @ResponseBody + public Result acceptJoin( @RequestParam String sno){ + if (sno==null){ + return Result.error(CodeMsg.Unknown_ERROR); + } + try { + int affected = userService.acceptJoin(sno); + if (affected >=1){ + return Result.success(CodeMsg.acceptJoin_SUCCESS); } else { - return Result.error(CodeMsg.UNKNOWN_ERROR); + return Result.error(CodeMsg. acceptJoin_ERROR); } } - return affected > 0 ? Result.success(CodeMsg.APPLY_JOINED_SUCCESSFULLY) : Result.error(CodeMsg.APPLY_JOINED_FAILED); + catch (Exception e){ + return Result.error(CodeMsg.Unknown_ERROR); + } + + } + + + private boolean isExist(String sno){ + User user = userService.findBySno(sno); + if(user == null)return false; + return true; } } diff --git a/app/src/test/java/Test.java b/app/src/test/java/Test.java index 92968568fdc913ae5c473e933b1178bbddac7768..d8ce1ce7e66be973c87f12370b0f9e8029f90ab0 100644 --- a/app/src/test/java/Test.java +++ b/app/src/test/java/Test.java @@ -29,7 +29,7 @@ public class Test { testB testB; @org.junit.jupiter.api.Test public void test(){ - userService.login();//测试 + /* userService.login();//测试*/ /* userService.login("sff","xxxx");*/ System.out.println("autowiredxx"); } diff --git a/kotlin/kotlin.iml b/kotlin/kotlin.iml index 1e59e513f4c73db085ec951001f4491351e43b93..146bcc5824c51dcdb3b900a280aa1fb223752a7a 100644 --- a/kotlin/kotlin.iml +++ b/kotlin/kotlin.iml @@ -3,6 +3,8 @@