基于javaweb+mysql的ssm+maven小说阅读系统(java+ssm+jsp+javascript+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven小说阅读系统(java+ssm+jsp+javascript+mysql)
项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax等等。
/**
* 用户管理控制器
*/
@Controller
@RequestMapping("/xsauth")
public class AuthController {
@Autowired
UserService userService;
@Autowired
GroupService groupService;
@Autowired
PermissionService permissionService;
@RequestMapping(value = "/register", method = RequestMethod.POST)
public void register(HttpServletRequest request, HttpServletResponse response){
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
UserValidator userValidator = new UserValidator(request, userService);
response.setContentType("application/json; charset=UTF-8");
try {
if(userValidator.clean()){
User user = (User) userValidator.save();
request.getSession().setAttribute("user",user);
response.getWriter().write(RESTful.ok());
} else{
String message = userValidator.getMessage();
response.getWriter().write(RESTful.params_error(message,null));
}
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String login(String telephone, String password, String remember, HttpSession session){
novel.setWords_num(novel.getWords_num() - originChapter.getWords_num() + chapter.getWords_num());
novelService.updateSelective(novel);
// 保存chapter
chapterService.updateByIdSelective(chapter);
return RESTful.ok();
}
@RequestMapping(value = "/delete_chapter", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String deleteChapter(HttpSession session, String chapter_id){
User user = (User) session.getAttribute("user");
Chapter chapter = chapterService.getChapterById(chapter_id);
Novel novel = chapter.getNovel();
if(chapter == null)
return RESTful.params_error("该章节不存在");
if(!novel.getAuthor().getId().equals(user.getId()))
return RESTful.unauth("您不是该小说的作者");
// 更新小说的总字数和章数
novel.setWords_num(novel.getWords_num() - chapter.getWords_num());
novel.setChapters_num(novel.getChapters_num() - 1);
novelService.updateSelective(novel);
// 删除章节
chapterService.deleteById(chapter.getId());
return RESTful.ok();
}
// 收藏图书
@RequestMapping(value = "/collect", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String collectNovel(HttpSession session, String novel_id){
User user = (User) session.getAttribute("user");
// 判断该小说是否已经收藏
List<UserCollect> collects = collectService.getByUidAndNid(user.getId(), novel_id);
if(collects.size() > 0)
return RESTful.params_error("不能重复收藏,请刷新页面");
int insert_rows = collectService.insert(user.getId(),novel_id);
if(insert_rows <= 0)
return RESTful.params_error("插入失败,小说不存在");
return RESTful.ok();
}
public class UserValidator extends Validator {
private UserService userService;
private String telephone;
private String username;
private String password1;
private String password2;
private String img_captcha;
private String sms_captcha;
public UserValidator(HttpServletRequest request, UserService userService){
super(request);
this.userService = userService;
this.telephone = (String) request.getParameter("telephone");
this.username = (String) request.getParameter("username");
this.password1 = (String) request.getParameter("password1");
this.password2 = (String) request.getParameter("password2");
this.img_captcha = (String) request.getParameter("img_captcha");
this.sms_captcha = (String) request.getParameter("sms_captcha");
}
public boolean clean(){
if(!cleanTelephone()) return false;
if(!cleanUsername()) return false;
if(!cleanPassword(password1)) return false;
if(!cleanPassword(password2)) return false;
if(!password1.equals(password2)) {
message = "两次输入的密码不一致";
return false;
}
if(!cleanImgCaptcha()) return false;
public String submitBecomeWriter(Model model, HttpSession session, String pen_name) {
System.out.println("pen_name: " + pen_name);
User user = (User) session.getAttribute("user");
if (user.getIs_author()){
model.addAttribute("message", "您已是作家");
return "redirect:/account/become_writer";
}
user.setIs_author(true);
user.setPen_name(pen_name);
userService.updateSelective(user);
return "redirect:/account/index";
}
// ********* 作家专区 ***********
// 作品列表
@RequestMapping("/novel_list")
public String novelList(Model model, HttpSession session, NovelPage page){
NovelExample example = page.getExample();
NovelExample.Criteria criteria = page.getCriteria();
User user = (User) session.getAttribute("user");
criteria.andAuthor_idEqualTo(user.getId()); // 设置用户
// 获取用户的所有作品
PageHelper.startPage(page.getP(),page.getCount());
List<Novel> novels = novelService.getByExampleWithBLOBs(example);
// 获取并设置作品总数
int total = (int) new PageInfo<>(novels).getTotal();
page.setTotal(total);
// 获取分类列表
List<Category> categories = categoryService.getCategories();
Map<String,Object> context = new HashMap<String,Object>();
context.put("novels", novels);
context.put("categories",categories);
context.putAll(page.getParams());
model.addAllAttributes(context);
return "account/novel_list";
}
// 发布作品 GET
@RequestMapping(value = "/pub_novel", method = RequestMethod.GET)
public String pubNovel(){
return "account/pub_novel";
}
@RequestMapping(value = "/add_novel", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String addNovel(HttpSession session, @Validated Novel novel, BindingResult br){
@RequestMapping("/cms")
public class CMSController {
@Autowired
NovelService novelService;
@Autowired
CategoryService categoryService;
@Autowired
ChapterService chapterService;
@Autowired
CollectService collectService;
@Autowired
ReadService readService;
@Autowired
TagService tagService;
@Autowired
BannerService bannerService;
@Autowired
AdvertisementService advertisementService;
@Autowired
ExcellentworksService excellentworksService;
@Autowired
UserService userService;
@Autowired
GroupService groupService;
@Autowired
UserGroupService userGroupService;
@RequestMapping("/index")
public String index(Model model){
int[] range10 = new int[10];
for(int i = 0; i < range10.length; i++){
range10[i] = i + 1;
}
model.addAttribute("range10",range10);
return "cms/index";
}
@RequestMapping("/novel_list")
public String novelList(Model model, HttpSession session, NovelPage page){
System.out.println("novel_list");
NovelExample example = page.getExample();
public String addBanner(@Validated Banner banner, BindingResult br){
if(br.hasErrors())
return RESTful.params_error(br.getFieldError().getDefaultMessage());
bannerService.addBanner(banner);
Map<String,Object> data = new HashMap<>();
data.put("banner_id",banner.getId());
return RESTful.ok(data);
}
@RequestMapping(value = "/edit_banner", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String editBanner(@Validated Banner banner, BindingResult br){
if(br.hasErrors())
return RESTful.params_error(br.getFieldError().getDefaultMessage());
bannerService.updateBanner(banner);
return RESTful.ok();
}
@RequestMapping(value = "/delete_banner", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String deleteBanner(Integer id){
if(id == null)
return RESTful.params_error("参数错误");
Banner banner = bannerService.getById(id);
if(banner == null)
return RESTful.params_error("该轮播图不存在");
bannerService.deleteById(id);
return RESTful.ok();
}
// 广告管理
@RequestMapping("/ad_set")
public String adSet(Model model){
List<Advertisement> ads = advertisementService.getAdvertisements();
model.addAttribute("ads",ads);
return "cms/ad_set";
}
@RequestMapping(value = "/add_ad", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String addAd(@Validated Advertisement advertisement, BindingResult br){
if(br.hasErrors())
user.setIs_author(true);
user.setPen_name(pen_name);
userService.updateSelective(user);
return "redirect:/account/index";
}
// ********* 作家专区 ***********
// 作品列表
@RequestMapping("/novel_list")
public String novelList(Model model, HttpSession session, NovelPage page){
NovelExample example = page.getExample();
NovelExample.Criteria criteria = page.getCriteria();
User user = (User) session.getAttribute("user");
criteria.andAuthor_idEqualTo(user.getId()); // 设置用户
// 获取用户的所有作品
PageHelper.startPage(page.getP(),page.getCount());
List<Novel> novels = novelService.getByExampleWithBLOBs(example);
// 获取并设置作品总数
int total = (int) new PageInfo<>(novels).getTotal();
page.setTotal(total);
// 获取分类列表
List<Category> categories = categoryService.getCategories();
Map<String,Object> context = new HashMap<String,Object>();
context.put("novels", novels);
context.put("categories",categories);
context.putAll(page.getParams());
model.addAllAttributes(context);
return "account/novel_list";
}
// 发布作品 GET
@RequestMapping(value = "/pub_novel", method = RequestMethod.GET)
public String pubNovel(){
return "account/pub_novel";
}
@RequestMapping(value = "/add_novel", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String addNovel(HttpSession session, @Validated Novel novel, BindingResult br){
if(br.hasErrors()){
// List<FieldError> errors = br.getFieldErrors();
// for(FieldError error : errors){
// System.out.println(error.getField() + error.getDefaultMessage());
model.addAttribute("novel",novel);
return "cms/edit_chapter";
}
@RequestMapping(value = "/update_chapter", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String updateChapter(HttpSession session, @Validated Chapter chapter, BindingResult br){
if(br.hasErrors()){
return RESTful.params_error(br.getFieldError().getDefaultMessage());
}
// 设置chapter字数
chapter.setWords_num();
// 获取novel
Chapter originChapter = chapterService.getChapterById(chapter.getId());
Novel novel = originChapter.getNovel();
// 更新novel的总字数
novel.setWords_num(novel.getWords_num() - originChapter.getWords_num() + chapter.getWords_num());
novelService.updateSelective(novel);
// 保存chapter
chapterService.updateByIdSelective(chapter);
Map<String,Object> data = new HashMap<>();
data.put("redirect","/cms/chapter_list?novel_id=" + novel.getId());
return RESTful.result(200,"", data);
}
@RequestMapping(value = "/delete_chapter", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String deleteChapter(HttpSession session, String chapter_id){
User user = (User) session.getAttribute("user");
Chapter chapter = chapterService.getChapterById(chapter_id);
Novel novel = chapter.getNovel();
if(chapter == null)
return RESTful.params_error("该章节不存在");
// 更新小说的总字数和章数
novel.setWords_num(novel.getWords_num() - chapter.getWords_num());
novel.setChapters_num(novel.getChapters_num() - 1);
novelService.updateSelective(novel);
// 删除章节
chapterService.deleteById(chapter.getId());
return RESTful.ok();
}
@RequestMapping(value = "/set_recommend", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String setRecommend(String novel_id){
if(novel_id == null || novel_id.equals(""))
return RESTful.params_error("小说id不能为空");
Novel novel = novelService.getByPrimaryKey(novel_id);
g.setColor(new Color(random.nextInt(101), random.nextInt(111), random
.nextInt(121)));
String rand = String.valueOf(getRandomString(random.nextInt(randString
.length())));
randomString += rand;
g.translate(random.nextInt(3), random.nextInt(3));
g.drawString(rand, 15 * i, 28);
return randomString;
}
/**
* 绘制干扰线
*/
private void drowLine(Graphics g) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(13);
int yl = random.nextInt(15);
g.drawLine(x, y, x + xl, y + yl);
}
/**
* 获取随机的字符
*/
public String getRandomString(int num) {
return String.valueOf(randString.charAt(num));
}
}
/**
* 拦截器
* 登录之后才能访问
*/
public class AuthInterceptor extends HandlerInterceptorAdapter {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
@Controller
@RequestMapping("")
public class NovelController {
@Autowired
BannerService bannerService;
@Autowired
AdvertisementService advertisementService;
@Autowired
NovelService novelService;
@Autowired
ChapterService chapterService;
@Autowired
ExcellentworksService excellentworksService;
@Autowired
ReadService readService;
@Autowired
CollectService collectService;
@Autowired
CategoryService categoryService;
@Autowired
TagService tagService;
public static void main(String[] args) {
System.out.println(MD5.str2MD5("123456"));
}
@RequestMapping("")
public String index(Model model, HttpSession session) {
String[][] all_category_name = Category.CATEGORY_NAME;
List<Banner> banners = bannerService.getBanners();
List<Advertisement> ads = advertisementService.getAdvertisements();
PageHelper.offsetPage(0, 6);
List<Novel> rec_novels_1_6 = novelService.getRecommendNovels(true);
public boolean clean(){
if(!cleanTelephone()) return false;
if(!cleanUsername()) return false;
if(!cleanPassword(password1)) return false;
if(!cleanPassword(password2)) return false;
if(!password1.equals(password2)) {
message = "两次输入的密码不一致";
return false;
}
if(!cleanImgCaptcha()) return false;
if(!cleanSMSCaptcha()) return false;
return true;
}
public boolean cleanTelephone(){
if(telephone == null || telephone.equals("")){
message = "手机号不能为空";
return false;
}
String pa_telephone = "1[3-9]\\d{9}";
boolean is_match = Pattern.matches(pa_telephone, telephone);
if(!is_match) {
message = "手机号输入有误";
return false;
}
User user = userService.getByTelephone(telephone);
if(user != null){
message = "此手机号已注册";
return false;
}
return true;
}
public boolean cleanUsername(){
if(username == null || username.equals("")) {
message = "用户名不能为空";
return false;
}
if(username.length() < 2) {
message = "用户名不能小于2位";
return false;
}
if(username.length() > 12) {
message = "用户名不能大于12位";
return false;
@RequestMapping(value = "/update_chapter", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String updateChapter(HttpSession session, @Validated Chapter chapter, BindingResult br){
if(br.hasErrors()){
return RESTful.params_error(br.getFieldError().getDefaultMessage());
}
// 设置chapter字数
chapter.setWords_num();
// 获取novel
Chapter originChapter = chapterService.getChapterById(chapter.getId());
Novel novel = originChapter.getNovel();
// 更新novel的总字数
novel.setWords_num(novel.getWords_num() - originChapter.getWords_num() + chapter.getWords_num());
novelService.updateSelective(novel);
// 保存chapter
chapterService.updateByIdSelective(chapter);
return RESTful.ok();
}
@RequestMapping(value = "/delete_chapter", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String deleteChapter(HttpSession session, String chapter_id){
User user = (User) session.getAttribute("user");
Chapter chapter = chapterService.getChapterById(chapter_id);
Novel novel = chapter.getNovel();
if(chapter == null)
return RESTful.params_error("该章节不存在");
if(!novel.getAuthor().getId().equals(user.getId()))
return RESTful.unauth("您不是该小说的作者");
// 更新小说的总字数和章数
novel.setWords_num(novel.getWords_num() - chapter.getWords_num());
novel.setChapters_num(novel.getChapters_num() - 1);
novelService.updateSelective(novel);
// 删除章节
chapterService.deleteById(chapter.getId());
return RESTful.ok();
}
// 收藏图书
@RequestMapping(value = "/collect", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String collectNovel(HttpSession session, String novel_id){
public String myCollect(Model model, HttpSession session){
User user = (User) session.getAttribute("user");
List<Novel> collected_novels = novelService.getCollect(user);
model.addAttribute("collected_novels",collected_novels);
return "account/my_collect";
}
@RequestMapping("/become_writer")
public String becomeWriter(Model model, HttpSession session, String message){
User user = (User) session.getAttribute("user");
if(user.getIs_author())
return "account/index";
model.addAttribute("message",message);
return "account/become_writer";
}
@RequestMapping("/submit_become_writer")
public String submitBecomeWriter(Model model, HttpSession session, String pen_name) {
System.out.println("pen_name: " + pen_name);
User user = (User) session.getAttribute("user");
if (user.getIs_author()){
model.addAttribute("message", "您已是作家");
return "redirect:/account/become_writer";
}
user.setIs_author(true);
user.setPen_name(pen_name);
userService.updateSelective(user);
return "redirect:/account/index";
}
// ********* 作家专区 ***********
// 作品列表
@RequestMapping("/novel_list")
public String novelList(Model model, HttpSession session, NovelPage page){
NovelExample example = page.getExample();
NovelExample.Criteria criteria = page.getCriteria();
User user = (User) session.getAttribute("user");
criteria.andAuthor_idEqualTo(user.getId()); // 设置用户
// 获取用户的所有作品
PageHelper.startPage(page.getP(),page.getCount());
List<Novel> novels = novelService.getByExampleWithBLOBs(example);
// 获取并设置作品总数
int total = (int) new PageInfo<>(novels).getTotal();
page.setTotal(total);
// 获取分类列表
List<Category> categories = categoryService.getCategories();
int yl = random.nextInt(15);
g.drawLine(x, y, x + xl, y + yl);
}
/**
* 获取随机的字符
*/
public String getRandomString(int num) {
return String.valueOf(randString.charAt(num));
}
}
/**
* 拦截器
* 登录之后才能访问
*/
public class AuthInterceptor extends HandlerInterceptorAdapter {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HttpSession session = request.getSession();
User user = (User) session.getAttribute("user");
// 判断用户是否登录
if(user == null){
// 判断是否为ajax请求
if (request.getHeader("x-requested-with") != null && request.getHeader("x-requested-with").equalsIgnoreCase("XMLHttpRequest")){
//ajax请求
response.setContentType("application/json");
response.getWriter().print(RESTful.unauth("请先登录"));
return false;
}else{
//非ajax请求
StringBuilder sb = new StringBuilder();
String path = request.getRequestURI();
String queryString = request.getQueryString();
if(path != null){
message = "图片验证码不能为空";
return false;
}
img_captcha = img_captcha.toLowerCase();
String session_image_code = (String) this.session.getAttribute(ImageCaptcha.RANDOMCODEKEY);
if(session_image_code == null) {
message = "图片验证码已过期";
return false;
}
session_image_code = session_image_code.toLowerCase();
if(img_captcha.equals(session_image_code) == false) {
message = "图片验证码输入错误";
return false;
}
return true;
}
public boolean cleanSMSCaptcha(){
Jedis jedis = Redis.JEDIS;
String redis_sms_captcha = jedis.get(telephone);
if(redis_sms_captcha == null){
message = "短信验证码已过时,请重新获取";
return false;
}
if(redis_sms_captcha.equals(sms_captcha) == false){
message = "短信验证码输入错误";
return false;
}
return true;
}
public boolean cleanPassword(String password) {
if(password == null || password.equals("")) {
message = "密码不能为空";
return false;
}
if(password.length() < 6) {
message = "密码长度不能小于6位";
return false;
}
if(password.length() > 16) {
message = "密码长度不能大于16位";
return RESTful.ok();
}
@RequestMapping(value = "/delete_novel_category", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String deleteNovelCategory(Integer id){
if(id == null)
return RESTful.params_error("参数错误");
categoryService.deleteById(id);
return RESTful.ok();
}
// 标签管理
@RequestMapping("tag_list")
public String tagList(Model model){
// 获取分类和标签
List<Category> cate_tags = categoryService.getCategoriesAndTags();
// 获取公共标签(无分类)
List<Tag> common_tags = tagService.getNullCategory();
model.addAttribute("cate_tags",cate_tags);
model.addAttribute("common_tags",common_tags);
return "cms/tag_list";
}
@RequestMapping("tag_detail")
public String tagDetail(Model model, Integer category_id){
Category category = categoryService.getOneAndTags(category_id);
model.addAttribute("category",category);
return "cms/tag_detail";
}
@RequestMapping(value = "/get_tags", produces = "application/json;charset=UTF-8")
@ResponseBody
public String getTags(Integer category_id){
List<Tag> tags;
if(category_id == null)
tags = tagService.getNullCategory();
else
tags = tagService.getByCategoryId(category_id);
Map<String,Object> data = new HashMap<>();
data.put("tags",tags);
return RESTful.result(200,"", data);
}
@RequestMapping(value = "/add_tag", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String addTag(@Validated Tag tag, BindingResult br){
if(br.hasErrors())
return RESTful.params_error(br.getFieldError().getDefaultMessage());
}
@RequestMapping("/img_captcha")
public void imgCaptcha(HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
response.setContentType("image/jpeg");//设置相应类型,告诉浏览器输出的内容为图片
response.setHeader("Pragma", "No-cache");//设置响应头信息,告诉浏览器不要缓存此内容
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expire", 0);
ImageCaptcha randomValidateCode = new ImageCaptcha();
randomValidateCode.getRandcode(request, response);//输出验证码图片
} catch(Exception e){
e.printStackTrace();
}
//从session中取出随机验证码
System.out.println(request.getSession().getAttribute("RANDOMREDISKEY"));
}
@RequestMapping(value = "/sms_captcha", produces = "application/json;charset=UTF-8")
@ResponseBody
public String SMSCaptcha(String telephone){
Jedis jedis = Redis.JEDIS;
// 生成验证码
String captcha = "";
Random random = new Random();
for(int i = 0; i < 6; i++){
int number = random.nextInt(10);
captcha += String.valueOf(number);
}
// 保存到缓存redis
jedis.set(telephone, captcha);
jedis.expire(telephone, 5 * 60);
// 给手机发送验证码,此步骤省略
// 返回
Map<String,Object> data = new HashMap<>();
data.put("code", captcha);
return RESTful.result(200,"",data);
}
public static void main(String[] args) {
//连接本地的 Redis 服务
Jedis jedis = new Jedis("localhost");
System.out.println("连接成功");
//查看服务是否运行
System.out.println("服务正在运行: "+jedis.ping());
}
}
}
return true;
}
public boolean cleanPassword(String password) {
if(password == null || password.equals("")) {
message = "密码不能为空";
return false;
}
if(password.length() < 6) {
message = "密码长度不能小于6位";
return false;
}
if(password.length() > 16) {
message = "密码长度不能大于16位";
return false;
}
return true;
}
/**
* 保存用户到数据库
*/
public Object save() {
User user = new User();
user.setId(ShortUUID.generateShortUuid());
user.setTelephone(telephone);
user.setUsername(username);
user.setPassword(MD5.str2MD5(password1));
user.setDate_joined(new Date());
user.setIs_active(true);
user.setIs_author(false);
user.setIs_staff(false);
user.setIs_superuser(false);
userService.register(user);
return user;
}
}
if(redis_sms_captcha == null){
message = "短信验证码已过时,请重新获取";
return false;
}
if(redis_sms_captcha.equals(sms_captcha) == false){
message = "短信验证码输入错误";
return false;
}
return true;
}
public boolean cleanPassword(String password) {
if(password == null || password.equals("")) {
message = "密码不能为空";
return false;
}
if(password.length() < 6) {
message = "密码长度不能小于6位";
return false;
}
if(password.length() > 16) {
message = "密码长度不能大于16位";
return false;
}
return true;
}
/**
* 保存用户到数据库
*/
public Object save() {
User user = new User();
user.setId(ShortUUID.generateShortUuid());
user.setTelephone(telephone);
user.setUsername(username);
user.setPassword(MD5.str2MD5(password1));
user.setDate_joined(new Date());
user.setIs_active(true);
user.setIs_author(false);
user.setIs_staff(false);
user.setIs_superuser(false);
userService.register(user);
return user;
}
}